-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme, cleanups, build public image
- Loading branch information
Showing
160 changed files
with
2,023 additions
and
3,468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Build and Publish Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: pnpm | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install -g pnpm | ||
pnpm install | ||
- name: Bump version using Changeset | ||
run: | | ||
npx changeset version | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git add . | ||
git commit -m "Release version bump" | ||
git push | ||
- name: Extract version from package.json | ||
id: get-version | ||
run: echo "VERSION=$(jq -r '.version' ./package.json)" >> $GITHUB_ENV | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t rushdb/platform:$VERSION -t rushdb/platform:latest . | ||
- name: Publish Docker image | ||
run: | | ||
echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin | ||
docker push rushdb/platform:$VERSION | ||
docker push rushdb/platform:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node-linker=hoisted | ||
shamefully-hoist=true | ||
strict-peer-dependencies=false | ||
auto-install-peers=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "collect-toolkit", | ||
"name": "rushdb", | ||
"private": true, | ||
"license": "MIT", | ||
"scripts": { | ||
|
@@ -17,8 +17,8 @@ | |
"release": "changeset publish", | ||
"version:dev": "changeset version --snapshot dev", | ||
"release:dev": "changeset publish --tag dev", | ||
"prepare": "husky install", | ||
"reinstall": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + && pnpm i" | ||
"reinstall": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + && pnpm i", | ||
"docker:build:platform": "docker build -t platform -f platform/Dockerfile ." | ||
}, | ||
"devDependencies": { | ||
"@changesets/cli": "^2.27.10", | ||
|
@@ -37,9 +37,8 @@ | |
"husky": "^8.0.3", | ||
"jest": "29.5.0", | ||
"jest-ts-webcompat-resolver": "1.0.0", | ||
"prettier": "3.2.5", | ||
"prettier": "^3.4.2", | ||
"rimraf": "5.0.1", | ||
"tsup": "^8.3.5", | ||
"typescript": "5.7.2" | ||
}, | ||
"packageManager": "[email protected]", | ||
|
@@ -48,6 +47,10 @@ | |
"node": ">=18.0.0 <=22.x.x" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
"packages/*", | ||
"platform/*", | ||
"docs", | ||
"website", | ||
"examples/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,13 @@ | |
|
||
 | ||
|
||
# RushDB SDK | ||
# RushDB SDK for JavaScript and TypeScript | ||
|
||
> The RushDB.com SDK for JavaScript and TypeScript | ||
[](https://www.npmjs.com/package/@rushdb/javascript-sdk) | ||
[](https://www.npmjs.com/package/@rushdb/javascript-sdk) | ||
[](#license "Go to license section") | ||
|
||
 | ||
 | ||
 | ||
 | ||
|
||
|
||
[](https://nodejs.org "Go to Node.js homepage") | ||
|
@@ -19,13 +17,17 @@ | |
[Homepage](https://rushdb.com) — [Blog](https://rushdb.com/blog) — [Platform](https://app.rushdb.com) — [Docs](https://docs.rushdb.com) — [Examples](https://github.com/rush-db/rushdb/examples) | ||
</div> | ||
|
||
## Features | ||
## Highlights | ||
|
||
--- | ||
- **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. | ||
> **✨ No Configuration Needed**: Plug-and-play design requires no setup or configuration. | ||
> **🤖 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. | ||
|
||
|
||
## Installation | ||
|
@@ -51,51 +53,71 @@ pnmp add @rushdb/javascript-sdk | |
|
||
--- | ||
|
||
1. **Obtain RushDB API Token**: Grab your API token from the [Dashboard](https://app.rushdb.com). | ||
2. **Setup RushDB Instance**: Initialize your RushDB instance with obtained token. | ||
3. **(Optional) Define Data Models**: Tailor your data models to fit your needs. | ||
4. **Manage Your Data**: Push, link, fetch, and manage your data effortlessly. | ||
1. **Obtain API Token**: Grab one from the [Dashboard](https://app.rushdb.com). | ||
2. **Build anything**: Easily push, search, and manage relationships within your data. | ||
|
||
### TLDR; | ||
```ts | ||
/* ./your-app/src/db.ts */ | ||
|
||
import RushDB, { Model } from '@rushdb/javascript-sdk' | ||
|
||
// Setup RushDB instance | ||
const db = new RushDB("API_TOKEN") | ||
|
||
// Optionaly define Model | ||
export const UserRepo = new Model( | ||
'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' } | ||
}, | ||
db | ||
) | ||
|
||
// Create new Record | ||
const newUser = await UserRepo.create({ | ||
name: "John Galt", | ||
email: '[email protected]', | ||
hobbies: ['Programming', 'Hiking'], | ||
password: '********' | ||
// Setup SDK | ||
const db = new RushDB("API_TOKEN", { | ||
// This is the default URL; no need to provide it unless overriding. | ||
url: "https://api.rushdb.com", | ||
}); | ||
|
||
// Push any data, and RushDB will automatically flatten it into Records | ||
// and establish relationships between them accordingly. | ||
await db.records.createMany("COMPANY", { | ||
name: 'Google LLC', | ||
address: '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', | ||
foundedAt: '1998-09-04T00:00:00.000Z', | ||
rating: 4.9, | ||
DEPARTMENT: [{ | ||
name: 'Research & Development', | ||
description: | ||
'Innovating and creating advanced technologies for AI, cloud computing, and consumer devices.', | ||
PROJECT: [{ | ||
name: 'Bard AI', | ||
description: | ||
'A state-of-the-art generative AI model designed for natural language understanding and creation.', | ||
active: true, | ||
budget: 1200000000, | ||
EMPLOYEE: [{ | ||
name: 'Jeff Dean', | ||
position: 'Head of AI Research', | ||
email: '[email protected]', | ||
dob: '1968-07-16T00:00:00.000Z', | ||
salary: 3000000 | ||
}] | ||
}] | ||
}] | ||
}) | ||
|
||
|
||
// Find Records by specific criteria | ||
const matchedUsers = await UserRepo.find({ | ||
where: { | ||
email: { $ne: '[email protected]' }, | ||
hobbies: { $in: ['Hiking'] }, | ||
rating: { $gte: 1.5 } | ||
const matchedEmployees = await db.records.find({ | ||
labels: ['EMPLOYEE'], | ||
where: { | ||
position: { $contains: 'AI' }, | ||
PROJECT: { | ||
DEPARTMENT: { | ||
COMPANY: { | ||
rating: { $gte: 4 } | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
|
||
const company = await db.records.findUniq('COMPANY', { | ||
where: { | ||
name: 'Google LLC' | ||
} | ||
}) | ||
|
||
// Manage relationships | ||
await company.attach(matchedEmployees, { type: "WORKING_AT" }) | ||
``` | ||
|
||
<div align="center"> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.