@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,41 @@
1
+ {
2
+ "name": "@titanpl/core",
3
+ "version": "1.0.1",
4
+ "description": "The official Core Standard Library for Titan Planet - provides fs, path, crypto, os, net, proc, time, and url modules",
5
+ "main": "index.js",
6
+ "types": "globals.d.ts",
7
+ "scripts": {
8
+ "build:native": "cd native && cargo build --release",
9
+ "test": "tit run ext"
10
+ },
11
+ "keywords": [
12
+ "titan",
13
+ "titanpl",
14
+ "titan-planet",
15
+ "runtime",
16
+ "core",
17
+ "fs",
18
+ "path",
19
+ "crypto",
20
+ "os",
21
+ "extension",
22
+ "titanpl-sdk"
23
+ ],
24
+ "author": "ezetgalaxy",
25
+ "license": "ISC",
26
+ "files": [
27
+ "index.js",
28
+ "titan.json",
29
+ "globals.d.ts",
30
+ "native/target/release/*.dll",
31
+ "native/target/release/*.so",
32
+ "native/target/release/*.dylib",
33
+ "README.md"
34
+ ],
35
+ "engines": {
36
+ "node": ">=18.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "esbuild": "^0.27.2"
40
+ }
41
+ }
@@ -0,0 +1,115 @@
1
+ {
2
+ "name": "@titanpl/core",
3
+ "description": "The official Core Standard Library for Titan Planet",
4
+ "version": "1.0.0",
5
+ "main": "index.js",
6
+ "native": {
7
+ "path": "native/target/release/titan_core_native.dll",
8
+ "functions": {
9
+ "fs_read_file": {
10
+ "symbol": "fs_read_file",
11
+ "parameters": [
12
+ "string"
13
+ ],
14
+ "result": "string"
15
+ },
16
+ "fs_write_file": {
17
+ "symbol": "fs_write_file",
18
+ "parameters": [
19
+ "string",
20
+ "string"
21
+ ],
22
+ "result": "void"
23
+ },
24
+ "fs_readdir": {
25
+ "symbol": "fs_readdir",
26
+ "parameters": [
27
+ "string"
28
+ ],
29
+ "result": "string"
30
+ },
31
+ "fs_mkdir": {
32
+ "symbol": "fs_mkdir",
33
+ "parameters": [
34
+ "string"
35
+ ],
36
+ "result": "void"
37
+ },
38
+ "fs_exists": {
39
+ "symbol": "fs_exists",
40
+ "parameters": [
41
+ "string"
42
+ ],
43
+ "result": "bool"
44
+ },
45
+ "fs_stat": {
46
+ "symbol": "fs_stat",
47
+ "parameters": [
48
+ "string"
49
+ ],
50
+ "result": "string"
51
+ },
52
+ "fs_remove": {
53
+ "symbol": "fs_remove",
54
+ "parameters": [
55
+ "string"
56
+ ],
57
+ "result": "void"
58
+ },
59
+ "path_cwd": {
60
+ "symbol": "path_cwd",
61
+ "parameters": [],
62
+ "result": "string"
63
+ },
64
+ "crypto_hash": {
65
+ "symbol": "crypto_hash",
66
+ "parameters": [
67
+ "string",
68
+ "string"
69
+ ],
70
+ "result": "string"
71
+ },
72
+ "crypto_random_bytes": {
73
+ "symbol": "crypto_random_bytes",
74
+ "parameters": [
75
+ "f64"
76
+ ],
77
+ "result": "string"
78
+ },
79
+ "crypto_uuid": {
80
+ "symbol": "crypto_uuid",
81
+ "parameters": [],
82
+ "result": "string"
83
+ },
84
+ "os_info": {
85
+ "symbol": "os_info",
86
+ "parameters": [],
87
+ "result": "string"
88
+ },
89
+ "net_resolve": {
90
+ "symbol": "net_resolve",
91
+ "parameters": [
92
+ "string"
93
+ ],
94
+ "result": "string"
95
+ },
96
+ "net_ip": {
97
+ "symbol": "net_ip",
98
+ "parameters": [],
99
+ "result": "string"
100
+ },
101
+ "proc_info": {
102
+ "symbol": "proc_info",
103
+ "parameters": [],
104
+ "result": "string"
105
+ },
106
+ "time_sleep": {
107
+ "symbol": "time_sleep",
108
+ "parameters": [
109
+ "f64"
110
+ ],
111
+ "result": "void"
112
+ }
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "titanpl-sdk",
3
+ "version": "0.1.7",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "titanpl-sdk",
9
+ "version": "0.1.7",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@titanpl/core": "^1.0.1"
13
+ },
14
+ "bin": {
15
+ "titanpl-sdk": "bin/run.js"
16
+ }
17
+ },
18
+ "node_modules/@titanpl/core": {
19
+ "version": "1.0.1",
20
+ "resolved": "https://registry.npmjs.org/@titanpl/core/-/core-1.0.1.tgz",
21
+ "integrity": "sha512-5zcDMNnf+oghKkQMiPBFuhLlRy2IASyWMAAMgfqa4AzoXxiw2BzzfN0B2EA76Dy9AhCeK2mY84Zm+FSE7ANVFg==",
22
+ "license": "ISC",
23
+ "engines": {
24
+ "node": ">=18.0.0"
25
+ }
26
+ }
27
+ }
28
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "titanpl-sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
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",
@@ -29,5 +29,8 @@
29
29
  "backend-sdk",
