@collect.so/javascript-sdk v0.30.0
Collect SDK
The Collect.so SDK for JavaScript and TypeScript
Homepage — Blog — Platform — Docs — Examples
Features
- Automatic Type Inference: Enjoy seamless type safety with automatic TypeScript inference.
- Isomorphic Architecture: Fully compatible with both server and browser environments.
- Zero Dependencies: Lightweight and efficient with no external dependencies.
- No Configuration Needed: Plug-and-play design requires no setup or configuration.
Installation
NPM:
npm install @collect.so/javascript-sdk
YARN:
yarn add @collect.so/javascript-sdk
PNPM:
pnmp add @collect.so/javascript-sdk
Usage
- Obtain Collect API Token: Grab your API token from the Dashboard.
- Setup Collect Instance: Initialize your Collect instance with obtained token.
- (Optional) Define Data Models: Tailor your data models to fit your needs.
- Manage Your Data: Push, link, fetch, and manage your data effortlessly.
TLDR;
/* ./your-app/src/collect.ts */
import CollectSDK, { CollectModel } from '@collect.so/sdk'
// Setup Collect instance
const Collect = new CollectSDK("API_TOKEN")
// Optionaly define Model
export const UserRepo = new CollectModel(
'USER',
{
name: { type: 'string' },
email: { type: 'string', uniq: true },
verified: { type: 'boolean', default: false },
hobbies: { type: 'string', multiple: true, requiered: false },
rating: { type: 'number', default: 1 },
created: { type: 'datetime', default: () => new Date().toISOString() },
password: { type: 'string' }
},
Collect
)
// Create new Record
const newUser = await UserRepo.create({
name: "John Galt",
email: 'john.g@example.com',
hobbies: ['Programming', 'Hiking'],
password: '********'
})
// Find Records by specific criteria
const matchedUsers = await UserRepo.find({
where: {
email: { $ne: 'john.g@example.com' },
hobbies: { $in: ['Hiking'] },
rating: { $gte: 1.5 }
}
})
Check the Docs and Examples Repository to learn more 🤓
Contributing
See CONTRIBUTING.md.
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
11 months ago
11 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago