sxored-js
v0.1.1
Published
Satellite is Sxored's official SDK that enables any client to integrate production ready loan origination model into any applications in a matter of minutes.
Downloads
12
Readme
###### ## ## ####### ######## ######## ########
## ## # # ## ## ## ## ## ## ##
## # # ## ## ## ## ## ## ##
###### ## ## ## ######## ###### ## ##
## # # ## ## ## ## ## ## ##
## ## # # ## ## ## ## ## ## ##
###### ## ## ####### ## ## ######## ########
==============================================================
Sxored's Satellite - JavaScript Version
==============================================================
Framework for building Loan Origination Assistants
Sxored.js (Satellite)
Satellite is a JavaScript/TypeScript SDK for easy integration with the Sxored AI. It provides simple methods to extract information from ID cards (KTP), bank statements and such.
1. Installation
You can install the Sxored's Satellite using npm:
npm install sxored-js
or yarn:
yarn add sxored-js
2. Usage
Initialization
First, import and initialize the SDK with your API key:
import Satellite from 'sxored-js';
const client = new Satellite({
// Must be registered as PT. Sxored Veritas Finansial's client.
apiKey: 'your-api-key-here'
});
2. 1. Module: Personal Information
Extracting Information from an ID Card
const file = // ... your File object (e.g., from a file input)
try {
const result = await client.extractIdCard(file);
console.log('ID Card data:', result.data);
} catch (error) {
console.error('ID Card extraction failed:', error);
}
Extracting Information from Payslip
const file = // ... your File object (e.g., from a file input)
try {
const result = await client.extractPaySlip(file);
console.log('Payslip data:', result.data);
} catch (error) {
console.error('Payslip extraction failed:', error);
}
Extracting Information from Deed of Establishment
const file = // ... your File object (e.g., from a file input)
try {
const result = await client.extractDeed(file);
console.log('Deed data:', result.data);
} catch (error) {
console.error('Deed extraction failed:', error);
}
2. 2. Module: Financial Information
Extracting Information from a Bank Statement
const file = // ... your File object (e.g., from a file input)
try {
const result = await client.extractBankStatement(file, password);
console.log('Bank Statement data:', result.data);
} catch (error) {
console.error('Bank Statement extraction failed:', error);
}
Extracting Information from OJK SLIK
const file = // ... your File object (e.g., from a file input)
try {
const result = await client.extractSLIK(file);
console.log('OJK SLIK data:', result.data);
} catch (error) {
console.error('OJK SLIK extraction failed:', error);
}
2. 3. Module: Collateral Information
Extracting Information from a Property Tax
const file = // ... your File object (e.g., from a file input)
try {
const result = await client.extractPBB(file);
console.log('Property tax data:', result.data);
} catch (error) {
console.error('Property tax extraction failed:', error);
}
Searching Nearest Point of Interest from Tax Object
const data = {
address: "address of tax object",
radius: "in kilometer"
}
try {
const result = await client.findNearestPlace(data);
console.log('Places found:', result.data);
} catch (error) {
console.error('Places searching failed:', error);
}
Searching Nearest Mass Org Office/Base from Tax Object
const data = {
keyword: "kantor ormas",
address: "address of tax object",
radius: "in kilometer"
}
try {
const result = await client.findOrmas(data);
console.log('Places found:', result.data);
} catch (error) {
console.error('Places searching failed:', error);
}
Searching Property Prices Around Tax Object
const data = {
address: "address of tax object"
}
try {
const result = await client.housePrice(data);
console.log('Prices found:', result.data);
} catch (error) {
console.error('Prices searching failed:', error);
}
2. 4. Module: Utility
Check for Holiday
const data = {
date: "2024-10-10",
timezone: "Asia/Jakarta"
}
try {
const result = await client.checkHoliday(data);
console.log('Data:', result.data);
} catch (error) {
console.error('Data fetch failed:', error);
}
3. API Reference
new Satellite(config)
Creates a new instance of the SDK.
config.apiKey
(string, required): Your Sxored Satellite API key
client.extractIdCard(file)
client.extractPBB(file)
Extracts information from an image.
file
(File | Buffer): The image file
Returns a Promise that resolves with the extracted data.
client.extractPaySlip(file)
client.extractDeed(file)
client.extractSLIK(file)
Extracts information from PDF file (no password).
file
(File | Buffer): The PDF file
Returns a Promise that resolves with the extracted data.
client.extractBankStatement(file, password)
Extracts information from PDF file (encrypted).
file
(File | Buffer): The bank statement file (typically a PDF)password
(String): The bank statement PDF password (typically user birthdate)
Returns a Promise that resolves with the extracted bank statement data.
client.findNearestPlace(data)
Get point of interest information from a JSON object
data = {
address: str,
radius: int
}
data
(Record<string, any>): The JSON data to extract information from
Returns a Promise that resolves with the places data.
client.findOrmas(data)
Get specific place information from a JSON object
data = {
keyword: str,
address: str,
radius: int
}
data
(Record<string, any>): The JSON data to extract information from
Returns a Promise that resolves with the places data.
client.housePrice(data)
Get prices information from a JSON object
data = {
address: str
}
data
(Record<string, any>): The JSON data to extract information from
Returns a Promise that resolves with the prices data.
4. Example (React)
Here's a simple example of how to use the SDK in a React component:
import React, { useState } from 'react';
import Satellite from 'sxored-js';
const sdk = new Satellite({ apiKey: 'your-api-key-here' });
const DocumentExtractor = () => {
const [result, setResult] = useState(null);
const [error, setError] = useState(null);
const handleFileUpload = async (event, type) => {
const file = event.target.files[0];
if (!file) return;
try {
let extractionResult;
if (type === 'idcard') {
extractionResult = await sdk.extractIdCard(file);
} else {
extractionResult = await sdk.extractBankStatement(file, password);
}
setResult(extractionResult);
setError(null);
} catch (err) {
setError(err.message);
setResult(null);
}
};
return (
<div>
<h1>Document Extractor</h1>
<div>
<h2>ID Card</h2>
<input type="file" onChange={(e) => handleFileUpload(e, 'idcard')} />
</div>
<div>
<h2>Bank Statement</h2>
<input type="file" onChange={(e) => handleFileUpload(e, 'bankStatement')} />
</div>
{result && (
<div>
<h3>Result:</h3>
<pre>{JSON.stringify(result, null, 2)}</pre>
</div>
)}
{error && <div style={{ color: 'red' }}>Error: {error}</div>}
</div>
);
};
export default DocumentExtractor;
5. TypeScript Support
This SDK includes TypeScript declarations. You can use it in your TypeScript projects without any additional setup.
6. License
This project is licensed under the MIT License - see the LICENSE file for details.