Skip to content

Commit

Permalink
wip: new architecture
Browse files Browse the repository at this point in the history
[skip CI]
  • Loading branch information
luckasRanarison committed Oct 17, 2024
1 parent bcb9bb6 commit 3b15fe7
Show file tree
Hide file tree
Showing 10 changed files with 1,119 additions and 219 deletions.
609 changes: 396 additions & 213 deletions src/typegraph/core/src/lib.rs

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions src/typegraph/core/src/runtimes/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::{
core::{MaterializerId, RuntimeId},
runtimes::Effect,
},
AwsHandler, TypegraphState,
};

use super::{Materializer, Runtime};
Expand Down Expand Up @@ -171,3 +172,37 @@ pub fn s3_upload_all(runtime: RuntimeId, bucket: String) -> Result<MaterializerI
);
Ok(Store::register_materializer(mat))
}

// impl AwsHandler for TypegraphState {
// fn register_s3_runtime(&mut self, data: S3RuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn s3_presign_get(
// &mut self,
// runtime: RuntimeId,
// params: S3PresignGetParams,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn s3_presign_put(
// &mut self,
// runtime: RuntimeId,
// params: S3PresignPutParams,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn s3_list(&mut self, runtime: RuntimeId, bucket: String) -> Result<MaterializerId> {
// todo!()
// }
//
// fn s3_upload(&mut self, runtime: RuntimeId, bucket: String) -> Result<MaterializerId> {
// todo!()
// }
//
// fn s3_upload_all(&mut self, runtime: RuntimeId, bucket: String) -> Result<MaterializerId> {
// todo!()
// }
// }
340 changes: 339 additions & 1 deletion src/typegraph/core/src/runtimes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::{cell::RefCell, rc::Rc};
use enum_dispatch::enum_dispatch;
use substantial::SubstantialMaterializer;

use crate::{errors::Result, global_store::Store};
use crate::{errors::Result, global_store::Store, TypegraphState};

use crate::types::{
aws::S3RuntimeData,
Expand Down Expand Up @@ -244,3 +244,341 @@ pub fn register_typegraph_materializer(operation: TypegraphOperation) -> Result<
Effect::Read,
)))
}

// impl RuntimeHandler for TypegraphState {
// fn get_deno_runtime(&self) -> RuntimeId {
// todo!()
// }
//
// fn register_deno_func(
// &mut self,
// data: MaterializerDenoFunc,
// effect: Effect,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_deno_static(
// &mut self,
// data: MaterializerDenoStatic,
// effect: Effect,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn get_predefined_deno_func(
// &mut self,
// data: MaterializerDenoPredefined,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn import_deno_function(
// &mut self,
// data: rt::MaterializerDenoImport,
// effect: Effect,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_graphql_runtime(&mut self, data: GraphqlRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn graphql_query(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerGraphqlQuery,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn graphql_mutation(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerGraphqlQuery,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_http_runtime(&mut self, data: HttpRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn http_request(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerHttpRequest,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_python_runtime(&mut self) -> Result<RuntimeId> {
// todo!()
// }
//
// fn from_python_lambda(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerPythonLambda,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn from_python_def(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerPythonDef,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn from_python_module(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerPythonModule,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn from_python_import(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerPythonImport,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_random_runtime(&mut self, data: RandomRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn create_random_mat(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerRandom,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_wasm_reflected_runtime(&mut self, data: WasmRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn register_wams_wire_runtime(&mut self, data: WasmRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn from_wasm_reflected_func(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerWasmReflectedFunc,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn from_wasm_wire_handler(
// &mut self,
// base: BaseMaterializer,
// data: MaterializerWasmWireHandler,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_prisma_runtime(&mut self, data: PrismaRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn prisma_find_unique(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_find_many(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_find_first(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_aggregate(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_count(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_group_by(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_create_one(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_create_many(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_update_one(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_update_many(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_upsert_one(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_delete_one(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_delete_many(
// &mut self,
// runtime: RuntimeId,
// model: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_execute(
// &mut self,
// runtime: RuntimeId,
// query: String,
// param: crate::types::core::TypeId,
// effect: Effect,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_query_raw(
// &mut self,
// runtime: RuntimeId,
// query: String,
// param: Option<crate::types::core::TypeId>,
// out: crate::types::core::TypeId,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn prisma_link(&mut self, data: PrismaLinkData) -> Result<crate::types::core::TypeId> {
// todo!()
// }
//
// fn prisma_migration(
// &mut self,
// operation: PrismaMigrationOperation,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn register_temporal_runtime(&mut self, data: TemporalRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn generate_temporal_operation(
// &mut self,
// runtime: RuntimeId,
// data: TemporalOperationData,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn register_typegate_materializer(
// &mut self,
// operation: rt::TypegateOperation,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_typegraph_materializer(
// &mut self,
// operation: TypegraphOperation,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn generate_substantial_operation(
// &mut self,
// runtime: RuntimeId,
// data: SubstantialOperationData,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
//
// fn register_kv_runtime(&mut self, data: KvRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn kv_operation(
// &mut self,
// base: BaseMaterializer,
// data: KvMaterializer,
// ) -> Result<MaterializerId> {
// todo!()
// }
//
// fn register_grpc_runtime(&mut self, data: GrpcRuntimeData) -> Result<RuntimeId> {
// todo!()
// }
//
// fn call_grpc_method(
// &mut self,
// runtime: RuntimeId,
// data: GrpcData,
// ) -> Result<crate::types::core::FuncParams> {
// todo!()
// }
// }
Loading

0 comments on commit 3b15fe7

Please sign in to comment.