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 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
- "name": "titanpl-sdk",
3
- "version": "2.0.2",
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
- }
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
  }
@@ -1,7 +1,4 @@
1
- import t from "../titan/titan.js";
2
-
3
-
4
-
1
+ import t from "@titanpl/route";
5
2
 
6
3
  t.post("/hello").action("hello") // pass a json payload { "name": "titan" }
7
4
 
@@ -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
- // Dynamic Matcher (Core Logic)
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
 
@@ -1,6 +1,8 @@
1
+ //! Error handling utilities.
2
+
1
3
  use v8::JsError;
2
4
 
3
- // A helper to Format v8 Errors
5
+ /// A helper to Format v8 Errors
4
6
  pub fn format_js_error(err: JsError, action: &str) -> String {
5
7
  format!(
6
8
  "Action: {}\n{}",