@ezetgalaxy/titan 26.9.2 → 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 (72) hide show
  1. package/package.json +4 -3
  2. package/templates/extension/node_modules/.bin/esbuild +16 -0
  3. package/templates/extension/node_modules/.bin/esbuild.cmd +17 -0
  4. package/templates/extension/node_modules/.bin/esbuild.ps1 +28 -0
  5. package/templates/extension/node_modules/.bin/titanpl-sdk +16 -0
  6. package/templates/extension/node_modules/.bin/titanpl-sdk.cmd +17 -0
  7. package/templates/extension/node_modules/.bin/titanpl-sdk.ps1 +28 -0
  8. package/templates/extension/node_modules/.package-lock.json +111 -0
  9. package/templates/extension/node_modules/@esbuild/win32-x64/README.md +3 -0
  10. package/templates/extension/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
  11. package/templates/extension/node_modules/@esbuild/win32-x64/package.json +20 -0
  12. package/templates/extension/node_modules/@titanpl/core/LICENSE +15 -0
  13. package/templates/extension/node_modules/@titanpl/core/README.md +127 -0
  14. package/templates/extension/node_modules/@titanpl/core/globals.d.ts +17 -0
  15. package/templates/extension/node_modules/@titanpl/core/index.js +250 -0
  16. package/templates/extension/node_modules/@titanpl/core/native/target/release/titan_core.dll +0 -0
  17. package/templates/extension/node_modules/@titanpl/core/package.json +41 -0
  18. package/templates/extension/node_modules/@titanpl/core/titan.json +115 -0
  19. package/templates/extension/node_modules/chokidar/LICENSE +21 -0
  20. package/templates/extension/node_modules/chokidar/README.md +305 -0
  21. package/templates/extension/node_modules/chokidar/handler.d.ts +90 -0
  22. package/templates/extension/node_modules/chokidar/handler.js +632 -0
  23. package/templates/extension/node_modules/chokidar/index.d.ts +217 -0
  24. package/templates/extension/node_modules/chokidar/index.js +822 -0
  25. package/templates/extension/node_modules/chokidar/package.json +63 -0
  26. package/templates/extension/node_modules/esbuild/LICENSE.md +21 -0
  27. package/templates/extension/node_modules/esbuild/README.md +3 -0
  28. package/templates/extension/node_modules/esbuild/bin/esbuild +223 -0
  29. package/templates/extension/node_modules/esbuild/install.js +289 -0
  30. package/templates/extension/node_modules/esbuild/lib/main.d.ts +716 -0
  31. package/templates/extension/node_modules/esbuild/lib/main.js +2242 -0
  32. package/templates/extension/node_modules/esbuild/package.json +49 -0
  33. package/templates/extension/node_modules/readdirp/LICENSE +21 -0
  34. package/templates/extension/node_modules/readdirp/README.md +120 -0
  35. package/templates/extension/node_modules/readdirp/index.d.ts +108 -0
  36. package/templates/extension/node_modules/readdirp/index.js +272 -0
  37. package/templates/extension/node_modules/readdirp/package.json +66 -0
  38. package/templates/extension/node_modules/titanpl-sdk/LICENSE +15 -0
  39. package/templates/extension/node_modules/titanpl-sdk/README.md +109 -0
  40. package/templates/extension/node_modules/titanpl-sdk/assets/titanpl-sdk.png +0 -0
  41. package/templates/extension/node_modules/titanpl-sdk/bin/run.js +251 -0
  42. package/templates/extension/node_modules/titanpl-sdk/index.d.ts +46 -0
  43. package/templates/extension/node_modules/titanpl-sdk/index.js +5 -0
  44. package/templates/extension/node_modules/titanpl-sdk/package.json +33 -0
  45. package/templates/extension/node_modules/titanpl-sdk/templates/.dockerignore +3 -0
  46. package/templates/extension/node_modules/titanpl-sdk/templates/Dockerfile +53 -0
  47. package/templates/extension/node_modules/titanpl-sdk/templates/app/actions/hello.js +5 -0
  48. package/templates/extension/node_modules/titanpl-sdk/templates/app/app.js +10 -0
  49. package/templates/extension/node_modules/titanpl-sdk/templates/app/titan.d.ts +87 -0
  50. package/templates/extension/node_modules/titanpl-sdk/templates/jsconfig.json +19 -0
  51. package/templates/extension/node_modules/titanpl-sdk/templates/server/Cargo.lock +2839 -0
  52. package/templates/extension/node_modules/titanpl-sdk/templates/server/Cargo.toml +27 -0
  53. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/action_management.rs +131 -0
  54. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/errors.rs +10 -0
  55. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/extensions.rs +640 -0
  56. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/main.rs +345 -0
  57. package/templates/extension/node_modules/titanpl-sdk/templates/server/src/utils.rs +33 -0
  58. package/templates/extension/node_modules/titanpl-sdk/templates/titan/bundle.js +65 -0
  59. package/templates/extension/node_modules/titanpl-sdk/templates/titan/dev.js +113 -0
  60. package/templates/extension/node_modules/titanpl-sdk/templates/titan/titan.js +98 -0
  61. package/templates/extension/package-lock.json +522 -0
  62. package/templates/extension/package.json +4 -3
  63. package/titanpl-sdk/node_modules/.package-lock.json +17 -0
  64. package/titanpl-sdk/node_modules/@titanpl/core/LICENSE +15 -0
  65. package/titanpl-sdk/node_modules/@titanpl/core/README.md +127 -0
  66. package/titanpl-sdk/node_modules/@titanpl/core/globals.d.ts +17 -0
  67. package/titanpl-sdk/node_modules/@titanpl/core/index.js +250 -0
  68. package/titanpl-sdk/node_modules/@titanpl/core/native/target/release/titan_core.dll +0 -0
  69. package/titanpl-sdk/node_modules/@titanpl/core/package.json +41 -0
  70. package/titanpl-sdk/node_modules/@titanpl/core/titan.json +115 -0
  71. package/titanpl-sdk/package-lock.json +28 -0
  72. package/titanpl-sdk/package.json +6 -3
