teodevgroup / teo Goto Github PK
View Code? Open in Web Editor NEWSchema-driven web server framework.
Home Page: https://teodev.io
License: Apache License 2.0
Schema-driven web server framework.
Home Page: https://teodev.io
License: Apache License 2.0
Can I try to implement these two pipelines? I feel that this is similar to the implementation of Ellipsis
.
teo-generator-0.2.15/src/entity/generators/rust/gen.rs:120:14:
explicit panic
stack backtrace:
0: 0x101a01b40 - std::backtrace_rs::backtrace::libunwind::trace::hadefa2fe489b32be
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x101a01b40 - std::backtrace_rs::backtrace::trace_unsynchronized::h37e8bb3c3fd9c67c
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x101a01b40 - std::sys_common::backtrace::_print_fmt::h4994a90b70e9aaa7
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
3: 0x101a01b40 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb478ebbfb46e27ce
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
4: 0x101a24cc4 - core::fmt::rt::Argument::fmt::hfe2e626e52db21d5
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
5: 0x101a24cc4 - core::fmt::write::he4d5fa2daff1f531
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
6: 0x1019fe63c - std::io::Write::write_fmt::hc5a47a68eba63d9f
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
7: 0x101a01974 - std::sys_common::backtrace::_print::hd47355bf70e1c2da
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
8: 0x101a01974 - std::sys_common::backtrace::print::h79bd952cc5812e7a
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
9: 0x101a02f00 - std::panicking::default_hook::{{closure}}::h82301f6222887737
10: 0x101a02c48 - std::panicking::default_hook::h1e49abbb3f1d7dbf
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
11: 0x101a03348 - std::panicking::rust_panic_with_hook::h1e70c5d905e30e9d
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:779:13
12: 0x101a0323c - std::panicking::begin_panic_handler::{{closure}}::h399e32952efd26a4
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
13: 0x101a01fc4 - std::sys_common::backtrace::__rust_end_short_backtrace::h2ab87f841a2323e7
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
14: 0x101a02fc4 - rust_begin_unwind
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
15: 0x101a75d70 - core::panicking::panic_fmt::h33e40d2a93cab78f
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
16: 0x101a75ec0 - core::panicking::panic_display::h3147bab0bf654774
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:196:5
17: 0x101a75ec0 - core::panicking::panic_explicit::h8cbc9a9d78eb70c9
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:179:5
18: 0x101a37e58 - teo_generator::entity::generators::rust::gen::fix_path::panic_cold_explicit::he1d2df2942da2968
19: 0x1009d5ff4 - teo_generator::entity::generators::rust::gen::fix_path::h67395fca0319a153
20: 0x1009d968c - <teo_generator::entity::generators::rust::gen::RustModuleTemplate as askama::Template>::render_into::h32dc7173e8be20a0
21: 0x1009d75a4 - teo_generator::entity::generators::rust::gen::RustGenerator::generate_module_file::{{closure}}::ha3fad67817939245
22: 0x1009df690 - teo_generator::entity::generators::rust::gen::RustGenerator::generate_module_for_namespace::{{closure}}::h596ab4a2f954a28b
23: 0x1009e02f0 - <teo_generator::entity::generators::rust::gen::RustGenerator as teo_generator::entity::generator::Generator>::generate_entity_files::{{closure}}::h060a7220c0b2810a
24: 0x10074dc20 - teo_generator::entity::generate::{{closure}}::h254070df42dcdd42
25: 0x10078d16c - tokio::runtime::park::CachedParkThread::block_on::{{closure}}::hfd6702ef6c1e0538
26: 0x10078bb7c - tokio::runtime::park::CachedParkThread::block_on::h83b8fe96e738f193
27: 0x1008074c4 - tokio::runtime::context::runtime::enter_runtime::hce168625ef49dbed
28: 0x100862914 - tokio::runtime::runtime::Runtime::block_on::h9a47f25ac8f88ec6
29: 0x10091badc - cargo_teo::main::h3f6e6c228c0ab3dd
30: 0x1008fe4c4 - std::sys_common::backtrace::__rust_begin_short_backtrace::hedcae39fbf3d0e3a
31: 0x10087dc58 - std::rt::lang_start::{{closure}}::hb16fb0e40d873756
32: 0x1019f7afc - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hde2a2ae1d756c37f
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
33: 0x1019f7afc - std::panicking::try::do_call::h96b73f4da16ee7c5
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
34: 0x1019f7afc - std::panicking::try::h2cb0c14c1266f147
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
35: 0x1019f7afc - std::panic::catch_unwind::hb8cd2580f659030d
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
36: 0x1019f7afc - std::rt::lang_start_internal::{{closure}}::h00f9c2d0117ea0ef
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
37: 0x1019f7afc - std::panicking::try::do_call::h134dfd8876bcc105
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
38: 0x1019f7afc - std::panicking::try::h6595e056250d6043
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
39: 0x1019f7afc - std::panic::catch_unwind::haad85d5172c9b53a
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
40: 0x1019f7afc - std::rt::lang_start_internal::hf4f3eb1e51305b96
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
41: 0x10091bbdc - _main
As a rapid development framework of this kind, I think common authentication and authorization support should be added
I will complete these two.
-s, --schema <SCHEMA_FILE> The schema file to load
enum Sex {
/// @name xxx
MALE
/// @name xxx
FEMALE
}
I'd like request the addition of plugin support for other editors, specifically Zed and Neovim.
Currently, Teo offers plugins for VS Code, which is fantastic. However, expanding support to other popular editors like Zed and Neovim would greatly benefit users who prefer these environments. Both Zed and Neovim have a strong user base and are known for their flexibility and efficiency in coding workflow
Thank you for considering this feature request. I believe it will significantly enhance the usability and popularity of Teo across diverse coding environments.
rust version:1.75.0
when I operate by this guide:
https://teocloud.io/docs/getting-started/beginner-tutorial/write-a-schema-only-app
I use cargo teo serve
to start the project, but it quit quickly, just print log below:
[2024-01-23 08:02:33] sqlite connector connected for main
at "sqlite::memory:"
I change database by postgres, and I get the same result:
[2024-01-23 07:58:23] postgres connector connected for main
at "postgres://postgres:[email protected]:5432/helloteo"
Hi @victorteokw
As of today, it started giving errors during build.
error[E0275]: overflow evaluating the requirement `namespace::Namespace: std::fmt::Debug`
--> teo-runtime/src/namespace/mod.rs:45:10
|
45 | #[derive(Educe)]
| ^^^^^
|
= note: required for `BTreeMap<std::string::String, namespace::Namespace>` to implement `std::fmt::Debug`
= help: see issue #48214
= note: this error originates in the derive macro `Educe` (in Nightly builds, run with -Z macro-backtrace for more info)
when I use example from https://teocloud.io/docs/getting-started/beginner-tutorial/write-a-schema-only-app
error:
[2023-12-29 02:09:43] postgres connector connected for `main` at "postgres://postgres:postgres@teo-db:5432/helloteo"
thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/teo-0.0.64/src/seeder/seed.rs:643:28:
called `Result::unwrap()` on an `Err` value: : unknown database find error: Error { kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42601), message: "syntax error at or near \")\"", detail: None, hint: None, position: Some(Original(43)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("scan.l"), line: Some(1241), routine: Some("scanner_yyerror") }) }), original_code: Some("42601"), original_message: Some("db error: ERROR: syntax error at or near \")\"") }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
teo version:
teo Teo 0.0.64 (Rust 1.74.1) [CLI]
Hi, can you support BigQuery?
First - thx for this great project - i like it very much!
By trying Generate admin dashboard from the tutorial i get an error at
cargo teo generate admin
Error: Error { code: 500, message: "error decoding response body", errors: None, platform_native_object: None }
Backend ist up and running
cargo teo serve
[2024-06-12 08:18:41] sqlite connector connected for main
at "sqlite:./database.sqlite"
[2024-06-12 08:18:41] Teo 0.2.35 (Rust 1.78.0, CLI)
[2024-06-12 08:18:41] listening on port 5054
This seems due to some kind of misffits in the serde json deserialization of the repsonse body?
Currently only lines of file names are logged. Make it looks great.
I'm exploring the use of Teo for server-side rendering (SSR), and I'm curious to know if it supports SSR for frameworks like Astro or Vue. Specifically, I'm interested in implementing this functionality in Rust and Python. Has anyone already implemented SSR for these frameworks within Teo, or are there any related documentation or tutorials available for reference?
I have a idea.
Many of our users have databases that have been running for several years.
We are wondering if we could develop a feature similar to teo-generate-scheme-from-db
.
This would not only allow new projects to use teo
without starting from scratch,
but also provide a basic interface for older projects.
There is a command in API documentation, which corresponds to a CLI concept
Hi @victorteokw
I would like to receive information about user security. You use jwt token for the user login part and we need to keep it on localstorage. Localstorage is open to XSS attacks, how can we ensure this security? Does calling and checking user information for each handler along with the token ensure security? Of course, permission will be set for user information. Can you suggest a different method? Or wouldn't it make more sense to use cookie auth? When I examine the system, it seems like a lot of settings need to be made for cookie auth, maybe I'm thinking wrong. I want to ensure user security. I hope you can help with this.
Thanks
Hello, I had a few questions about the system.
Thanks
how can i use python with teo
While reviewing the sample codes, I got an error again.
@map(path: "/upload")
declare form handler upload(UploadInput): Data<UploadOutput>
interface UploadInput {
file: File
}
interface UploadOutput {
path: String
}
It gives an error after the entity is created.
error[E0599]: no function or associated item named `from_value_ref` found for struct `teo::prelude::File` in the current scope
--> src/entities/mod.rs:16999:15
|
16999 | File::from_value_ref(self.inner().get("file").unwrap()).unwrap()
| ^^^^^^^^^^^^^^ function or associated item not found in `File`
I also want to use a structure like this as a field in the schema file. But it also gives errors.
@relation(fields: .id, references: .id)
contacts: User[]?
error[E0609]: no field `inner` on type `Vec<User>`
--> src/entities/mod.rs:13500:77
|
13500 | self.inner.force_set_relation_object("contacts", contacts.map(|o| o.inner.clone())).await
| ^^^^^ unknown field
Hi @victorteokw
I was reviewing the documents you prepared, but I'm getting an error at one point. I get errors in the codes at this address "https://docs.teodev.io/getting-started/beginner-tutorial/implement-authentication#phone-number-and-auth-code".
When I first run the code I don't get any errors. But when I restart the system it gives an error.
db provider postgresql
schema.teo
connector {
provider: .postgres,
url: "postgres://user:password@localhost:5432/deneme"
}
server {
bind: ("0.0.0.0", 5052)
}
entity {
provider: .rust,
dest: "./src/entities"
}
declare pipeline item validateAuthCode<T>: T -> String
@identity.tokenIssuer($identity.jwt(expired: $get(.expired).presents))
@identity.jwtSecret(ENV["JWT_SECRET"]!)
@identity.validateAccount(
$message($get(.enabled).presents.eq(true), "this account is blocked"))
model User {
@id @autoIncrement @readonly
id: Int
@unique @onSet($if($presents, $isEmail)) @identity.id
@presentWithout(.phoneNumber)
email: String?
@writeonly @onSet($presents.bcrypt.salt)
@identity.checker(
$do($get(.value).presents.bcrypt.verify($self.get(.password).presents))
.do($get(.companions).presents.get(.imageAuthToken).presents))
password: String?
@virtual @writeonly @identity.companion
imageAuthToken: String?
@virtual @writeonly @identity.companion
expired: Int64?
@migration(default: true) @default(true)
enabled: Bool
@identity.id @unique
thirdPartyId: String?
@virtual @writeonly @identity.checker($get(.value).presents.valid)
thirdPartyToken: String?
@onSet($if($presents, $regexMatch(/\\+?[0-9]+/))) @identity.id
@presentWithout(.email) @unique
phoneNumber: String?
@virtual @writeonly @identity.checker($validateAuthCode)
authCode: String?
include handler identity.signIn
include handler identity.identity
}
model AuthCode {
@id @autoIncrement @readonly
id: Int
@presentWithout(.phoneNumber) @unique
email: String?
@presentWithout(.email) @unique
phoneNumber: String?
@onSave($randomDigits(4))
code: String
}
middlewares [identity.identityFromJwt(secret: ENV["JWT_SECRET"]!)]
main.rs
pub mod entities;
use entities::{Teo, User};
use indexmap::indexmap;
use tokio::main;
use teo::prelude::{pipeline::item::validator::Validity, App, Result, Value, Error};
#[main]
async fn main() -> Result<()> {
let app = App::new()?;
app.main_namespace_mut().define_validator_pipeline_item("validateAuthCode", move |check_args: Value, user: User, teo: Teo| async move {
let mut finder = Value::Dictionary(indexmap!{});
let check_args = check_args.as_dictionary().unwrap();
let ids = check_args.get("ids").unwrap().as_dictionary().unwrap();
if ids.contains_key("email") {
finder.as_dictionary_mut().unwrap().insert("email".to_owned(), ids.get("email").unwrap().clone());
}
if ids.contains_key("phoneNumber") {
finder.as_dictionary_mut().unwrap().insert("phoneNumber".to_owned(), ids.get("phoneNumber").unwrap().clone());
}
let auth_code = teo.auth_code().find_unique(finder).await?;
match auth_code {
Some(auth_code) => if auth_code.code().as_str() == check_args.get("value").unwrap().as_str().unwrap() {
Ok::<Validity, Error>(Validity::Valid)
} else {
Ok(Validity::Invalid("auth code is wrong".to_owned()))
},
None => Ok(Validity::Invalid("auth code not found".to_owned()))
}
});
app.run().await
}
Error
thread 'main' panicked at /home/yakel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/teo-sql-connector-0.2.28/src/migration/migrate.rs:237:71:
called `Result::unwrap()` on an `Err` value: Error { kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E42601), message: "syntax error at or near \"`\"", detail: None, hint: None, position: Some(Original(13)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("scan.l"), line: Some(1176), routine: Some("scanner_yyerror") }) }), original_code: Some("42601"), original_message: Some("db error: ERROR: syntax error at or near \"`\"") }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
in the clickstart guide tye cargo
command is used. I believe it is from Rust, but don't know. Can you tell what is needed to download/install?
Hi @victorteokw
I was trying to try examples from the documentation. But at some point I get an error. It gives an error in the fullName section.
model User {
firstName: String
lastName: String
@getter($self.get(.firstName).append(" ").append($self.get(.lastName)))
@setter($assign(.firstName, $split(" ").get(0)).assign(.lastName, $split(" ").get(1)))
fullName: String
}
Error: ./schema/index.teo:32:35 - 32:41
| @getter($self.get(.firstName).append(" ").append($self.get(.lastName)))
| ^^^^^^
callable variant not found for arguments
Error: ./schema/index.teo:32:54 - 32:74
| @getter($self.get(.firstName).append(" ").append($self.get(.lastName)))
| ^^^^^^^^^^^^^^^^^^^^
unexpected pipeline output: expect String, found String?
Error: ./schema/index.teo:32:47 - 32:53
| @getter($self.get(.firstName).append(" ").append($self.get(.lastName)))
| ^^^^^^
callable variant not found for arguments
Error: ./schema/index.teo:33:33 - 33:51
| @setter($assign(.firstName, $split(" ").get(0)).assign(.lastName, $split(" ").get(1)))
| ^^^^^^^^^^^^^^^^^^
unexpected pipeline output: expect String, found String?
Error: ./schema/index.teo:33:71 - 33:89
| @setter($assign(.firstName, $split(" ").get(0)).assign(.lastName, $split(" ").get(1)))
| ^^^^^^^^^^^^^^^^^^
unexpected pipeline output: expect String, found String?
Add teo run --list
command to list user defined programs onto the terminal.
The current is "TEO Docs", the desired behavior is: "{{ article title }} | TEO Docs"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.