@ezetgalaxy/titan 26.9.1 → 26.9.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.
Files changed (97) hide show
  1. package/README.md +17 -5
  2. package/index.js +177 -112
  3. package/package.json +19 -5
  4. package/templates/common/app/titan.d.ts +87 -0
  5. package/templates/extension/node_modules/.bin/esbuild +16 -0
  6. package/templates/extension/node_modules/.bin/esbuild.cmd +17 -0
  7. package/templates/extension/node_modules/.bin/esbuild.ps1 +28 -0
  8. package/templates/extension/node_modules/.bin/titanpl-sdk +16 -0
  9. package/templates/extension/node_modules/.bin/titanpl-sdk.cmd +17 -0
  10. package/templates/extension/node_modules/.bin/titanpl-sdk.ps1 +28 -0
  11. package/templates/extension/node_modules/.package-lock.json +111 -0
  12. package/templates/extension/node_modules/@esbuild/win32-x64/README.md +3 -0
  13. package/templates/extension/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
  14. package/templates/extension/node_modules/@esbuild/win32-x64/package.json +20 -0
  15. package/templates/extension/node_modules/@titanpl/core/LICENSE +15 -0
  16. package/templates/extension/node_modules/@titanpl/core/README.md +127 -0
  17. package/templates/extension/node_modules/@titanpl/core/globals.d.ts +17 -0
  18. package/templates/extension/node_modules/@titanpl/core/index.js +250 -0
  19. package/templates/extension/node_modules/@titanpl/core/native/target/release/titan_core.dll +0 -0
  20. package/templates/extension/node_modules/@titanpl/core/package.json +41 -0
  21. package/templates/extension/node_modules/@titanpl/core/titan.json +115 -0
  22. package/templates/extension/node_modules/chokidar/LICENSE +21 -0
  23. package/templates/extension/node_modules/chokidar/README.md +305 -0
  24. package/templates/extension/node_modules/chokidar/handler.d.ts +90 -0
  25. package/templates/extension/node_modules/chokidar/handler.js +632 -0
  26. package/templates/extension/node_modules/chokidar/index.d.ts +217 -0
  27. package/templates/extension/node_modules/chokidar/index.js +822 -0
  28. package/templates/extension/node_modules/chokidar/package.json +63 -0
  29. package/templates/extension/node_modules/esbuild/LICENSE.md +21 -0
  30. package/templates/extension/node_modules/esbuild/README.md +3 -0
  31. package/templates/extension/node_modules/esbuild/bin/esbuild +223 -0
  32. package/templates/extension/node_modules/esbuild/install.js +289 -0
  33. package/templates/extension/node_modules/esbuild/lib/main.d.ts +716 -0
  34. package/templates/extension/node_modules/esbuild/lib/main.js +2242 -0
  35. package/templates/extension/node_modules/esbuild/package.json +49 -0
  36. package/templates/extension/node_modules/readdirp/LICENSE +21 -0
  37. package/templates/extension/node_modules/readdirp/README.md +120 -0
  38. package/templates/extension/node_modules/readdirp/index.d.ts +108 -0
  39. package/templates/extension/node_modules/readdirp/index.js +272 -0
  40. package/templates/extension/node_modules/readdirp/package.json +66 -0
  41. package/templates/extension/node_modules/titanpl-sdk/LICENSE +15 -0
  42. package/templates/extension/node_modules/titanpl-sdk/README.md +109 -0
  43. package/templates/extension/node_modules/titanpl-sdk/assets/titanpl-sdk.png +0 -0
  44. package/templates/extension/node_modules/titanpl-sdk/bin/run.js +251 -0
  45. package/templates/extension/node_modules/titanpl-sdk/index.d.ts +46 -0
  46. package/templates/extension/node_modules/titanpl-sdk/index.js +5 -0
  47. package/templates/extension/node_modules/titanpl-sdk/package.json +33 -0
  48. package/templates/{rust-js → extension/node_modules/titanpl-sdk/templates}/Dockerfile +4 -17
  49. package/templates/extension/node_modules/titanpl-sdk/templates/app/actions/hello.js +5 -0
  50. package/templates/extension/node_modules/titanpl-sdk/templates/app/app.js +10 -0
  51. package/templates/extension/node_modules/titanpl-sdk/templates/jsconfig.json +19 -0
  52. package/templates/extension/node_modules/titanpl-sdk/templates/server/Cargo.lock +2839 -0
  53. package/templates/extension/node_modules/titanpl-sdk/templates/server/Cargo.toml +27 -0
  54. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/action_management.rs +131 -0
  55. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/errors.rs +10 -0
  56. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/extensions.rs +640 -0
  57. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/main.rs +345 -0
  58. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/utils.rs +33 -0
  59. package/templates/extension/node_modules/titanpl-sdk/templates/titan/bundle.js +65 -0
  60. package/templates/extension/node_modules/titanpl-sdk/templates/titan/dev.js +113 -0
  61. package/templates/extension/node_modules/titanpl-sdk/templates/titan/titan.js +98 -0
  62. package/templates/extension/package-lock.json +522 -0
  63. package/templates/extension/package.json +4 -3
  64. package/templates/rust-ts/app/actions/hello.ts +1 -1
  65. package/templates/rust-ts/titan/runtime.d.ts +1 -0
  66. package/templates/rust-ts/titan/runtime.js +1 -0
  67. package/templates/rust-ts/titan/titan.d.ts +117 -117
  68. package/templates/rust-ts/titan/titan.js +1 -1
  69. package/templates/ts/app/actions/hello.ts +1 -1
  70. package/templates/ts/titan/builder.js +121 -121
  71. package/templates/ts/titan/runtime.d.ts +1 -0
  72. package/templates/ts/titan/runtime.js +1 -1
  73. package/templates/ts/titan/titan.d.ts +117 -117
  74. package/templates/ts/titan/titan.js +1 -1
  75. package/titanpl-sdk/node_modules/.package-lock.json +17 -0
  76. package/titanpl-sdk/node_modules/@titanpl/core/LICENSE +15 -0
  77. package/titanpl-sdk/node_modules/@titanpl/core/README.md +127 -0
  78. package/titanpl-sdk/node_modules/@titanpl/core/globals.d.ts +17 -0
  79. package/titanpl-sdk/node_modules/@titanpl/core/index.js +250 -0
  80. package/titanpl-sdk/node_modules/@titanpl/core/native/target/release/titan_core.dll +0 -0
  81. package/titanpl-sdk/node_modules/@titanpl/core/package.json +41 -0
  82. package/titanpl-sdk/node_modules/@titanpl/core/titan.json +115 -0
  83. package/titanpl-sdk/package-lock.json +28 -0
  84. package/titanpl-sdk/package.json +6 -3
  85. package/templates/rust-js/_gitignore +0 -38
  86. package/templates/rust-js/app/titan.d.ts +0 -101
  87. package/templates/rust-ts/Dockerfile +0 -66
  88. package/templates/rust-ts/_dockerignore +0 -3
  89. package/templates/rust-ts/_gitignore +0 -38
  90. package/templates/ts/Dockerfile +0 -40
  91. package/templates/ts/_dockerignore +0 -3
  92. package/templates/ts/_gitignore +0 -38
  93. /package/templates/{js → common}/Dockerfile +0 -0
  94. /package/templates/{js → common}/_dockerignore +0 -0
  95. /package/templates/{js → common}/_gitignore +0 -0
  96. /package/templates/{rust-js/_dockerignore → extension/node_modules/titanpl-sdk/templates/.dockerignore} +0 -0
  97. /package/templates/{js → extension/node_modules/titanpl-sdk/templates}/app/titan.d.ts +0 -0
