1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Hyperstack stream processing module.
//!
//! This module handles the processing of `#[hyperstack]` macro attributes,
//! converting entity struct definitions into stream specifications.
//!
//! ## Module Structure
//!
//! - `module` - Entry point for module-level macro processing
//! - `entity` - Core entity struct processing logic (2,072 LOC)
//! - `handlers` - Handler generation for events and resolvers (559 LOC)
//! - `sections` - Nested struct and section processing (464 LOC)
//! - `computed` - Computed field expression parsing (461 LOC)
//! - `ast_writer` - AST JSON file generation at compile time (620 LOC)
//! - `idl_spec` - IDL-based stream processing (~300 LOC)
//! - `proto_struct` - Proto-based struct processing (~380 LOC)
//!
//! ## Processing Flow
//!
//! 1. `process_module` receives a module with `#[hyperstack]` attribute
//! 2. Parses IDL or proto files based on attribute arguments
//! 3. Processes each entity struct to extract field mappings
//! 4. Generates handler functions for each source type
//! 5. Writes AST JSON file for runtime consumption
//! 6. Returns generated code including state struct and spec function
//!
//! ## Example
//!
//! ```rust,ignore
//! #[hyperstack(idl = "idl.json")]
//! pub mod my_stream {
//! #[entity(name = "MyEntity")]
//! struct MyEntity {
//! #[map(from = MyAccount::mint, primary_key)]
//! pub mint: String,
//! }
//! }
//! ```
pub
// Re-export module processing functions (used by lib.rs)
pub use process_module;
// Re-export proto struct processing (used by lib.rs)
pub use process_struct_with_context;
/// Resolves the source field name and whether this is a whole-source capture
/// based on the `field` and `field_transforms` parameters.