A wrapper for speedy development on NetSuite.
- Model & Query Builder inspired by Eloquent and ActiveRecord.
- Error Handling & Logging
- Seamless integration with Suitescript 2.0 (You can just import Suitescript Modules)
Included Examples
Technologies:
Key Concepts:
- Create a new Record on Netsuite
- Create a new Model extending BaseModel
- Map Column Types
- Build Relations
import {LeaveBalance} from '../LeaveBalance/LeaveBalance';
import {BaseModel, ColumnType} from '../../Core/Model/BaseModel';
export class Employee extends BaseModel {
recordType = 'employee';
typeMap = {
'jobtitle': ColumnType.STRING,
'subsidiary': ColumnType.LIST,
'supervisor': ColumnType.LIST,
'department': ColumnType.LIST,
};
// Default columns
columns: string[] = ['jobtitle'];
relations = {
vacationBalance: (model, year) => {
// Access SuiteScript Record with ._record
let idField = model._record.getValue('id');
return new LeaveBalance()
.where('emp_name', '==', idField)
.where('year', '==', year);
}
}
// validation
validation = {
'jobtitle': ['isNotEmpty'],
'supervisor': [(field, model) => { return true }]
}
Transpile Project
npm transpile
OR
tsc
Run tests
npm test
Please check these repos for more details about these packages