@ezetgalaxy/titan 26.8.2 → 26.9.0
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 +65 -25
- package/index.js +62 -15
- package/package.json +2 -2
- package/templates/extension/README.md +104 -104
- package/templates/extension/index.js +27 -27
- package/templates/extension/jsconfig.json +12 -12
- package/templates/extension/native/Cargo.toml +9 -9
- package/templates/extension/native/src/lib.rs +5 -5
- package/templates/extension/package.json +20 -20
- package/templates/extension/titan.json +17 -17
- package/templates/js/Dockerfile +66 -66
- package/templates/js/_dockerignore +3 -3
- package/templates/js/_gitignore +1 -0
- package/templates/js/app/actions/hello.js +5 -5
- package/templates/js/app/titan.d.ts +87 -87
- package/templates/js/jsconfig.json +18 -18
- package/templates/js/server/src/action_management.rs +131 -131
- package/templates/js/server/src/errors.rs +10 -10
- package/templates/js/server/src/extensions.rs +989 -989
- package/templates/js/server/src/utils.rs +33 -33
- package/templates/js/titan/bundle.js +78 -78
- package/templates/js/titan/dev.js +35 -3
- package/templates/js/titan/titan.js +122 -122
- package/templates/rust/Dockerfile +66 -66
- package/templates/rust/_dockerignore +3 -3
- package/templates/rust/_gitignore +1 -0
- package/templates/rust/app/actions/hello.js +5 -5
- package/templates/rust/app/actions/rust_hello.rs +14 -14
- package/templates/rust/app/titan.d.ts +101 -101
- package/templates/rust/jsconfig.json +18 -18
- package/templates/rust/server/src/action_management.rs +131 -131
- package/templates/rust/server/src/errors.rs +10 -10
- package/templates/rust/server/src/extensions.rs +989 -989
- package/templates/rust/server/src/utils.rs +33 -33
- package/templates/rust/titan/dev.js +36 -12
- package/templates/rust-ts/Dockerfile +66 -0
- package/templates/rust-ts/_dockerignore +3 -0
- package/templates/rust-ts/_gitignore +38 -0
- package/templates/rust-ts/app/actions/hello.ts +5 -0
- package/templates/rust-ts/app/actions/rust_hello.rs +14 -0
- package/templates/rust-ts/app/app.ts +11 -0
- package/templates/rust-ts/app/titan.d.ts +101 -0
- package/templates/rust-ts/package.json +14 -0
- package/templates/rust-ts/server/Cargo.lock +2869 -0
- package/templates/rust-ts/server/Cargo.toml +39 -0
- package/templates/rust-ts/server/src/action_management.rs +131 -0
- package/templates/rust-ts/server/src/errors.rs +51 -0
- package/templates/rust-ts/server/src/extensions.rs +989 -0
- package/templates/rust-ts/server/src/main.rs +468 -0
- package/templates/rust-ts/server/src/utils.rs +33 -0
- package/templates/rust-ts/titan/bundle.js +157 -0
- package/templates/rust-ts/titan/dev.js +402 -0
- package/templates/rust-ts/titan/titan.js +122 -0
- package/templates/rust-ts/tsconfig.json +21 -0
- package/templates/ts/Dockerfile +66 -0
- package/templates/ts/_dockerignore +3 -0
- package/templates/ts/_gitignore +38 -0
- package/templates/ts/app/actions/hello.ts +9 -0
- package/templates/ts/app/app.ts +10 -0
- package/templates/ts/app/titan.d.ts +102 -0
- package/templates/ts/package.json +26 -0
- package/templates/ts/server/Cargo.lock +2869 -0
- package/templates/ts/server/Cargo.toml +27 -0
- package/templates/ts/server/src/action_management.rs +131 -0
- package/templates/ts/server/src/errors.rs +51 -0
- package/templates/ts/server/src/extensions.rs +989 -0
- package/templates/ts/server/src/main.rs +437 -0
- package/templates/ts/server/src/utils.rs +33 -0
- package/templates/ts/titan/bundle.js +78 -0
- package/templates/ts/titan/dev.js +402 -0
- package/templates/ts/titan/titan.js +122 -0
- package/templates/ts/tsconfig.json +16 -0
- package/titanpl-sdk/README.md +109 -109
- package/titanpl-sdk/bin/run.js +254 -254
- package/titanpl-sdk/index.d.ts +46 -46
- package/titanpl-sdk/index.js +5 -5
- package/titanpl-sdk/package.json +32 -32
- package/titanpl-sdk/templates/.dockerignore +3 -3
- package/titanpl-sdk/templates/Dockerfile +53 -53
- package/titanpl-sdk/templates/app/actions/hello.js +5 -5
- package/titanpl-sdk/templates/app/titan.d.ts +87 -87
- package/titanpl-sdk/templates/jsconfig.json +18 -18
- package/titanpl-sdk/templates/server/src/action_management.rs +131 -131
- package/titanpl-sdk/templates/server/src/errors.rs +10 -10
- package/titanpl-sdk/templates/server/src/extensions.rs +640 -640
- package/titanpl-sdk/templates/server/src/utils.rs +33 -33
- package/titanpl-sdk/templates/titan/bundle.js +65 -65
- package/titanpl-sdk/templates/titan/dev.js +113 -113
- package/titanpl-sdk/templates/titan/titan.js +98 -98
- package/templates/js/server/action_map.json +0 -3
- package/templates/js/server/actions/hello.jsbundle +0 -48
- package/templates/js/server/routes.json +0 -16
- package/templates/rust/server/action_map.json +0 -3
- package/templates/rust/server/actions/hello.jsbundle +0 -47
- package/templates/rust/server/routes.json +0 -22
- package/templates/rust/server/src/actions_rust/mod.rs +0 -19
- package/templates/rust/server/src/actions_rust/rust_hello.rs +0 -14
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const defineAction = (fn) => fn;
|
|
2
|
-
var __titan_exports = (() => {
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// app/actions/hello.js
|
|
22
|
-
var hello_exports = {};
|
|
23
|
-
__export(hello_exports, {
|
|
24
|
-
hello: () => hello
|
|
25
|
-
});
|
|
26
|
-
var hello = () => {
|
|
27
|
-
const valid = "hii";
|
|
28
|
-
t.log(valid);
|
|
29
|
-
};
|
|
30
|
-
return __toCommonJS(hello_exports);
|
|
31
|
-
})();
|
|
32
|
-
|
|
33
|
-
(function () {
|
|
34
|
-
const fn =
|
|
35
|
-
__titan_exports["hello"] ||
|
|
36
|
-
__titan_exports.default;
|
|
37
|
-
|
|
38
|
-
if (typeof fn !== "function") {
|
|
39
|
-
throw new Error("[Titan] Action 'hello' not found or not a function");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
globalThis["hello"] = function(request_arg) {
|
|
43
|
-
globalThis.req = request_arg;
|
|
44
|
-
return fn(request_arg);
|
|
45
|
-
};
|
|
46
|
-
})();
|
|
47
|
-
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"__config": {
|
|
3
|
-
"port": 3000
|
|
4
|
-
},
|
|
5
|
-
"routes": {
|
|
6
|
-
"GET:/rust": {
|
|
7
|
-
"type": "action",
|
|
8
|
-
"value": "rust_hello"
|
|
9
|
-
},
|
|
10
|
-
"GET:/": {
|
|
11
|
-
"type": "text",
|
|
12
|
-
"value": "Ready to land on Titan Planet 🚀"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"__dynamic_routes": [
|
|
16
|
-
{
|
|
17
|
-
"method": "GET",
|
|
18
|
-
"pattern": "/hello/:id",
|
|
19
|
-
"action": "hello"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Auto-generated by Titan. Do not edit.
|
|
2
|
-
use axum::response::IntoResponse;
|
|
3
|
-
use axum::http::Request;
|
|
4
|
-
use axum::body::Body;
|
|
5
|
-
use std::future::Future;
|
|
6
|
-
use std::pin::Pin;
|
|
7
|
-
|
|
8
|
-
pub mod rust_hello;
|
|
9
|
-
|
|
10
|
-
pub type ActionFn = fn(Request<Body>) -> Pin<Box<dyn Future<Output = axum::response::Response> + Send>>;
|
|
11
|
-
|
|
12
|
-
pub fn get_action(name: &str) -> Option<ActionFn> {
|
|
13
|
-
match name {
|
|
14
|
-
"rust_hello" => Some(|req| Box::pin(async move {
|
|
15
|
-
rust_hello::run(req).await.into_response()
|
|
16
|
-
})),
|
|
17
|
-
_ => None
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
use crate::extensions::t;
|
|
2
|
-
use axum::{response::{IntoResponse, Json}, http::Request, body::Body};
|
|
3
|
-
use serde_json::json;
|
|
4
|
-
|
|
5
|
-
pub async fn run(_req: Request<Body>) -> impl IntoResponse {
|
|
6
|
-
let _token = t.jwt.sign(json!({"id": 1}), "secret", Some(json!({"expiresIn": "1h"}))).unwrap_or_default();
|
|
7
|
-
let decoded = t.jwt.verify(&_token, "secret").unwrap_or_default();
|
|
8
|
-
Json(json!({
|
|
9
|
-
"message": "Hello from Rust Action! 🦀",
|
|
10
|
-
"status": "blazing fast test",
|
|
11
|
-
"token": _token,
|
|
12
|
-
"decoded": decoded
|
|
13
|
-
}))
|
|
14
|
-
}
|