MCPcopy Create free account
hub / github.com/hashintel/hash / build_inputs

Function build_inputs

libs/@local/hashql/eval/tests/orchestrator/inputs.rs:231–340  ·  view source on GitHub ↗

Builds the shared input set from seeded entity data and axis directives. Constructs interpreter [`Value`]s directly from the Rust-typed seed data, mirroring the opaque wrapping structure of the HashQL type system (e.g. `EntityId(Struct { web_id: WebId(ActorGroupEntityUuid(Uuid(String))), ... })`). The input names match what J-Expr test files reference via `["input", " ", " "]`.

(
    heap: &'heap Heap,
    symbols: &InternSet<'heap, [Symbol<'heap>]>,
    entities: &SeededEntities,
    directives: &AxisDirectives,
)

Source from the content-addressed store, hash-verified

229/// The input names match what J-Expr test files reference via
230/// `["input", "<name>", "<type>"]`.
231pub(crate) fn build_inputs<'heap>(
232 heap: &'heap Heap,
233 symbols: &InternSet<'heap, [Symbol<'heap>]>,
234 entities: &SeededEntities,
235 directives: &AxisDirectives,
236) -> Inputs<'heap, &'heap Heap> {
237 let mut inputs = Inputs::new_in(heap);
238
239 let string = |value: &str| value::Value::String(value::Str::from(Rc::from_in(value, heap)));
240
241 let uuid = |value: Uuid| {
242 value::Value::Opaque(value::Opaque::new(
243 sym::path::Uuid,
244 Rc::new_in(string(value.to_string().as_str()), heap),
245 ))
246 };
247
248 let entity_uuid = |value: EntityUuid| {
249 value::Value::Opaque(value::Opaque::new(
250 sym::path::EntityUuid,
251 Rc::new_in(uuid(value.into()), heap),
252 ))
253 };
254
255 let actor_group_entity_uuid = |value: ActorGroupEntityUuid| {
256 value::Value::Opaque(value::Opaque::new(
257 sym::path::ActorGroupEntityUuid,
258 Rc::new_in(uuid(value.into()), heap),
259 ))
260 };
261
262 let web_id = |value: WebId| {
263 value::Value::Opaque(value::Opaque::new(
264 sym::path::WebId,
265 Rc::new_in(actor_group_entity_uuid(value.into()), heap),
266 ))
267 };
268
269 let draft_id = |value: Option<type_system::knowledge::entity::id::DraftId>| {
270 option(heap, value, |heap, value| {
271 value::Value::Opaque(value::Opaque::new(
272 sym::path::DraftId,
273 Rc::new_in(uuid(value.into()), heap),
274 ))
275 })
276 };
277
278 let entity_id = |value: type_system::knowledge::entity::id::EntityId| {
279 let mut builder = StructBuilder::<_, 3>::new();
280 builder.push(sym::web_id, web_id(value.web_id));
281 builder.push(sym::entity_uuid, entity_uuid(value.entity_uuid));
282 builder.push(sym::draft_id, draft_id(value.draft_id));
283
284 let r#struct = builder.finish(symbols, heap);
285 let inner = value::Value::Struct(r#struct);
286 value::Value::Opaque(value::Opaque::new(
287 sym::path::EntityId,
288 Rc::new_in(inner, heap),

Callers 2

run_jexpr_testFunction · 0.85
run_programmatic_testFunction · 0.85

Calls 15

StringClass · 0.85
actor_group_entity_uuidFunction · 0.85
web_idFunction · 0.85
entity_uuidFunction · 0.85
draft_idFunction · 0.85
entity_idFunction · 0.85
optionFunction · 0.70
pushMethod · 0.65
fromFunction · 0.50
OpaqueClass · 0.50
stringFunction · 0.50

Tested by

no test coverage detected