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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sqlsync-react-native

v1.0.0

Published

React Native SDK for SqlSync Laravel Package — fetch, search, and sync accounting data

Readme

sqlsync-react-native

React Native SDK for sqlsync/laravel-sqlsync.

Fetch, search, and display synced accounting data in your mobile app with one hook.


Installation

npm install sqlsync-react-native
npm install @react-native-async-storage/async-storage

Setup

Wrap your app with SqlSyncProvider:

import { SqlSyncProvider } from 'sqlsync-react-native';

export default function App() {
  return (
    <SqlSyncProvider config={{
      baseUrl: 'https://api.yourapp.com',
      preset: 'al_ameen',
      companyId: 1,         // only if multi-tenant
      perPage: 20,
      refreshInterval: 60000, // auto-refresh every 60s (optional)
    }}>
      <Navigation />
    </SqlSyncProvider>
  );
}

Usage

List + Search

import { useSqlSync, useSqlSyncConfig } from 'sqlsync-react-native';
import { FlatList, TextInput, Text, View, ActivityIndicator } from 'react-native';

export function ProductsScreen() {
  const config = useSqlSyncConfig();
  const { records, loading, search, loadMore, refresh, refreshing, total } = useSqlSync(config);

  return (
    <View style={{ flex: 1 }}>
      <TextInput
        placeholder="Search products..."
        onChangeText={search}
        style={{ padding: 12, borderBottomWidth: 1 }}
      />

      {loading ? (
        <ActivityIndicator style={{ marginTop: 40 }} />
      ) : (
        <FlatList
          data={records}
          keyExtractor={(item) => item.source_guid}
          onEndReached={loadMore}
          onRefresh={refresh}
          refreshing={refreshing}
          renderItem={({ item }) => (
            <View style={{ padding: 16, borderBottomWidth: 1 }}>
              <Text style={{ fontWeight: 'bold' }}>{item.name}</Text>
              <Text>{item.barcode} · {item.unit}</Text>
              <Text>Qty: {item.quantity}</Text>
            </View>
          )}
        />
      )}
    </View>
  );
}

Single Record

import { useSqlSyncRecord, useSqlSyncConfig } from 'sqlsync-react-native';

export function ProductDetail({ guid }: { guid: string }) {
  const config = useSqlSyncConfig();
  const { record, loading } = useSqlSyncRecord(guid, config);

  if (loading) return <ActivityIndicator />;
  if (!record) return <Text>Not found</Text>;

  return (
    <View>
      <Text>{record.name}</Text>
      <Text>{record.latin_name}</Text>
      <Text>Price: {record.extra_data?.price_1}</Text>
    </View>
  );
}

Dashboard Stats

import { useSqlSyncStats, useSqlSyncConfig } from 'sqlsync-react-native';

export function Dashboard() {
  const config = useSqlSyncConfig();
  const { stats, loading } = useSqlSyncStats(config);

  if (loading || !stats) return <ActivityIndicator />;

  return (
    <View>
      <Text>Total Products: {stats.total_records}</Text>
      <Text>Agents Online: {stats.agents_online}</Text>
      <Text>Last Sync: {stats.last_sync}</Text>
    </View>
  );
}

API Reference

useSqlSync(config)

| Return | Type | Description | |--------|------|-------------| | records | SqlSyncRecord[] | Current page records | | loading | boolean | Initial load state | | refreshing | boolean | Pull-to-refresh state | | error | string \| null | Error message | | total | number | Total records count | | hasMore | boolean | More pages available | | search(term) | function | Search by name/barcode/code | | loadMore() | function | Load next page | | refresh() | function | Pull-to-refresh | | clearSearch() | function | Clear search term |

SqlSyncConfig

| Option | Type | Default | Description | |--------|------|---------|-------------| | baseUrl | string | required | Laravel backend URL | | preset | string | — | Filter by preset (al_ameen, al_bayan) | | companyId | number | — | Required for multi-tenant | | perPage | number | 20 | Items per page | | refreshInterval | number | 0 | Auto-refresh in ms (0 = off) | | cacheTtl | number | 300000 | Cache TTL in ms (5 min) |


Developer

محمد خلف · +963945235962