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

@unvired/react-native-wrapper-sdk

v0.0.14

Published

Unvired SDK for React Native - Enterprise mobile platform SDK with authentication, sync, and offline database

Readme

React Native Unvired SDK

A lightweight React Native wrapper for the Unvired SDK with builder pattern implementation.

Architecture

This SDK follows a three-layer architecture:

RN App ←→ RN Wrapper ←→ Core Web SDK (TS) ←→ Native Implementation
  • RN App: Your React Native application
  • RN Wrapper: UnviredSDK class (this package)
  • Core Web SDK: CoreWebSDK class - JS interface layer
  • Native Implementation: Platform-specific implementations (iOS/Android)

Installation

npm install react-native-wrapper-sdk

Quick Start

Basic Login Example

import UnviredSDK from 'react-native-wrapper-sdk';

// Create and configure SDK using builder pattern
const sdk = UnviredSDK.create()
  .setServerUrl('https://api.unvired.io')
  .setAppId('my-app-123')
  .setTimeout(30000)
  .enableLogging(true)
  .build();

// Login
const response = await sdk.login({
  username: 'demo',
  password: 'demo123',
  company: 'Unvired Inc.',
});

if (response.success) {
  console.log('Login successful!');
  console.log('Session Token:', response.sessionToken);
  console.log('User ID:', response.userId);
} else {
  console.log('Login failed:', response.message);
}

API Reference

Builder Methods

The SDK uses a builder pattern for configuration. All builder methods return the builder instance for chaining.

UnviredSDK.create()

Creates a new SDK builder instance.

const builder = UnviredSDK.create();

setServerUrl(url: string)

Sets the server URL for API calls.

builder.setServerUrl('https://api.unvired.io');

setAppId(appId: string)

Sets the application ID.

builder.setAppId('my-app-123');

setTimeout(timeout: number)

Sets the request timeout in milliseconds (default: 30000).

builder.setTimeout(60000); // 60 seconds

enableLogging(enable: boolean)

Enables or disables SDK logging (default: false).

builder.enableLogging(true);

build()

Builds and returns the SDK instance. Must be called after configuration.

const sdk = builder.build();

Login Builder (Recommended)

The SDK provides a builder pattern for constructing login credentials, which avoids passing empty objects for optional parameters.

const response = await sdk.loginBuilder()
  .setUsername('demo')
  .setPassword('demo123')
  .setCompany('Unvired Inc.') // Optional
  .execute();

SDK Instance Methods

loginBuilder(): LoginBuilder

Returns a builder to construct login credentials.

Methods:

  • setUsername(username: string): LoginBuilder
  • setPassword(password: string): LoginBuilder
  • setCompany(company: string): LoginBuilder
  • execute(): Promise<LoginResponse>

login(credentials: LoginCredentials): Promise<LoginResponse>

Legacy method. Authenticates a user with the provided credentials object.

Parameters:

interface LoginCredentials {
  username: string;
  password: string;
  company?: string;
}

Returns:

interface LoginResponse {
  success: boolean;
  message: string;
  sessionToken?: string;
  userId?: string;
  error?: string;
}

Example:

const response = await sdk.login({
  username: 'demo',
  password: 'demo123',
});

logout(): Promise<boolean>

Logs out the current user and clears the session.

Returns: Promise<boolean> - true if logout was successful

Example:

const success = await sdk.logout();

isAuthenticated(): Promise<boolean>

Checks if a user is currently authenticated.

Returns: Promise<boolean> - true if authenticated

Example:

const isAuth = await sdk.isAuthenticated();

getConfig(): SDKConfig

Returns the current SDK configuration.

Returns:

interface SDKConfig {
  serverUrl?: string;
  timeout?: number;
  enableLogging?: boolean;
  appId?: string;
}

Usage Examples

Complete Login/Logout Flow

import UnviredSDK from 'react-native-wrapper-sdk';

async function loginLogoutExample() {
  // Build SDK
  const sdk = UnviredSDK.create()
    .setServerUrl('https://api.unvired.io')
    .setAppId('my-app-123')
    .enableLogging(true)
    .build();

  // Login
  const loginResponse = await sdk.login({
    username: 'demo',
    password: 'demo123',
  });

  if (loginResponse.success) {
    console.log('Logged in successfully');
    
    // Check authentication
    const isAuth = await sdk.isAuthenticated();
    console.log('Is Authenticated:', isAuth); // true
    
    // Logout
    await sdk.logout();
    
    // Check authentication again
    const isAuthAfterLogout = await sdk.isAuthenticated();
    console.log('Is Authenticated:', isAuthAfterLogout); // false
  }
}

Multiple SDK Instances

You can create multiple SDK instances with different configurations:

// Production instance
const prodSDK = UnviredSDK.create()
  .setServerUrl('https://api.unvired.io')
  .setAppId('prod-app')
  .build();

// Staging instance
const stagingSDK = UnviredSDK.create()
  .setServerUrl('https://staging-api.unvired.io')
  .setAppId('staging-app')
  .enableLogging(true)
  .build();

Error Handling

try {
  const response = await sdk.login({
    username: 'user',
    password: 'pass',
  });
  
  if (!response.success) {
    console.error('Login failed:', response.error);
  }
} catch (error) {
  console.error('Unexpected error:', error);
}

TypeScript Support

This SDK is written in TypeScript and includes full type definitions. All interfaces are exported for your use:

import UnviredSDK, {
  LoginCredentials,
  LoginResponse,
  SDKConfig,
  UnviredSDKBuilder,
  UnviredSDKInstance,
} from 'react-native-wrapper-sdk';

Development

Build

npm run build

This compiles the TypeScript source to JavaScript in the dist directory.

Project Structure

src/
├── index.ts          # Main entry point
├── UnviredSDK.ts     # RN Wrapper with builder pattern
├── LoginBuilder.ts   # Login Builder implementation
core/
├── CoreWebSDK.ts     # Core Web SDK (JS interface layer)
├── types.ts          # TypeScript type definitions

Dummy Login Credentials

For testing purposes, use these credentials:

  • Username: demo
  • Password: demo123

Any other credentials will result in an authentication failure.

License

UNLICENSED

Author

Unvired Inc.