1.12.0 • Published 1 year ago
@ztimson/pumpkinpie v1.12.0
PumpkinPie
A front end framework to work with Datalynk
This is a library to provide full Datalynk support to any JS framework or app, it supports both promises and RxJS.
Table of Contents
Quick Start
- Install Pumpkin Pie
npm install --save @ztimson/pumpkinpie
- Generate the models. If you didn't hard code the login/password you will be prompted. The generated files will be created under the 'models' folder in the current working directory. Feel free to move them.
$ npx datalynk-models
Output (src/models):
Spoke: sandbox
Login: example
Password: ********
- Create an API object & start making requests
import {API} from '@ztimson/pumpkinpie'
import {User} from './models/User.model';
import {Slices} from './models/slices';
const api = new API('https://example.auxiliumgroup.com/api');
const resp = await api.slice<User>(Slices.User).select().exec();
Examples
// Login
const user = await api.request({'$/auth/login': {login: 'user', password: '123'}});
// Query
const row = await api.slice(12345).select(12345).exec().row();
// Insert One
const rows = await api.slice(12345).select().exec().rows();
// Insert Many
const keys = await api.slice(12345).insert([
{first: 'Adam', last: 'Bilbo'},
{first: 'Charlie', last: 'DeMont'}
]).exec().keys();
// Update
const success = await api.slice(12345).update(
{id: 1, first: 'Adam', last: 'Baxter'}
).exec().key();
// Advanced example - Add flag to underage users
const users = await api.slice(12345).select().exec().rows();
users = users.map(user => Object.assign(user, {underage: user.age < 18}));
api.slice(1245).update(users).exec();
1.12.0
1 year ago
1.9.0
1 year ago
1.10.0
1 year ago
1.8.9
7 years ago
1.8.7
7 years ago
1.8.6
7 years ago
1.8.5
7 years ago
1.8.4
7 years ago
1.8.3
7 years ago
1.8.2
7 years ago
1.8.1
7 years ago
1.8.0
7 years ago
1.7.4
7 years ago
1.6.3
7 years ago
1.5.2
7 years ago
1.4.2
7 years ago
1.4.1
7 years ago
1.4.0
7 years ago
1.3.1
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.0
7 years ago
0.1.0
7 years ago