30
30
  "extension-development"
31
31
  ],
32
- "license": "ISC"
33
- }
32
+ "license": "ISC",
33
+ "dependencies": {
34
+ "@titanpl/core": "^1.0.1"
35
+ }
36
+ }
@@ -1,38 +0,0 @@
1
- # Node & Packages
2
- node_modules/
3
- npm-debug.log*
4
- yarn-debug.log*
5
- yarn-error.log*
6
- package-lock.json
7
- yarn.lock
8
-
9
- # Titan Runtime (Auto-generated - DO NOT COMMIT)
10
- titan/server-bin*
11
- .titan/
12
- .ext/
13
- server/routes.json
14
- server/action_map.json
15
- server/actions/
16
- server/titan/
17
- server/src/actions_rust/
18
-
19
- # Rust Build Artifacts
20
- server/target/
21
- Cargo.lock
22
-
23
- # OS Files
24
- .DS_Store
25
- Thumbs.db
26
- *.tmp
27
- *.bak
28
-
29
- # Environment & Secrets
30
- .env
31
- .env.local
32
- .env.*.local
33
-
34
- # IDEs
35
- .vscode/
36
- .idea/
37
- *.swp
38
- *.swo
@@ -1,101 +0,0 @@
1
- export { };
2
-
3
- declare global {
4
- /**
5
- * TITAN TYPE DEFINITIONS
6
- * ----------------------
7
- * These types are globally available in your Titan project.
8
- */
9
-
10
- /**
11
- * The Titan Request Object passed to actions.
12
- */
13
- interface TitanRequest {
14
- body: any;
15
- method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
16
- path: string;
17
- headers: {
18
- host?: string;
19
- "content-type"?: string;
20
- "user-agent"?: string;
21
- authorization?: string;
22
- [key: string]: string | undefined;
23
- };
24
- params: Record<string, string>;
25
- query: Record<string, string>;
26
- }
27
-
28
- interface DbConnection {
29
- /**
30
- * Execute a SQL query.
31
- * @param sql The SQL query string.
32
- * @param params (Optional) Parameters for the query ($1, $2, etc).
33
- */
34
- query(sql: string, params?: any[]): any[];
35
- }
36
-
37
- /**
38
- * Define a Titan Action with type inference.
39
- * @example
40
- * export const hello = defineAction((req) => {
41
- * return req.headers;
42
- * });
43
- */
44
- function defineAction<T>(actionFn: (req: TitanRequest) => T): (req: TitanRequest) => T;
45
-
46
- /**
47
- * Titan Runtime Utilities
48
- */
49
- const t: {
50
- /**
51
- * Log messages to the server console with Titan formatting.
52
- */
53
- log(...args: any[]): void;
54
-
55
- /**
56
- * Read a file contents as string.
57
- * @param path Relative path to the file from project root.
58
- */
59
- read(path: string): string;
60
-
61
- fetch(url: string, options?: {
62
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
63
- headers?: Record<string, string>;
64
- body?: string | object;
65
- }): {
66
- ok: boolean;
67
- status?: number;
68
- body?: string;
69
- error?: string;
70
- };
71
-
72
- jwt: {
73
- sign(
74
- payload: object,
75
- secret: string,
76
- options?: { expiresIn?: string | number }
77
- ): string;
78
- verify(token: string, secret: string): any;
79
- };
80
-
81
- password: {
82
- hash(password: string): string;
83
- verify(password: string, hash: string): boolean;
84
- };
85
-
86
- db: {
87
- connect(url: string): DbConnection;
88
- };
89
-
90
- /**
91
- * Titan Validator (Zod-compatible)
92
- */
93
- valid: typeof import("@titanpl/valid");
94
- };
95
-
96
- /**
97
- * Global Request Object
98
- * Available automatically in actions.
99
- */
100
- var req: TitanRequest;
101
- }
@@ -1,66 +0,0 @@
1
- # ================================================================
2
- # STAGE 1 — Build Titan (JS → Rust)
3
- # ================================================================
4
- FROM rust:1.91.1 AS builder
5
-
6
- # Install Node for Titan CLI + bundler
7
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
8
- && apt-get install -y nodejs
9
-
10
- # Install Titan CLI (latest)
11
- RUN npm install -g @ezetgalaxy/titan@latest
12
-
13
- WORKDIR /app
14
-
15
- # Copy project files
16
- COPY . .
17
-
18
- # Install JS dependencies (needed for Titan DSL + bundler)
19
- RUN npm install
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
- # Build Titan metadata + bundle JS actions
36
- RUN titan build
37
-
38
- # Build Rust binary
39
- RUN cd server && cargo build --release
40
-
41
-
42
-
43
- # ================================================================
44
- # STAGE 2 — Runtime Image (Lightweight)
45
- # ================================================================
46
- FROM debian:stable-slim
47
-
48
- WORKDIR /app
49
-
50
- # Copy Rust binary from builder stage
51
- COPY --from=builder /app/server/target/release/titan-server ./titan-server
52
-
53
- # Copy Titan routing metadata
54
- COPY --from=builder /app/server/routes.json ./routes.json
55
- COPY --from=builder /app/server/action_map.json ./action_map.json
56
-
57
- # Copy Titan JS bundles
58
- RUN mkdir -p /app/actions
59
- COPY --from=builder /app/server/actions /app/actions
60
-
61
- # Copy only Titan extensions
62
- COPY --from=builder /app/.ext ./.ext
63
-
64
- EXPOSE 3000
65
-
66
- CMD ["./titan-server"]
@@ -1,3 +0,0 @@
1
- node_modules
2
- npm-debug.log
3
- .git
@@ -1,38 +0,0 @@
1
- # Node & Packages
2
- node_modules/
3
- npm-debug.log*
4
- yarn-debug.log*
5
- yarn-error.log*
6
- package-lock.json
7
- yarn.lock
8
-
9
- # Titan Runtime (Auto-generated - DO NOT COMMIT)
10
- titan/server-bin*
11
- .titan/
12
- .ext/
13
- server/routes.json
14
- server/action_map.json
15
- server/actions/
16
- server/titan/
17
- server/src/actions_rust/
18
-
19
- # Rust Build Artifacts
20
- server/target/
21
- Cargo.lock
22
-
23
- # OS Files
24
- .DS_Store
25
- Thumbs.db
26
- *.tmp
27
- *.bak
28
-
29
- # Environment & Secrets
30
- .env
31
- .env.local
32
- .env.*.local
33
-
34
- # IDEs
35
- .vscode/
36
- .idea/
37
- *.swp
38
- *.swo
@@ -1,40 +0,0 @@
1
- # ================================================================
2
- # STAGE 1 — Build
3
- # ================================================================
4
- FROM node:20-slim AS builder
5
-
6
- # Install Titan CLI (latest)
7
- RUN npm install -g @ezetgalaxy/titan@latest
8
-
9
- WORKDIR /app
10
-
11
- # Copy project files
12
- COPY . .
13
-
14
- # Install JS dependencies
15
- RUN npm install
16
-
17
- # Build Titan App
18
- RUN titan build
19
-
20
- # ================================================================
21
- # STAGE 2 — Runtime
22
- # ================================================================
23
- FROM node:20-slim
24
-
25
- WORKDIR /app
26
-
27
- # Copy Titan Build Artifacts
28
- COPY --from=builder /app/.titan ./.titan
29
- COPY --from=builder /app/server ./server
30
- COPY --from=builder /app/package.json ./package.json
31
-
32
- # Install dependencies (production only, but for now we might need all if not careful)
33
- # Actually, the runtime depends on `express`-like behavior?
34
- # No, Titan pure TS runs via `node .titan/app.js` which might need deps?
35
- # The user's package.json has dependencies.
36
- RUN npm install --omit=dev
37
-
38
- EXPOSE 3000
39
-
40
- CMD ["node", ".titan/app.js"]
@@ -1,3 +0,0 @@
1
- node_modules
2
- npm-debug.log
3
- .git
@@ -1,38 +0,0 @@
1
- # Node & Packages
2
- node_modules/
3
- npm-debug.log*
4
- yarn-debug.log*
5
- yarn-error.log*
6
- package-lock.json
7
- yarn.lock
8
-
9
- # Titan Runtime (Auto-generated - DO NOT COMMIT)
10
- titan/server-bin*
11
- .titan/
12
- .ext/
13
- server/routes.json
14
- server/action_map.json
15
- server/actions/
16
- server/titan/
17
- server/src/actions_rust/
18
-
19
- # Rust Build Artifacts
20
- server/target/
21
- Cargo.lock
22
-
23
- # OS Files
24
- .DS_Store
25
- Thumbs.db
26
- *.tmp
27
- *.bak
28
-
29
- # Environment & Secrets
30
- .env
31
- .env.local
32
- .env.*.local
33
-
34
- # IDEs
35
- .vscode/
36
- .idea/
37
- *.swp
38
- *.swo
File without changes
File without changes
File without changes