npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@al10s/react-native-orbit-sqlite

v0.0.6

Published

Support of React Native SQLite storage for Orbit.js

Downloads

11

Readme

react-native-orbit-sqlite

Allows creating a source of react-native-sqlite-storage for Orbit.js@0.16.x.

Disclaimer

The current content of this repo should be safe to use, but may not be actively maintained. Use it at your own risks.

I will bump the PATCH version for every new fix that occurs, but the MINOR will stay at 0 until the whole content has been fully approved.

Then I will bump the version to match the supported Orbit.js version.

Note : I noticed some internal changes that might break the compatibility of my code towards the upcoming release of Orbit.js v0.17.

Note(2) : Help and advices are welcome.

Install

Check your version of Orbit. Current supported version is 0.16.x.

yarn add react-native-sqlite-storage # Required to autolink for react native
yarn add @al10s/react-native-orbit-sqlite

Example of use

// db.ts
import SQLiteSource from '@al10s/react-native-orbit-sqlite';
import { Schema, QueryBuilder } from '@orbit/data';
import MemorySource from '@orbit/memory';
import ExampleSchema from './schemas/example';

const schema = new Schema({
  models: {
    example: ExampleSchema,
  }
});

export const memory = new MemorySource({
  schema,
  name: 'memory',
});

const backup = new SQLiteSource({
  schema,
  name: 'backup',
  namespace: 'MyNamespace',
});

const coordinator = new Coordinator({
  sources: [ memory, backup ],
});

const backupMemorySync = new SyncStrategy({
  source: 'memory',
  target: 'backup',
  blocking: true,
});

coordinator.addStrategy(backupMemorySync);

export async function init (): Promise<void> {
  const transform = await backup.pull((q: QueryBuilder) => q.findRecords());
  await memory.sync(transform);
  await coordinator.activate();
}
// index.ts
import { memory, init as initDb } from './db';
import { QueryBuilder } from '@orbit/data';

initDb()
  .then(() => memory.query((q: QueryBuilder) => q.findRecords('example')))
  .then((examples) => { console.log(examples); });

Tests

I created a little React Native app in order to execute the tests. It is located under the /tests directory.

First of all, install the node modules.

# Location : <project>/tests/
yarn install

The tested code is the one published on npm.

To test modifications of the code, we will need to replace the tested code as follows :

# Location : <project>/
yarn run tsc # Compile the TypeScript code into JavaScript
rm tests/node_modules/@al10s/react-native-orbit-sqlite/dist/* # Delete the published code that is tested
cp dist/* tests/node_modules/@al10s/react-native-orbit-sqlite/dist/ # Copy the compiled code instead

Android

You will need to add a valid debug.keystore in android/app/.

If you ever worked with Android Studio, there's a chance that one is located under the .android folder.

cp ~/.android/debug.keystore <project>/tests/android/app/

Then you can start a metro server

# Location : <project>/tests/
yarn start

Then you are ready to test it on your device (or in a VM)

# Location : <project>/tests/
yarn run android

iOS

I don't own a Mac so I can't test it yet, but if you know the procedure to follow you can tell me and I will change it if needed.

# Location : <project>/tests/ios
pod install
# Location : <project>/tests/
yarn run ios