@rljson/edge 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/edge.d.ts ADDED
@@ -0,0 +1,62 @@
1
+ import { ECarWorld } from './car-world/car-world.ts';
2
+ import { EConfig, EResolvedConfig } from './config/config.ts';
3
+ import { EPresetName } from './config/presets.ts';
4
+ import { EEstimate } from './core/estimate.ts';
5
+ import { ESink } from './core/sink.ts';
6
+ /** What a run produced */
7
+ export interface EStats extends EEstimate {
8
+ /** How long the run took, in milliseconds */
9
+ durationMs: number;
10
+ /** The share of produced rows that equalled an earlier row and were dropped */
11
+ dedupRatio: number;
12
+ }
13
+ /**
14
+ * Edge, the example data generator for Rljson.
15
+ *
16
+ * Edge builds a car world: manufacturers with catalogs of cars, and for every
17
+ * car a price, a brand, a workshop, a bill of materials and a CAD scene. The
18
+ * world uses components, slice ids, layers, cakes, trees, revisions and table
19
+ * configurations. Nothing is random: the same configuration yields the same
20
+ * data and the same hashes, everywhere.
21
+ */
22
+ export declare class Edge {
23
+ /**
24
+ * Constructor
25
+ * @param config - The configuration; every field has a default
26
+ */
27
+ constructor(config?: EConfig);
28
+ /**
29
+ * Creates a generator from a preset.
30
+ * @param name - tiny, small, medium, large or xl
31
+ * @param overrides - Settings that replace parts of the preset
32
+ */
33
+ static preset(name: EPresetName, overrides?: EConfig): Edge;
34
+ /** Returns an example instance for test purposes: the tiny preset */
35
+ static get example(): Edge;
36
+ /** Calculates how big the world will be, without generating a row */
37
+ estimate(): EEstimate;
38
+ /**
39
+ * Generates the world in memory and returns it with the statistics of the
40
+ * run. This is the default way to use Edge and fits worlds up to the medium
41
+ * preset.
42
+ */
43
+ generate(): Promise<{
44
+ world: ECarWorld;
45
+ stats: EStats;
46
+ }>;
47
+ /**
48
+ * Generates the world and hands every row to a sink, in the order of the
49
+ * references. Nothing is kept. Without a sink the rows are dropped, which
50
+ * serves benchmarks and progress tests.
51
+ * @param sink - Receives the rows
52
+ */
53
+ run(sink?: ESink): Promise<EStats>;
54
+ /** The configuration with every default filled in */
55
+ readonly config: EResolvedConfig;
56
+ }
57
+ /**
58
+ * Merges overrides into a configuration, section by section.
59
+ * @param base - The configuration to start from
60
+ * @param overrides - The settings that replace parts of it
61
+ */
62
+ export declare const mergeConfigs: (base: EConfig, overrides: EConfig) => EConfig;