@@ -0,0 +1,109 @@
1
+
2
+ <div align="center">
3
+ <img src="./assets/titanpl-sdk.png" alt="Titan SDK Logo" width="120" />
4
+ <h1>Titan SDK</h1>
5
+ <p>
6
+ <b>The Developer Toolkit for Titan Planet. Type safety, IntelliSense, and Extension Testing.</b>
7
+ </p>
8
+ </div>
9
+
10
+ <div align="center">
11
+
12
+ [![npm version](https://img.shields.io/npm/v/titanpl-sdk.svg?style=flat-square)](https://www.npmjs.com/package/titanpl-sdk)
13
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg?style=flat-square)](https://opensource.org/licenses/ISC)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## 🌌 Overview
20
+
21
+ **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.
22
+
23
+ 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.
24
+
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
+
27
+ ---
28
+
29
+ ## ✨ Features
30
+
31
+ - **💎 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.
32
+ - **🛡️ Static Validation**: Catch parameter mismatches and typos in `t.log`, `t.fetch`, `t.db`, etc., during development.
33
+ - **🔌 Extension Test Harness**: A "lite" version of the Titan runtime that simulates the native environment to test extensions in isolation.
34
+ - **🚀 Zero Production Trace**: This is a `devDependencies` package. It never ships with your binary, keeping your production footprint at literal zero.
35
+
36
+ ---
37
+
38
+ ## 🚀 The Test Harness (Lite Runtime)
39
+
40
+ 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.
41
+
42
+ ### How it works:
43
+ When you run the SDK in an extension folder, it:
44
+ 1. **Scaffolds a Virtual Project**: Creates a temporary, minimal Titan environment in `.titan_test_run`.
45
+ 2. **Native Compilation**: Automatically builds your native Rust code (`native/`) if it exists.
46
+ 3. **Hot-Linking**: Junctions your local extension into the virtual project's `node_modules`.
47
+ 4. **Verification**: Generates a test suite that attempts to call your extension's methods via the real `t` object inside the sandbox.
48
+
49
+ ### Usage:
50
+
51
+ ```bash
52
+ # Inside your extension directory
53
+ npx titan-sdk
54
+ ```
55
+
56
+ ---
57
+
58
+ ## ⌨️ Enabling IntelliSense
59
+
60
+ 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.
61
+
62
+ 1. **Install the SDK**:
63
+ ```bash
64
+ npm install --save-dev titan-sdk
65
+ ```
66
+
67
+ 2. **Configure Types**:
68
+ Create or update `jsconfig.json` (or `tsconfig.json`) in your project root:
69
+ ```json
70
+ {
71
+ "compilerOptions": {
72
+ "types": ["titan-sdk"]
73
+ }
74
+ }
75
+ ```
76
+
77
+ Now your editor will treat `t` as a first-class citizen:
78
+ ```js
79
+ export function myAction(req) {
80
+ t.log.info("Request received", req.path); // Autocomplete works!
81
+ return { status: "ok" };
82
+ }
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 🧱 What's Included? (Types Only)
88
+
89
+ The SDK provides types for the native APIs provided by the Titan Planet engine:
90
+
91
+ - **`t.log`**: Standardized logging that appears in the Titan binary console.
92
+ - **`t.fetch`**: Types for the high-performance Rust-native network stack.
93
+ - **`t.db`**: Interface for the native PostgreSQL driver.
94
+ - **`t.read`**: Definitions for optimized filesystem reads.
95
+ - **`t.jwt` / `t.password`**: Security helper types.
96
+
97
+ ---
98
+
99
+ ## 🌍 Community & Documentation
100
+
101
+ - **Core Framework**: [Titan Planet](https://github.com/ezet-galaxy/titanpl)
102
+ - **Official Docs**: [Titan Planet Docs](https://titan-docs-ez.vercel.app/docs)
103
+ - **Author**: [ezetgalaxy](https://github.com/ezet-galaxy)
104
+
105
+ ---
106
+
107
+ <p align="center">
108
+ Built with ❤️ for the <a href="https://titan-docs-ez.vercel.app/">Titan Planet</a> ecosystem.
109
+ </p>
@@ -0,0 +1,251 @@
1
+ #!/usr/bin/env node
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import { execSync } from "child_process";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ // Helper for colors
11
+ const cyan = (t) => `\x1b[36m${t}\x1b[0m`;
12
+ const green = (t) => `\x1b[32m${t}\x1b[0m`;
13
+ const red = (t) => `\x1b[31m${t}\x1b[0m`;
14
+ const yellow = (t) => `\x1b[33m${t}\x1b[0m`;
15
+
16
+ function copyDir(src, dest) {
17
+ fs.mkdirSync(dest, { recursive: true });
18
+ for (const file of fs.readdirSync(src)) {
19
+ const srcPath = path.join(src, file);
20
+ const destPath = path.join(dest, file);
21
+ if (fs.lstatSync(srcPath).isDirectory()) {
22
+ copyDir(srcPath, destPath);
23
+ } else {
24
+ fs.copyFileSync(srcPath, destPath);
25
+ }
26
+ }
27
+ }
28
+
29
+ function run() {
30
+ console.log(cyan("Titan SDK: Test Runner"));
31
+
32
+ // 1. Validate we are in an extension directory
33
+ const cwd = process.cwd();
34
+ const manifestPath = path.join(cwd, "titan.json");
35
+ if (!fs.existsSync(manifestPath)) {
36
+ console.log(red("Error: titan.json not found. Run this command inside your extension folder."));
37
+ process.exit(1);
38
+ }
39
+
40
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
41
+ const name = manifest.name;
42
+ console.log(green(`Extension: ${name}`));
43
+
44
+ // 2. Build Native Logic (if properly set up)
45
+ const nativeDir = path.join(cwd, "native");
46
+ if (fs.existsSync(nativeDir) && fs.existsSync(path.join(nativeDir, "Cargo.toml"))) {
47
+ console.log(cyan("Building native Rust module..."));
48
+ try {
49
+ execSync("cargo build --release", { cwd: nativeDir, stdio: "inherit" });
50
+ } catch (e) {
51
+ console.log(red("Failed to build native module."));
52
+ process.exit(1);
53
+ }
54
+ }
55
+
56
+ // 3. Setup Test Harness (Mini Titan Project)
57
+ const runDir = path.join(cwd, ".titan_test_run");
58
+ const isFirstRun = !fs.existsSync(runDir);
59
+
60
+ if (isFirstRun) {
61
+ console.log(cyan("Initializing test environment..."));
62
+ fs.mkdirSync(runDir, { recursive: true });
63
+
64
+ // Create app structure
65
+ const appDir = path.join(runDir, "app");
66
+ fs.mkdirSync(appDir);
67
+
68
+ // Create actions folder (required by Titan build)
69
+ const actionsDir = path.join(appDir, "actions");
70
+ fs.mkdirSync(actionsDir);
71
+
72
+ // Copy titan/ and server/ from templates
73
+ const templatesDir = path.join(__dirname, "..", "templates");
74
+
75
+ const titanSrc = path.join(templatesDir, "titan");
76
+ const titanDest = path.join(runDir, "titan");
77
+ if (fs.existsSync(titanSrc)) {
78
+ copyDir(titanSrc, titanDest);
79
+ // Double check titan.js exists
80
+ if (!fs.existsSync(path.join(titanDest, "titan.js"))) {
81
+ console.log(red(`Error: Failed to copy titan.js to ${titanDest}`));
82
+ process.exit(1);
83
+ }
84
+ } else {
85
+ console.log(red(`Error: Titan templates not found at ${titanSrc}`));
86
+ process.exit(1);
87
+ }
88
+
89
+ const serverSrc = path.join(templatesDir, "server");
90
+ const serverDest = path.join(runDir, "server");
91
+ if (fs.existsSync(serverSrc)) {
92
+ copyDir(serverSrc, serverDest);
93
+ } else {
94
+ console.log(red(`Error: Server templates not found at ${serverSrc}`));
95
+ process.exit(1);
96
+ }
97
+
98
+ // Create package.json for the test harness
99
+ const pkgJson = {
100
+ "type": "module"
101
+ };
102
+ fs.writeFileSync(path.join(runDir, "package.json"), JSON.stringify(pkgJson, null, 2));
103
+
104
+ // Create 'node_modules'
105
+ fs.mkdirSync(path.join(runDir, "node_modules"));
106
+ } else {
107
+ console.log(cyan("Using existing test environment..."));
108
+ }
109
+
110
+ // Always Ensure Extension Link is Fresh
111
+ const nmDir = path.join(runDir, "node_modules");
112
+ if (!fs.existsSync(nmDir)) fs.mkdirSync(nmDir, { recursive: true });
113
+
114
+ const extDest = path.join(nmDir, name);
115
+
116
+ // Remove old link/folder if exists to ensure freshness
117
+ if (fs.existsSync(extDest)) {
118
+ try {
119
+ fs.rmSync(extDest, { recursive: true, force: true });
120
+ } catch (e) { }
121
+ }
122
+
123
+ // Link current extension to node_modules/NAME
124
+ try {
125
+ // Use junction for Windows compat without admin rights
126
+ fs.symlinkSync(cwd, extDest, "junction");
127
+ } catch (e) {
128
+ // Fallback to copy if link fails
129
+ // console.log(yellow("Linking failed, copying extension files..."));
130
+ copyDir(cwd, extDest);
131
+ }
132
+
133
+ // Create default test files ONLY if they don't exist
134
+ const actionsDir = path.join(runDir, "app", "actions");
135
+ const testActionPath = path.join(actionsDir, "test.js");
136
+
137
+ if (!fs.existsSync(testActionPath)) {
138
+ const testAction = `export const test = (req) => {
139
+ const ext = t["${name}"];
140
+
141
+ const results = {
142
+ extension: "${name}",
143
+ loaded: !!ext,
144
+ methods: ext ? Object.keys(ext) : [],
145
+ timestamp: new Date().toISOString()
146
+ };
147
+
148
+ if (ext && ext.hello) {
149
+ try {
150
+ results.hello_test = ext.hello("World");
151
+ } catch(e) {
152
+ results.hello_error = String(e);
153
+ }
154
+ }
155
+
156
+ if (ext && ext.calc) {
157
+ try {
158
+ results.calc_test = ext.calc(15, 25);
159
+ } catch(e) {
160
+ results.calc_error = String(e);
161
+ }
162
+ }
163
+
164
+ return results;
165
+ };
166
+ `;
167
+ fs.writeFileSync(testActionPath, testAction);
168
+ }
169
+
170
+ const appJsPath = path.join(runDir, "app", "app.js");
171
+ if (!fs.existsSync(appJsPath)) {
172
+ const testScript = `import t from "../titan/titan.js";
173
+ import "${name}";
174
+
175
+ // Extension test harness for: ${name}
176
+ const ext = t["${name}"];
177
+
178
+ console.log("---------------------------------------------------");
179
+ console.log("Testing Extension: ${name}");
180
+ console.log("---------------------------------------------------");
181
+
182
+ if (!ext) {
183
+ console.log("ERROR: Extension '${name}' not found in global 't'.");
184
+ } else {
185
+ console.log("✓ Extension loaded successfully!");
186
+ console.log("✓ Available methods:", Object.keys(ext).join(", "));
187
+
188
+ // Try 'hello' if it exists
189
+ if (typeof ext.hello === 'function') {
190
+ console.log("\\nTesting ext.hello('Titan')...");
191
+ try {
192
+ const res = ext.hello("Titan");
193
+ console.log("✓ Result:", res);
194
+ } catch(e) {
195
+ console.log("✗ Error:", e.message);
196
+ }
197
+ }
198
+
199
+ // Try 'calc' if it exists
200
+ if (typeof ext.calc === 'function') {
201
+ console.log("\\nTesting ext.calc(10, 20)...");
202
+ try {
203
+ const res = ext.calc(10, 20);
204
+ console.log("✓ Result:", res);
205
+ } catch(e) {
206
+ console.log("✗ Error:", e.message);
207
+ }
208
+ }
209
+ }
210
+
211
+ console.log("---------------------------------------------------");
212
+ console.log("✓ Test complete!");
213
+ console.log("\\n📍 Routes:");
214
+ console.log(" GET http://localhost:3000/ → Test harness info");
215
+ console.log(" GET http://localhost:3000/test → Extension test results (JSON)");
216
+ console.log("---------------------------------------------------\\n");
217
+
218
+ // Create routes
219
+ t.get("/test").action("test");
220
+ t.get("/").reply("🚀 Extension Test Harness for ${name}\\n\\nVisit /test to see extension test results");
221
+
222
+ await t.start(3000, "Titan Extension Test Running!");
223
+ `;
224
+ fs.writeFileSync(appJsPath, testScript);
225
+ }
226
+
227
+ // Build the app (bundle actions)
228
+ console.log(cyan("Building test app..."));
229
+ try {
230
+ execSync("node app/app.js --build", {
231
+ cwd: runDir,
232
+ stdio: "inherit",
233
+ env: { ...process.env, NODE_OPTIONS: "--no-warnings" }
234
+ });
235
+ } catch (e) {
236
+ console.log(red("Failed to build test app. checking for runtime errors..."));
237
+ }
238
+
239
+ // 4. Run Titan Server using cargo run
240
+ console.log(green("\\x1b[1m\\n>>> STARTING EXTENSION TEST >>>\\n\\x1b[0m"));
241
+
242
+ const serverDir = path.join(runDir, "server");
243
+
244
+ try {
245
+ execSync("cargo run", { cwd: serverDir, stdio: "inherit" });
246
+ } catch (e) {
247
+ // console.log(red("Runtime exited."));
248
+ }
249
+ }
250
+
251
+ run();
@@ -0,0 +1,46 @@
1
+ export { };
2
+
3
+ declare global {
4
+ /**
5
+ * Titan Runtime Global Object
6
+ */
7
+ const t: Titan.Runtime;
8
+ }
9
+
10
+ export namespace Titan {
11
+ interface Runtime {
12
+ /**
13
+ * Log messages to the Titan console
14
+ */
15
+ log: LogInterface;
16
+
17
+ /**
18
+ * Read file content
19
+ */
20
+ read(path: string): string;
21
+
22
+ /**
23
+ * Fetch API wrapper
24
+ */
25
+ fetch(url: string, options?: any): Promise<any>;
26
+
27
+ /**
28
+ * Database operations
29
+ */
30
+ db: {
31
+ query(sql: string, params?: any[]): Promise<any>;
32
+ };
33
+
34
+ /**
35
+ * Titan Extensions
36
+ */
37
+ [key: string]: any;
38
+ }
39
+
40
+ interface LogInterface {
41
+ (...args: any[]): void;
42
+ info(...args: any[]): void;
43
+ warn(...args: any[]): void;
44
+ error(...args: any[]): void;
45
+ }
46
+ }
@@ -0,0 +1,5 @@
1
+ // Titan SDK
2
+ // This package is primarily for type definitions and development tools.
3
+ // The 't' object is injected globally by the Titan runtime.
4
+
5
+ export const VERSION = "0.0.1";
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "titanpl-sdk",
3
+ "version": "0.1.7",
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
+ }
@@ -18,20 +18,6 @@ COPY . .
18
18
  # Install JS dependencies (needed for Titan DSL + bundler)
19
19
  RUN npm install
20
20
 
21
- SHELL ["/bin/bash", "-c"]
22
-
23
- # Extract Titan extensions into .ext
24
- RUN mkdir -p /app/.ext && \
25
- find /app/node_modules -maxdepth 5 -type f -name "titan.json" -print0 | \
26
- while IFS= read -r -d '' file; do \
27
- pkg_dir="$(dirname "$file")"; \
28
- pkg_name="$(basename "$pkg_dir")"; \
29
- echo "Copying Titan extension: $pkg_name from $pkg_dir"; \
30
- cp -r "$pkg_dir" "/app/.ext/$pkg_name"; \
31
- done && \
32
- echo "Extensions in .ext:" && \
33
- ls -R /app/.ext
34
-
35
21
  # Build Titan metadata + bundle JS actions
36
22
  RUN titan build
37
23
 
@@ -48,7 +34,7 @@ FROM debian:stable-slim
48
34
  WORKDIR /app
49
35
 
50
36
  # Copy Rust binary from builder stage
51
- COPY --from=builder /app/server/target/release/titan-server ./titan-server
37
+ COPY --from=builder /app/server/target/release/server ./titan-server
52
38
 
53
39
  # Copy Titan routing metadata
54
40
  COPY --from=builder /app/server/routes.json ./routes.json
@@ -58,9 +44,10 @@ COPY --from=builder /app/server/action_map.json ./action_map.json
58
44
  RUN mkdir -p /app/actions
59
45
  COPY --from=builder /app/server/actions /app/actions
60
46
 
61
- # Copy only Titan extensions
62
- COPY --from=builder /app/.ext ./.ext
47
+ COPY --from=builder /app/db /app/assets
63
48
 
49
+ # Expose Titan port
64
50
  EXPOSE 3000
65
51
 
52
+ # Start Titan
66
53
  CMD ["./titan-server"]
@@ -0,0 +1,5 @@
1
+ export const hello = (req) => {
2
+ return {
3
+ message: `Hello from Titan ${req.body.name}`,
4
+ };
5
+ }
@@ -0,0 +1,10 @@
1
+ import t from "../titan/titan.js";
2
+
3
+
4
+
5
+
6
+ t.post("/hello").action("hello") // pass a json payload { "name": "titan" }
7
+
8
+ t.get("/").reply("Ready to land on Titan Planet 🚀");
9
+
10
+ t.start(3000, "Titan Running!");
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "esnext",
4
+ "target": "esnext",
5
+ "checkJs": false,
6
+ "noImplicitAny": false,
7
+ "allowJs": true,
8
+ "moduleResolution": "node",
9
+ "baseUrl": ".",
10
+ "paths": {
11
+ "*": [
12
+ "./app/*"
13
+ ]
14
+ }
15
+ },
16
+ "include": [
17
+ "app/**/*"
18
+ ]
19
+ }