@@ -0,0 +1,250 @@
1
+ // Titan Core Library
2
+ // Provides standard library features using native bindings.
3
+
4
+ // Native bindings are expected to be available globally or via t.native
5
+ // adjusting based on typical Titan behavior.
6
+ // We bind them to local variables for cleaner usage.
7
+
8
+ const native_fs_read_file = globalThis.fs_read_file;
9
+ const native_fs_write_file = globalThis.fs_write_file;
10
+ const native_fs_readdir = globalThis.fs_readdir;
11
+ const native_fs_mkdir = globalThis.fs_mkdir;
12
+ const native_fs_exists = globalThis.fs_exists;
13
+ const native_fs_stat = globalThis.fs_stat;
14
+ const native_fs_remove = globalThis.fs_remove;
15
+ const native_path_cwd = globalThis.path_cwd;
16
+ const native_crypto_hash = globalThis.crypto_hash;
17
+ const native_crypto_random_bytes = globalThis.crypto_random_bytes;
18
+ const native_crypto_uuid = globalThis.crypto_uuid;
19
+ const native_os_info = globalThis.os_info;
20
+ const native_net_resolve = globalThis.net_resolve;
21
+ const native_net_ip = globalThis.net_ip;
22
+ const native_proc_info = globalThis.proc_info;
23
+ const native_time_sleep = globalThis.time_sleep;
24
+
25
+ // --- FS ---
26
+ const fs = {
27
+ readFile: (path) => {
28
+ if (!native_fs_read_file) throw new Error("Native fs_read_file not found");
29
+ return native_fs_read_file(path);
30
+ },
31
+ writeFile: (path, content) => {
32
+ if (!native_fs_write_file) throw new Error("Native fs_write_file not found");
33
+ native_fs_write_file(path, content);
34
+ },
35
+ readdir: (path) => {
36
+ if (!native_fs_readdir) throw new Error("Native fs_readdir not found");
37
+ return JSON.parse(native_fs_readdir(path));
38
+ },
39
+ mkdir: (path) => {
40
+ if (!native_fs_mkdir) throw new Error("Native fs_mkdir not found");
41
+ native_fs_mkdir(path);
42
+ },
43
+ exists: (path) => {
44
+ if (!native_fs_exists) throw new Error("Native fs_exists not found");
45
+ return native_fs_exists(path);
46
+ },
47
+ stat: (path) => {
48
+ if (!native_fs_stat) throw new Error("Native fs_stat not found");
49
+ return JSON.parse(native_fs_stat(path));
50
+ },
51
+ remove: (path) => {
52
+ if (!native_fs_remove) throw new Error("Native fs_remove not found");
53
+ native_fs_remove(path);
54
+ }
55
+ };
56
+
57
+ // --- Path ---
58
+ // Basic implementation for POSIX-like paths (Titan mostly runs on servers/containers)
59
+ const path = {
60
+ join: (...args) => {
61
+ return args
62
+ .map((part, i) => {
63
+ if (i === 0) return part.trim().replace(/[\/]*$/g, '');
64
+ return part.trim().replace(/(^[\/]*|[\/]*$)/g, '');
65
+ })
66
+ .filter(x => x.length)
67
+ .join('/');
68
+ },
69
+ resolve: (...args) => {
70
+ let resolved = '';
71
+ for (let arg of args) {
72
+ resolved = path.join(resolved, arg);
73
+ }
74
+ if (!resolved.startsWith('/') && native_path_cwd) {
75
+ resolved = path.join(native_path_cwd(), resolved);
76
+ }
77
+ return resolved;
78
+ },
79
+ extname: (p) => {
80
+ const parts = p.split('.');
81
+ return parts.length > 1 && !p.startsWith('.') ? '.' + parts.pop() : '';
82
+ },
83
+ dirname: (p) => {
84
+ const parts = p.split('/');
85
+ parts.pop();
86
+ return parts.join('/') || '.';
87
+ },
88
+ basename: (p) => p.split('/').pop()
89
+ };
90
+
91
+ // --- Crypto ---
92
+ const crypto = {
93
+ hash: (algo, data) => native_crypto_hash(algo, data),
94
+ randomBytes: (size) => native_crypto_random_bytes(size),
95
+ uuid: () => native_crypto_uuid(),
96
+ base64: {
97
+ encode: (str) => btoa(str), // Boa supports btoa/atob
98
+ decode: (str) => atob(str),
99
+ },
100
+ compare: (a, b) => {
101
+ if (a.length !== b.length) return false;
102
+ // Constant time comparison not guaranteed here in JS easily without specialized tricks
103
+ let mismatch = 0;
104
+ for (let i = 0; i < a.length; ++i) {
105
+ mismatch |= (a.charCodeAt(i) ^ b.charCodeAt(i));
106
+ }
107
+ return mismatch === 0;
108
+ }
109
+ };
110
+
111
+ // --- OS ---
112
+ const os = {
113
+ platform: () => {
114
+ const info = JSON.parse(native_os_info());
115
+ return info.platform;
116
+ },
117
+ cpus: () => {
118
+ const info = JSON.parse(native_os_info());
119
+ return info.cpus;
120
+ },
121
+ totalMemory: () => {
122
+ const info = JSON.parse(native_os_info());
123
+ return info.totalMemory;
124
+ },
125
+ freeMemory: () => {
126
+ const info = JSON.parse(native_os_info());
127
+ return info.freeMemory;
128
+ },
129
+ tmpdir: () => '/tmp' // Default for now, generic
130
+ };
131
+
132
+ // --- Net ---
133
+ const net = {
134
+ resolveDNS: (hostname) => JSON.parse(native_net_resolve(hostname)),
135
+ ip: () => native_net_ip(),
136
+ ping: (host) => {
137
+ // Mock ping or simple verify
138
+ return true;
139
+ }
140
+ };
141
+
142
+ // --- Proc ---
143
+ // Memoize static info if needed, but here we call native
144
+ const proc = {
145
+ pid: () => {
146
+ const info = JSON.parse(native_proc_info());
147
+ return info.pid;
148
+ },
149
+ uptime: () => {
150
+ const info = JSON.parse(native_proc_info());
151
+ return info.uptime;
152
+ },
153
+ memory: () => {
154
+ // Optional: return full memory usage if possible
155
+ return {};
156
+ }
157
+ };
158
+
159
+ // --- Time ---
160
+ const time = {
161
+ sleep: (ms) => native_time_sleep(ms),
162
+ now: () => Date.now(),
163
+ timestamp: () => new Date().toISOString()
164
+ };
165
+
166
+ // --- URL ---
167
+ // Simple URLSearchParams polyfill for V8 runtime
168
+ class TitanURLSearchParams {
169
+ constructor(init = '') {
170
+ this._params = {};
171
+ if (typeof init === 'string') {
172
+ const query = init.startsWith('?') ? init.slice(1) : init;
173
+ query.split('&').forEach(pair => {
174
+ const [key, value] = pair.split('=').map(decodeURIComponent);
175
+ if (key) this._params[key] = value || '';
176
+ });
177
+ } else if (typeof init === 'object') {
178
+ Object.assign(this._params, init);
179
+ }
180
+ }
181
+ get(key) { return this._params[key] || null; }
182
+ set(key, value) { this._params[key] = String(value); }
183
+ has(key) { return key in this._params; }
184
+ delete(key) { delete this._params[key]; }
185
+ toString() {
186
+ return Object.entries(this._params)
187
+ .map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
188
+ .join('&');
189
+ }
190
+ entries() { return Object.entries(this._params); }
191
+ keys() { return Object.keys(this._params); }
192
+ values() { return Object.values(this._params); }
193
+ }
194
+
195
+ const url = {
196
+ parse: (str) => {
197
+ // Basic URL parsing if native URL is available
198
+ if (typeof URL !== 'undefined') {
199
+ return new URL(str);
200
+ }
201
+ // Simple fallback parser
202
+ const match = str.match(/^(https?:)\/\/([^/:]+)(?::(\d+))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/);
203
+ if (!match) throw new Error('Invalid URL');
204
+ return {
205
+ protocol: match[1],
206
+ hostname: match[2],
207
+ port: match[3] || '',
208
+ pathname: match[4] || '/',
209
+ search: match[5] || '',
210
+ hash: match[6] || ''
211
+ };
212
+ },
213
+ format: (obj) => obj.toString ? obj.toString() : String(obj),
214
+ SearchParams: TitanURLSearchParams
215
+ };
216
+
217
+
218
+ // Create the main core export object (following titan-valid pattern)
219
+ const core = {
220
+ fs,
221
+ path,
222
+ crypto,
223
+ os,
224
+ net,
225
+ proc,
226
+ time,
227
+ url
228
+ };
229
+
230
+
231
+ t.fs = fs;
232
+ t.path = path;
233
+ t.crypto = crypto;
234
+ t.os = os;
235
+ t.net = net;
236
+ t.proc = proc;
237
+ t.time = time;
238
+ t.url = url;
239
+
240
+ // Attach core as unified namespace (main access point)
241
+ t.core = core;
242
+
243
+ // Register as extension under multiple names for compatibility
244
+ t["titan-core"] = core;
245
+ t["@titanpl/core"] = core;
246
+
247
+ // Also register in t.exts
248
+ if (!t.exts) t.exts = {};
249
+ t.exts["titan-core"] = core;
250
+ t.exts["@titanpl/core"] = core;
@@ -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,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012 Paul Miller (https://paulmillr.com), Elan Shanker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.