0.0.12 • Published 5 years ago

@sirusdev/provider-sdk v0.0.12

Weekly downloads
11
License
GPL-3.0
Repository
gitlab
Last release
5 years ago

Provider SDK

Web SDK to build offline-first app on provider edges

What's Inside

this SDK contain client SDK for these service

this SDK doesn't contain implementation for front-end framework, you should wrap this SDK to your own framework

Offline Database

This SDK manages storage & synchronization with main couch-db service via authentication proxy. To use offline database you should initiate it first, do this after user login

import { db } from '@sirusdev/provider-sdk';
import { ModelName } from '@sirusdev/provider-sdk/offline';

...
// fill in database name
// to avoid latency, only fill what you use
db.init(
  ModelName.physician,
  ModelName.schedule,
  ModelName.scheduleEvent,
  ModelName.room
);

You can check usage example on physican-checkin app

Membership

Membership intended to authenticate & authorize user access to certain provider features, use this SDK to get user's profile & login to provider's system

import { session } from '@sirusdev/provider-sdk';

...
// to get profile
const profile = await session.getProfile();
console.log(profile)

Login and logout

import { session } from '@sirusdev/provider-sdk';

...
// login will redirect you to login page
const providerName = 'rs_jiwa';
const profile = await session.login(providerName);

You can check usage example on physican-checkin app

File Uploader

File uploader contain SDK to upload simple file & image to fireant's CDN / storage service.

import { uploader } from '@sirusdev/provider-sdk';

async onPhotoChange(file: File) {
  // automatically crop image to 250x250 px
  const photo = await uploader.uploadImage(file, 250, 250);
}