princejs 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -2
- package/dist/helpers.js +1 -11
- package/package.json +2 -2
package/Readme.md
CHANGED
|
@@ -127,13 +127,12 @@ app
|
|
|
127
127
|
## New Tree-Shakable Features
|
|
128
128
|
|
|
129
129
|
```ts
|
|
130
|
-
import { cache, email,
|
|
130
|
+
import { cache, email, upload } from "princejs/helpers";
|
|
131
131
|
import { cron, openapi } from "princejs/scheduler";
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
* `cache(60)(handler)` — In-memory cache
|
|
135
135
|
* `email(to, subject, html)` — Resend.com
|
|
136
|
-
* `ai(prompt)` — Grok-3 via xAI API
|
|
137
136
|
* `upload()` — 1-line file upload
|
|
138
137
|
* `cron("*/2 * * * *", task)` — Cron support
|
|
139
138
|
* `openapi({ title, version })` — Auto docs
|
package/dist/helpers.js
CHANGED
|
@@ -20,15 +20,6 @@ var email = async (to, subject, html) => {
|
|
|
20
20
|
body: JSON.stringify({ from: "no-reply@princejs.dev", to, subject, html })
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
|
-
var ai = async (prompt) => {
|
|
24
|
-
const res = await fetch("https://api.x.ai/v1/chat/completions", {
|
|
25
|
-
method: "POST",
|
|
26
|
-
headers: { Authorization: `Bearer ${process.env.XAI_KEY}` },
|
|
27
|
-
body: JSON.stringify({ model: "grok-beta", messages: [{ role: "user", content: prompt }] })
|
|
28
|
-
});
|
|
29
|
-
const json = await res.json();
|
|
30
|
-
return json.choices?.[0]?.message?.content || "";
|
|
31
|
-
};
|
|
32
23
|
var upload = () => {
|
|
33
24
|
return async (req) => {
|
|
34
25
|
const form = await req.formData();
|
|
@@ -39,6 +30,5 @@ var upload = () => {
|
|
|
39
30
|
export {
|
|
40
31
|
upload,
|
|
41
32
|
email,
|
|
42
|
-
cache
|
|
43
|
-
ai
|
|
33
|
+
cache
|
|
44
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "princejs",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "An easy and fast backend framework — by a 13yo developer, for developers.",
|
|
5
5
|
"main": "dist/prince.js",
|
|
6
6
|
"types": "dist/prince.d.ts",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/bun": "^1.3.2",
|
|
64
64
|
"bun-types": "latest",
|
|
65
|
-
"typescript": "^5.9.3",
|
|
66
65
|
"fast-jwt": "^5.0.0",
|
|
66
|
+
"typescript": "^5.9.3",
|
|
67
67
|
"zod": "^4.1.12"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|