titan-sdk 0.0.2 → 0.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 +52 -57
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# 🛠️ Titan SDK
|
|
3
3
|
|
|
4
|
-
**
|
|
4
|
+
**The Developer Toolkit for Titan Planet. Type safety, IntelliSense, and Extension Testing.**
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/titan-sdk)
|
|
7
7
|
[](https://opensource.org/licenses/ISC)
|
|
@@ -10,97 +10,92 @@
|
|
|
10
10
|
|
|
11
11
|
## 🌌 Overview
|
|
12
12
|
|
|
13
|
-
**Titan SDK** is the
|
|
13
|
+
**Titan SDK** is NOT the runtime engine itself. It is a **development-only toolkit** designed to bridge the gap between your local coding environment and the native Titan Planet binary.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
It provides the necessary **Type Definitions** to make your IDE understand the global `t` object and a **Lite Test Harness** to verify your extensions before they ever touch a production binary.
|
|
16
|
+
|
|
17
|
+
> **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/-ezetgalaxy-titan). This SDK simply provides the "blueprints" (types) and a "sandbox" (test runner).
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
19
21
|
## ✨ Features
|
|
20
22
|
|
|
21
|
-
- **💎
|
|
22
|
-
- **🛡️
|
|
23
|
-
- **🔌 Extension
|
|
24
|
-
- **🚀 Zero
|
|
23
|
+
- **💎 Blueprint Types (IntelliSense)**: Provides the full TypeScript `index.d.ts` for the global `t` object so you get autocomplete in VS Code and other editors.
|
|
24
|
+
- **🛡️ Static Validation**: Catch parameter mismatches and typos in `t.log`, `t.fetch`, `t.db`, etc., during development.
|
|
25
|
+
- **🔌 Extension Test Harness**: A "lite" version of the Titan runtime that simulates the native environment to test extensions in isolation.
|
|
26
|
+
- **🚀 Zero Production Trace**: This is a `devDependencies` package. It never ships with your binary, keeping your production footprint at literal zero.
|
|
25
27
|
|
|
26
28
|
---
|
|
27
29
|
|
|
28
|
-
## 🚀
|
|
30
|
+
## 🚀 The Test Harness (Lite Runtime)
|
|
31
|
+
|
|
32
|
+
The SDK includes a specialized **Test Runner** (`titan-sdk`). This is a "lite" version of the Titan ecosystem that acts as a bridge for developers.
|
|
29
33
|
|
|
30
|
-
###
|
|
34
|
+
### How it works:
|
|
35
|
+
When you run the SDK in an extension folder, it:
|
|
36
|
+
1. **Scaffolds a Virtual Project**: Creates a temporary, minimal Titan environment in `.titan_test_run`.
|
|
37
|
+
2. **Native Compilation**: Automatically builds your native Rust code (`native/`) if it exists.
|
|
38
|
+
3. **Hot-Linking**: Junctions your local extension into the virtual project's `node_modules`.
|
|
39
|
+
4. **Verification**: Generates a test suite that attempts to call your extension's methods via the real `t` object inside the sandbox.
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
### Usage:
|
|
33
42
|
|
|
34
43
|
```bash
|
|
35
|
-
|
|
44
|
+
# Inside your extension directory
|
|
45
|
+
npx titan-sdk
|
|
36
46
|
```
|
|
37
47
|
|
|
38
|
-
|
|
48
|
+
---
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
## ⌨️ Enabling IntelliSense
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
52
|
+
Since the `t` object is injected globally by the Titan engine at runtime, your IDE won't recognize it by default. The SDK fixes this.
|
|
53
|
+
|
|
54
|
+
1. **Install the SDK**:
|
|
55
|
+
```bash
|
|
56
|
+
npm install --save-dev titan-sdk
|
|
57
|
+
```
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
2. **Configure Types**:
|
|
60
|
+
Create or update `jsconfig.json` (or `tsconfig.json`) in your project root:
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"compilerOptions": {
|
|
64
|
+
"types": ["titan-sdk"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
51
68
|
|
|
69
|
+
Now your editor will treat `t` as a first-class citizen:
|
|
52
70
|
```js
|
|
53
71
|
export function myAction(req) {
|
|
54
|
-
t.log.info("Request received", req.path);
|
|
55
|
-
|
|
56
|
-
// Fully typed db queries!
|
|
57
|
-
const data = t.db.query("SELECT * FROM users WHERE id = $1", [req.params.id]);
|
|
58
|
-
|
|
59
|
-
return data;
|
|
72
|
+
t.log.info("Request received", req.path); // Autocomplete works!
|
|
73
|
+
return { status: "ok" };
|
|
60
74
|
}
|
|
61
75
|
```
|
|
62
76
|
|
|
63
77
|
---
|
|
64
78
|
|
|
65
|
-
##
|
|
66
|
-
|
|
67
|
-
The SDK provides types for the entire `t` namespace:
|
|
79
|
+
## 🧱 What's Included? (Types Only)
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
- **`t.fetch`**: High-performance Rust-native fetch wrapper.
|
|
71
|
-
- **`t.db`**: Native PostgreSQL interface for extreme speed.
|
|
72
|
-
- **`t.read`**: Optimized file system access.
|
|
73
|
-
- **`t.jwt`**: Built-in JWT handling (if enabled).
|
|
81
|
+
The SDK provides types for the native APIs provided by the Titan Planet engine:
|
|
74
82
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
// Define your extension types
|
|
83
|
-
declare global {
|
|
84
|
-
namespace Titan {
|
|
85
|
-
interface Runtime {
|
|
86
|
-
myCustomTool: {
|
|
87
|
-
doSomething: () => void;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
83
|
+
- **`t.log`**: Standardized logging that appears in the Titan binary console.
|
|
84
|
+
- **`t.fetch`**: Types for the high-performance Rust-native network stack.
|
|
85
|
+
- **`t.db`**: Interface for the native PostgreSQL driver.
|
|
86
|
+
- **`t.read`**: Definitions for optimized filesystem reads.
|
|
87
|
+
- **`t.jwt` / `t.password`**: Security helper types.
|
|
93
88
|
|
|
94
89
|
---
|
|
95
90
|
|
|
96
91
|
## 🌍 Community & Documentation
|
|
97
92
|
|
|
98
|
-
- **
|
|
99
|
-
- **
|
|
100
|
-
- **
|
|
93
|
+
- **Core Framework**: [Titan Planet](https://github.com/ezet-galaxy/-ezetgalaxy-titan)
|
|
94
|
+
- **Official Docs**: [Titan Planet Docs](https://titan-docs-ez.vercel.app/docs)
|
|
95
|
+
- **Author**: [ezetgalaxy](https://github.com/ezet-galaxy)
|
|
101
96
|
|
|
102
97
|
---
|
|
103
98
|
|
|
104
99
|
<p align="center">
|
|
105
|
-
Built with ❤️ for the <a href="https://github.com/ezetgalaxy
|
|
100
|
+
Built with ❤️ for the <a href="https://github.com/ezet-galaxy/-ezetgalaxy-titan">Titan Planet</a> ecosystem.
|
|
106
101
|
</p>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "titan-sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.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
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "index.d.ts",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"titan",
|
|
13
13
|
"titan-planet",
|
|
14
14
|
"titan-sdk",
|
|
15
|
-
"titanjs",
|
|
16
15
|
"ezetgalaxy",
|
|
17
16
|
"types",
|
|
18
17
|
"typescript",
|