titanpl-sdk 2.0.2 → 2.0.4
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 +2 -0
- package/package.json +38 -34
- package/templates/app/app.js +1 -4
- package/templates/server/Cargo.toml +22 -2
- package/templates/server/src/action_management.rs +8 -10
- package/templates/server/src/errors.rs +3 -1
- package/templates/server/src/extensions/builtin.rs +1038 -877
- package/templates/server/src/extensions/external.rs +338 -404
- package/templates/server/src/extensions/mod.rs +580 -448
- package/templates/server/src/extensions/titan_core.js +249 -186
- package/templates/server/src/fast_path.rs +719 -0
- package/templates/server/src/main.rs +370 -169
- package/templates/server/src/runtime.rs +284 -245
- package/templates/server/src/utils.rs +2 -2
- package/templates/titan/bundle.js +259 -264
- package/templates/titan/dev.js +46 -6
- package/templates/titan/error-box.js +277 -268
- package/templates/app/titan.d.ts +0 -87
- package/templates/index.d.ts +0 -249
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ It provides the necessary **Type Definitions** to make your IDE understand the g
|
|
|
24
24
|
|
|
25
25
|
> **Note:** The actual implementation of `t.log`, `t.fetch`, and other APIs are embedded directly into the [Titan Planet Binary](https://github.com/ezet-galaxy/titanpl). This SDK simply provides the "blueprints" (types) and a "sandbox" (test runner).
|
|
26
26
|
|
|
27
|
+
**Important Note:** Currently, Titan Planet and its entire package ecosystem are only for Windows. The Linux version is in development (dev only) for the new architecture and will be launched later.
|
|
28
|
+
|
|
27
29
|
---
|
|
28
30
|
|
|
29
31
|
## ✨ Features
|
package/package.json
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
"name": "titanpl-sdk",
|
|
3
|
+
"version": "2.0.4",
|
|
4
|
+
"description": "Development SDK for Titan Planet. Provides TypeScript type definitions for the global 't' runtime object and a 'lite' test-harness runtime for building and verifying extensions.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"titanpl-sdk": "./bin/run.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"templates/",
|
|
14
|
+
"titan",
|
|
15
|
+
"assets",
|
|
16
|
+
"index.js",
|
|
17
|
+
"index.d.ts",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"titan",
|
|
22
|
+
"titan-planet",
|
|
23
|
+
"titanpl-sdk",
|
|
24
|
+
"ezetgalaxy",
|
|
25
|
+
"types",
|
|
26
|
+
"typescript",
|
|
27
|
+
"intellisense",
|
|
28
|
+
"sdk",
|
|
29
|
+
"backend-sdk",
|
|
30
|
+
"extension-development"
|
|
31
|
+
],
|
|
32
|
+
"license": "ISC",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@titanpl/core": "latest",
|
|
35
|
+
"@titanpl/node": "latest"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@tgrv/microgravity": "latest"
|
|
39
|
+
}
|
|
36
40
|
}
|
package/templates/app/app.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
[package]
|
|
3
2
|
name = "titan-server"
|
|
4
3
|
version = "0.1.0"
|
|
@@ -11,7 +10,7 @@ reqwest = { version = "0.12.24", features = ["json", "rustls-tls", "gzip", "brot
|
|
|
11
10
|
serde = { version = "1.0.228", features = ["derive"] }
|
|
12
11
|
serde_json = "1.0.145"
|
|
13
12
|
thiserror = "2.0.17"
|
|
14
|
-
tokio = { version = "1.48.0", features = ["rt-multi-thread", "macros", "process"] }
|
|
13
|
+
tokio = { version = "1.48.0", features = ["rt-multi-thread", "macros", "process", "fs"] }
|
|
15
14
|
tower-http = { version = "0.6.7", features = ["cors"] }
|
|
16
15
|
tracing = "0.1.43"
|
|
17
16
|
tracing-subscriber = "0.3.22"
|
|
@@ -30,3 +29,24 @@ dashmap = "6.1.0"
|
|
|
30
29
|
bytes = "1.11.0"
|
|
31
30
|
smallvec = "1.15.1"
|
|
32
31
|
num_cpus = "1.17.0"
|
|
32
|
+
deadpool-postgres = "0.12"
|
|
33
|
+
tokio-postgres = "0.7"
|
|
34
|
+
|
|
35
|
+
# Performance: Global Allocator
|
|
36
|
+
mimalloc = { version = "0.1", default-features = false }
|
|
37
|
+
|
|
38
|
+
# Static Analysis: OXC (Zero runtime cost, used at startup)
|
|
39
|
+
oxc = { version = "0.108", features = ["semantic"] }
|
|
40
|
+
|
|
41
|
+
# Release Profile
|
|
42
|
+
[profile.release]
|
|
43
|
+
opt-level = 3
|
|
44
|
+
lto = "fat"
|
|
45
|
+
codegen-units = 1
|
|
46
|
+
panic = "abort"
|
|
47
|
+
strip = true
|
|
48
|
+
|
|
49
|
+
# Dev Profile
|
|
50
|
+
[profile.dev]
|
|
51
|
+
opt-level = 0
|
|
52
|
+
debug = 1
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
//! Action Management and Dynamic Routing
|
|
2
|
+
//!
|
|
3
|
+
//! Handles resolution of action directories, scanning for available actions,
|
|
4
|
+
//! and matching dynamic routes (e.g. `/users/:id`).
|
|
5
|
+
|
|
1
6
|
use std::collections::HashMap;
|
|
2
7
|
use std::env;
|
|
3
8
|
use std::path::{Path, PathBuf};
|
|
@@ -19,10 +24,7 @@ pub struct DynamicRoute {
|
|
|
19
24
|
pub action: String,
|
|
20
25
|
}
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
// ACTION DIRECTORY RESOLUTION
|
|
24
|
-
// -------------------------
|
|
25
|
-
|
|
27
|
+
/// Resolve the directory path where actions are stored.
|
|
26
28
|
pub fn resolve_actions_dir() -> PathBuf {
|
|
27
29
|
// Respect explicit override first
|
|
28
30
|
if let Ok(override_dir) = env::var("TITAN_ACTIONS_DIR") {
|
|
@@ -78,8 +80,7 @@ pub fn find_actions_dir(project_root: &PathBuf) -> Option<PathBuf> {
|
|
|
78
80
|
None
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
/// Match a dynamic route against the current request path.
|
|
83
84
|
pub fn match_dynamic_route(
|
|
84
85
|
method: &str,
|
|
85
86
|
path: &str,
|
|
@@ -138,10 +139,7 @@ pub fn match_dynamic_route(
|
|
|
138
139
|
None
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
// ACTION SCANNING
|
|
143
|
-
// -------------------------
|
|
144
|
-
|
|
142
|
+
/// Scan the resolved actions directory and return a map of action names to file paths.
|
|
145
143
|
pub fn scan_actions(root: &PathBuf) -> HashMap<String, PathBuf> {
|
|
146
144
|
let mut map = HashMap::new();
|
|
147
145
|
|