Skip to content

Commit 3998f49

Browse files
authored
feat: task queues, email support, and multiprocessing (#21)
1 parent aa51689 commit 3998f49

File tree

224 files changed

+5724
-2085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+5724
-2085
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ deno.lock
33
cloud-config.json
44
pgdata/
55
debug.log
6+
.zed/
7+
.vscode/

.zed/settings.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
"settings": {
55
"deno": {
66
"enable": true,
7+
"suggest": {
8+
"completeFunctionCalls": true,
9+
"names": {
10+
"enabled": true
11+
},
12+
"paths": {
13+
"enabled": true
14+
},
15+
"autoImports": {
16+
"enabled": true
17+
},
18+
"imports": {
19+
"autoDiscover": true
20+
}
21+
},
722
"inlayHints": {
823
"parameterNames": {
924
"enabled": "all"
@@ -28,7 +43,6 @@
2843
}
2944
}
3045
},
31-
3246
"languages": {
3347
"TypeScript": {
3448
"language_servers": ["deno"],

.zed/tasks.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
[
22
{
33
"command": "deno",
4-
"args": [
5-
"run",
6-
"-A",
7-
"--watch",
8-
"--watch-exclude=.inspatial",
9-
"--unstable-broadcast-channel",
10-
"mainApp.ts"
11-
],
4+
"args": ["run", "-A", "--watch", "--watch-exclude=.inspatial", "main.ts"],
125
"cwd": "$ZED_WORKTREE_ROOT/examples/basic",
136
"label": "Example: Basic",
147
"allow_concurrent_runs": false,

README.md

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ universal and spatial (AR/MR/VR) applications.
8080
Some of the key features include:
8181

8282
- **InSpatialORM**: An easy-to-use advanced ORM for PostgreSQL
83+
- **InDB**: An embedded database for local development (no need to install
84+
PostgreSQL locally!)
8385
- **Authentication**: Built-in authentication and authorization out of the box
8486
- **InLive**: Real-time data streaming and synchronization over WebSockets
87+
- **InQueue**: A task queue system for background processing
8588
- **CloudAPI**: A powerful API that is easy to use and extend. Includes built in
8689
request validation and authentication
8790
- **InCache**: A powerful caching layer for your data
@@ -120,19 +123,12 @@ InSpatial Cloud is released under the Apache 2.0 License. See the
120123
### Pre-requisites
121124

122125
- Deno
123-
- PostgreSQL
124-
125-
> Note: You'll need to create a Postgres database first:
126-
127-
```bash
128-
createdb mydb
129-
```
130126

131127
### Installation
132128

133129
Add the InSpatial Cloud module to your Deno project using the following command:
134130

135-
```bash
131+
```shell
136132
deno add jsr:@inspatial/cloud
137133
```
138134

@@ -141,31 +137,17 @@ deno add jsr:@inspatial/cloud
141137
### Basic Usage
142138

143139
```ts
144-
import { InCloud } from "@inspatial/cloud";
145-
146-
const app = new InCloud("myApp");
140+
import { createInCloud } from "@inspatial/cloud";
147141

148-
if (import.meta.main) {
149-
app.run();
150-
}
142+
createInCloud();
151143
```
152144

153-
Now you can run the app:
145+
That's it! Now you can run the app:
154146

155-
```bash
147+
```shell
156148
deno run -A main.ts
157149
```
158150

159151
You can verify the app is running by pinging the API endpoint in you browser:
160152

161153
[http://localhost:8000/api?group=api&action=ping](http://localhost:8000/api?group=api&action=ping)
162-
163-
You should see the following response:
164-
165-
```json
166-
{
167-
"message": "pong",
168-
"timestamp": 1745065012205,
169-
"app": "myApp"
170-
}
171-
```

deno.json

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "@inspatial/cloud",
3-
"version": "0.2.3",
3+
"version": "0.3.0",
44
"license": "Apache-2.0",
55
"exports": {
66
".": "./mod.ts",
77
"./extensions": "./extensions/mod.ts",
88
"./types": "./types.ts"
99
},
10+
1011
"publish": {
1112
"include": [
1213
"src/",
@@ -21,19 +22,26 @@
2122
],
2223
"exclude": [".github/", ".vscode/", ".zed/", "examples/**/.inspatial/"]
2324
},
24-
2525
"imports": {
26-
"#/": "./src/",
26+
"/": "./src/",
27+
"./": "./",
28+
"#orm/": "./src/orm/",
29+
"#utils/": "./src/utils/",
30+
"#terminal/": "./src/terminal/",
31+
"#queue/": "./src/in-queue/",
2732
"#extensions/": "./extensions/",
28-
"#types/": "./src/types/"
33+
"#types/": "./src/types/",
34+
"#inLog": "./src/in-log/in-log.ts"
2935
},
3036
"tasks": {
3137
"check": "deno publish --dry-run",
32-
"type-check": "deno check --all mod.ts"
38+
"type-check": "deno check --all mod.ts",
39+
"example:tasks": "cd examples/task-queue && deno run -A --unstable-broadcast-channel run.ts",
40+
"example:tasks-queue": "cd examples/task-queue && deno run -A --unstable-broadcast-channel queue.ts"
3341
},
42+
"scopes": {},
3443
"lint": {
3544
"rules": {
36-
"tags": [],
3745
"include": ["verbatim-module-syntax"],
3846
"exclude": ["no-explicit-any"]
3947
}

examples/basic/main.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { createInCloud } from "@inspatial/cloud";
2+
import { EntryType } from "/orm/mod.ts";
3+
4+
createInCloud({
5+
name: "myAwesomeCloud",
6+
entryTypes: [
7+
new EntryType("thing", {
8+
fields: [],
9+
actions: [{
10+
key: "yo",
11+
params: [],
12+
action() {
13+
console.log("Hello from the cloud!");
14+
},
15+
}],
16+
}),
17+
],
18+
});

examples/basic/mainApp.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/crm/crmExtension.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/crm/entryTypes/customerAccount.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { EntryType } from "@inspatial/cloud";
2-
import { ChildEntryType } from "#/orm/child-entry/child-entry.ts";
2+
import { ChildEntryType } from "/orm/child-entry/child-entry.ts";
33

44
export const customerAccount = new EntryType("customerAccount", {
55
label: "Customer Account",

examples/crm/main.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { InCloud } from "@inspatial/cloud";
2-
import crmExtension from "./crmExtension.ts";
1+
import { createInCloud } from "@inspatial/cloud";
2+
import customerAccount from "./entryTypes/customerAccount.ts";
33

4-
const app = new InCloud("myCRM", {
5-
extensions: [crmExtension],
4+
createInCloud({
5+
name: "CRM",
6+
description: "Customer Relationship Management",
7+
version: "1.0.0",
8+
entryTypes: [customerAccount],
69
});
7-
app.run();

0 commit comments

Comments
 (0)