Skip to main content

generateGraph

@webda/mock


Function: generateGraph()

generateGraph(spec, options?): Promise<Record<string, unknown[]>>

Defined in: engine/graph.ts:22

Generate instances of multiple models in the order given, reusing the same seeded RNG and session pool so that later models can reference earlier instances (when/if the callers' models support

Parameters​

spec​

Record<string, number>

{ ModelName: count }

options?​

GenerateOptions & object = ...

shared generation options plus the model classes in the order they should be generated.

Returns​

Promise<Record<string, unknown[]>>

a map of model name → generated instances (empty array for models not listed in spec).

/

style fields resolving against the pool).

For v1 the order is the caller-declared options.models order. A future version may add a topological-sort step based on declared relations.