@rljson/edge 0.0.0 → 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.
@@ -0,0 +1,40 @@
1
+ import { ECadConfig } from '../config/config.ts';
2
+ import { EEmitter } from '../core/emitter.ts';
3
+ import { EVariant } from './plan.ts';
4
+ /** What a scene builder needs */
5
+ export interface ESceneBuilderOptions {
6
+ /** Receives the rows */
7
+ emitter: EEmitter;
8
+ /** The CAD layer configuration */
9
+ config: Required<ECadConfig>;
10
+ /** Who the scene belongs to */
11
+ variant: EVariant;
12
+ /** The parts of the variant's bill of materials, for linking meshes */
13
+ partRefs: readonly string[];
14
+ }
15
+ /**
16
+ * Emits the scene of a variant as a tree, from the meshes up.
17
+ *
18
+ * Every node carries the variant in its meta data, so two variants never
19
+ * share a node. Nodes are numbered in the order they are emitted, children
20
+ * before their group. Build once per instance.
21
+ */
22
+ export declare class ESceneBuilder {
23
+ private readonly options;
24
+ /**
25
+ * Constructor
26
+ * @param options - The emitter, the CAD layer, the variant and its parts
27
+ */
28
+ constructor(options: ESceneBuilderOptions);
29
+ /** Emits the scene and returns the hash of its root */
30
+ build(): Promise<string>;
31
+ private index;
32
+ private system;
33
+ private components;
34
+ private details;
35
+ private group;
36
+ private mesh;
37
+ private node;
38
+ private meta;
39
+ private partRefOf;
40
+ }
@@ -0,0 +1,22 @@
1
+ import { TableCfg } from '@rljson/rljson';
2
+ import { ECarWorldTableKey } from './car-world.ts';
3
+ /** Returns the configuration of the manufacturers table: the root of the world */
4
+ export declare const manufacturersTableCfg: () => TableCfg;
5
+ /** Returns the configuration of the addresses table */
6
+ export declare const addressesTableCfg: () => TableCfg;
7
+ /** Returns the configuration of the persons table */
8
+ export declare const personsTableCfg: () => TableCfg;
9
+ /** Returns the configuration of the workshops table */
10
+ export declare const workshopsTableCfg: () => TableCfg;
11
+ /** Returns the configuration of the prices table */
12
+ export declare const pricesTableCfg: () => TableCfg;
13
+ /** Returns the configuration of the brands table */
14
+ export declare const brandsTableCfg: () => TableCfg;
15
+ /** Returns the configuration of the parts table */
16
+ export declare const partsTableCfg: () => TableCfg;
17
+ /** Returns the configuration of the revisions table */
18
+ export declare const revisionsTableCfg: () => TableCfg;
19
+ /** Returns the configuration of the tableCfgs table itself */
20
+ export declare const tableCfgsTableCfg: () => TableCfg;
21
+ /** Returns the configurations of all tables of a car world, by table key */
22
+ export declare const carWorldTableCfgs: () => Record<ECarWorldTableKey, TableCfg>;
@@ -0,0 +1,39 @@
1
+ import { EWorkshopsConfig } from '../config/config.ts';
2
+ import { EEmitter } from '../core/emitter.ts';
3
+ import { ECity } from '../dictionaries/places.ts';
4
+ import { EAddress, EPerson } from './car-world.ts';
5
+ /** The services a workshop can offer */
6
+ export declare const services: readonly string[];
7
+ /**
8
+ * Returns the address with an index in a city. Street and house number
9
+ * derive from the index, so no two indices share an address.
10
+ * @param city - The city
11
+ * @param index - Any non-negative index
12
+ */
13
+ export declare const addressRow: (city: ECity, index: number) => EAddress;
14
+ /**
15
+ * Returns the person with an index. The phone number makes every index a
16
+ * different person, even when the names repeat.
17
+ * @param index - Any non-negative index
18
+ * @param country - The country the phone number belongs to
19
+ */
20
+ export declare const personRow: (index: number, country: string) => EPerson;
21
+ /** What the workshops of a catalog depend on */
22
+ export interface EWorkshopsOptions {
23
+ /** Receives the rows */
24
+ emitter: EEmitter;
25
+ /** The workshops layer configuration */
26
+ config: Required<EWorkshopsConfig>;
27
+ /** The index of the manufacturer, for the owner pool */
28
+ manufacturerIndex: number;
29
+ /** The index of the catalog within the world */
30
+ catalogIndex: number;
31
+ /** The country of the manufacturer */
32
+ country: string;
33
+ }
34
+ /**
35
+ * Emits the workshops of a catalog with their addresses and owners, and
36
+ * returns the hashes of the workshops.
37
+ * @param options - The emitter, the layer and the catalog
38
+ */
39
+ export declare const generateWorkshops: (options: EWorkshopsOptions) => Promise<string[]>;
@@ -0,0 +1,177 @@
1
+ import { TableKey } from '@rljson/rljson';
2
+ /** Who shares a bill of materials or a CAD scene */
3
+ export type ESharing = 'perCar' | 'perModel' | 'perCatalog';
4
+ /** The prices layer */
5
+ export interface EPricesConfig {
6
+ /** The currencies; each catalog uses one of them. Default ['EUR'] */
7
+ currencies?: string[];
8
+ /** The range of the prices. Default 5 000 to 150 000 */
9
+ range?: {
10
+ min: number;
11
+ max: number;
12
+ };
13
+ /** Prices are rounded to a multiple of this. Default 10 */
14
+ roundTo?: number;
15
+ /** The share of cars with a discount, between 0 and 1. Default 0 */
16
+ discountShare?: number;
17
+ }
18
+ /** The brands layer */
19
+ export interface EBrandsConfig {
20
+ /** How many models of a manufacturer the cars use. Default 5 */
21
+ modelsPerManufacturer?: number;
22
+ /** How the cars spread over the models. Default 'uniform' */
23
+ popularity?: 'uniform' | 'zipf';
24
+ }
25
+ /** The workshops layer */
26
+ export interface EWorkshopsConfig {
27
+ /** How many workshops serve a catalog. Default 10 */
28
+ perCatalog?: number;
29
+ /** How many persons own the workshops of a manufacturer. Default 5 */
30
+ ownersPerManufacturer?: number;
31
+ }
32
+ /** The parts layer: bills of materials */
33
+ export interface EPartsConfig {
34
+ /** Levels below the bill of materials, 1 to 4. Default 4 */
35
+ depth?: 1 | 2 | 3 | 4;
36
+ /** Sub parts per part, 1 to 6. Default 3 */
37
+ fanOut?: number;
38
+ /** Who shares a bill of materials. Default 'perModel' */
39
+ sharing?: ESharing;
40
+ /** How many distinct standard parts the lowest level uses, 1 to 40. Default 20 */
41
+ standardPartsPool?: number;
42
+ }
43
+ /** The CAD layer: scenes as trees */
44
+ export interface ECadConfig {
45
+ /** Levels below the scene, 1 to 4. Default 3 */
46
+ depth?: 1 | 2 | 3 | 4;
47
+ /** Children per group, 1 to 6. Default 4 */
48
+ fanOut?: number;
49
+ /** Who shares a scene. Default 'perModel' */
50
+ sharing?: ESharing;
51
+ /** Whether a mesh refers to a part of the bill of materials. Default true */
52
+ linkToParts?: boolean;
53
+ }
54
+ /** The layers of every catalog. A layer set to false is left out. */
55
+ export interface ELayersConfig {
56
+ /** The prices of the cars */
57
+ prices?: EPricesConfig | false;
58
+ /** The brands and models of the cars */
59
+ brands?: EBrandsConfig | false;
60
+ /** The workshops that service the cars */
61
+ workshops?: EWorkshopsConfig | false;
62
+ /** The bills of materials of the cars */
63
+ parts?: EPartsConfig | false;
64
+ /** The CAD scenes of the cars */
65
+ cad?: ECadConfig | false;
66
+ }
67
+ /** Further model years of every catalog */
68
+ export interface ERevisionsConfig {
69
+ /** How many model years follow the first one. Default 0 */
70
+ count?: number;
71
+ /** The share of cars a model year adds, between 0 and 1. Default 0.2 */
72
+ addShare?: number;
73
+ /** The share of cars a model year removes, between 0 and 1. Default 0.1 */
74
+ removeShare?: number;
75
+ /** The share of cars whose price a model year changes, between 0 and 1. Default 0.2 */
76
+ changeShare?: number;
77
+ }
78
+ /** The progress of a run */
79
+ export interface EProgress {
80
+ /** The phase of the run, e.g. the table being generated */
81
+ phase: string;
82
+ /** The rows handed to the sink so far */
83
+ rowsDone: number;
84
+ /** The rows the run produces at most, from the estimate */
85
+ rowsTotal: number;
86
+ /** The table of the row that triggered the report, if any */
87
+ table?: TableKey;
88
+ }
89
+ /**
90
+ * The configuration of a car world.
91
+ *
92
+ * Every field has a default. Nothing is random: the same configuration yields
93
+ * the same data and the same hashes, on every machine.
94
+ */
95
+ export interface EConfig {
96
+ /** The manufacturers, the entry point of the world */
97
+ manufacturers?: {
98
+ /** How many manufacturers. Default 1 */
99
+ count?: number;
100
+ /** How many catalogs each manufacturer has. Default 1 */
101
+ catalogsPerManufacturer?: number;
102
+ };
103
+ /** The catalogs: cakes whose slices are cars */
104
+ catalogs?: {
105
+ /** How many cars a catalog lists, up to a million. Default 10 */
106
+ carsPerCatalog?: number;
107
+ /** The model year of the first version of every catalog. Default 2026 */
108
+ startYear?: number;
109
+ /** Further model years */
110
+ revisions?: ERevisionsConfig;
111
+ };
112
+ /** The layers of every catalog. A layer set to false is left out. */
113
+ layers?: ELayersConfig;
114
+ /** Lets Edge choose the cars per catalog for a number of rows */
115
+ scale?: {
116
+ /** The number of rows the world should have at most; null for no target */
117
+ targetRows?: number | null;
118
+ };
119
+ /** Receives the progress of a run */
120
+ progress?: (progress: EProgress) => void;
121
+ /** Report progress after every this many rows. Default 1000 */
122
+ progressEvery?: number;
123
+ /** Stops a run when aborted */
124
+ abortSignal?: AbortSignal;
125
+ }
126
+ /** The layers with every default filled in; a layer that is off stays false */
127
+ export interface EResolvedLayers {
128
+ prices: Required<EPricesConfig> | false;
129
+ brands: Required<EBrandsConfig> | false;
130
+ workshops: Required<EWorkshopsConfig> | false;
131
+ parts: Required<EPartsConfig> | false;
132
+ cad: Required<ECadConfig> | false;
133
+ }
134
+ /** The configuration with every default filled in */
135
+ export interface EResolvedConfig {
136
+ manufacturers: {
137
+ count: number;
138
+ catalogsPerManufacturer: number;
139
+ };
140
+ catalogs: {
141
+ carsPerCatalog: number;
142
+ startYear: number;
143
+ revisions: Required<ERevisionsConfig>;
144
+ };
145
+ layers: EResolvedLayers;
146
+ scale: {
147
+ targetRows: number | null;
148
+ };
149
+ progress?: (progress: EProgress) => void;
150
+ progressEvery: number;
151
+ abortSignal?: AbortSignal;
152
+ }
153
+ /** The deepest level below a bill of materials or a scene */
154
+ export declare const maxDepth = 4;
155
+ /** The most children a part or a group has: the dictionaries list six */
156
+ export declare const maxFanOut = 6;
157
+ /** The most cars a catalog may list */
158
+ export declare const maxCarsPerCatalog = 1000000;
159
+ /** Returns the defaults of every section */
160
+ export declare const edgeDefaults: () => EResolvedConfig;
161
+ /**
162
+ * Returns the fallback with every defined value of the overrides on top.
163
+ * A value that is undefined keeps its default.
164
+ * @param fallback - The defaults
165
+ * @param overrides - The values of the user, or undefined
166
+ */
167
+ export declare const withDefaults: <T extends object>(fallback: T, overrides: Partial<T> | undefined) => T;
168
+ /**
169
+ * Fills the defaults into a configuration and checks its values.
170
+ * @param config - The configuration of the user
171
+ */
172
+ export declare const resolveEdgeConfig: (config: EConfig) => EResolvedConfig;
173
+ /**
174
+ * Throws when a value of the configuration is out of range.
175
+ * @param config - The resolved configuration
176
+ */
177
+ export declare const validateEdgeConfig: (config: EResolvedConfig) => void;
@@ -0,0 +1,13 @@
1
+ import { EConfig } from './config.ts';
2
+ /** The names of the presets, from the smallest to the largest */
3
+ export declare const edgePresetNames: readonly ["tiny", "small", "medium", "large", "xl"];
4
+ /** The name of a preset */
5
+ export type EPresetName = (typeof edgePresetNames)[number];
6
+ /**
7
+ * Ready-made configurations.
8
+ *
9
+ * tiny and small fit unit and component tests, medium an integration test.
10
+ * large reaches more than 20 million rows by giving every car a bill of
11
+ * materials and a scene of its own; xl reaches 20 million cars.
12
+ */
13
+ export declare const edgePresets: Readonly<Record<EPresetName, EConfig>>;
@@ -0,0 +1,71 @@
1
+ import { Json } from '@rljson/json';
2
+ import { TableCfg, TableKey } from '@rljson/rljson';
3
+ import { EProgress } from '../config/config.ts';
4
+ import { ESink } from './sink.ts';
5
+ /** A row with the hash that hsh wrote into it */
6
+ export type EHashed<T extends Json> = T & {
7
+ _hash: string;
8
+ };
9
+ /** What an emitter needs */
10
+ export interface EEmitterOptions {
11
+ /** Receives the rows */
12
+ sink: ESink;
13
+ /** The number of rows the run will produce at most, from the estimate */
14
+ rowsTotal: number;
15
+ /** Report progress after every this many rows */
16
+ progressEvery: number;
17
+ /** Receives the progress */
18
+ progress?: (progress: EProgress) => void;
19
+ /** Stops the run when aborted */
20
+ abortSignal?: AbortSignal;
21
+ }
22
+ /**
23
+ * Hashes rows, drops duplicates and hands the rest to the sink.
24
+ *
25
+ * Equal content has an equal hash, so a row that was emitted before is not
26
+ * emitted again; the emitter keeps one set of hashes per table for that.
27
+ * The rows are handed over one after the other, and every handover is
28
+ * awaited: a row may only follow the rows it refers to, and a slow sink
29
+ * slows the generator down.
30
+ */
31
+ export declare class EEmitter {
32
+ private readonly options;
33
+ /**
34
+ * Constructor
35
+ * @param options - The sink and the progress settings
36
+ */
37
+ constructor(options: EEmitterOptions);
38
+ /**
39
+ * Announces a table: hands its configuration to the sink and writes the
40
+ * configuration into the tableCfgs table.
41
+ * @param tableCfg - The configuration of the table
42
+ */
43
+ table(tableCfg: TableCfg): Promise<EHashed<TableCfg>>;
44
+ /**
45
+ * Sets the phase of the run and reports it.
46
+ * @param phase - The name of the phase, e.g. the table being generated
47
+ */
48
+ phaseIs(phase: string): void;
49
+ /**
50
+ * Hashes a row and hands it to the sink, unless an equal row was emitted
51
+ * before. Returns the hashed row either way.
52
+ * @param table - The key of the table
53
+ * @param row - The row without hash
54
+ */
55
+ emit<T extends Json>(table: TableKey, row: T): Promise<EHashed<T>>;
56
+ /** The number of rows handed to the sink */
57
+ get rowsDone(): number;
58
+ /** The number of rows produced, including the duplicates that were dropped */
59
+ get rowsProduced(): number;
60
+ /** The number of rows handed to the sink, per table */
61
+ get rowsPerTable(): Record<string, number>;
62
+ private phase;
63
+ private done;
64
+ private produced;
65
+ private readonly counts;
66
+ private readonly seen;
67
+ private isDuplicate;
68
+ private throwIfAborted;
69
+ private count;
70
+ private report;
71
+ }
@@ -0,0 +1,33 @@
1
+ import { EResolvedConfig } from '../config/config.ts';
2
+ /** How big a world will be, calculated from the configuration alone */
3
+ export interface EEstimate {
4
+ /** How many different cars the world holds */
5
+ cars: number;
6
+ /** How many rows the world has at most; rows that happen to be equal fold into one */
7
+ rowsTotal: number;
8
+ /** How many rows each table has at most */
9
+ rowsPerTable: Record<string, number>;
10
+ /** The approximate size of the world as JSON, in bytes */
11
+ approxBytes: number;
12
+ }
13
+ /** The most cars Edge puts into one catalog when it fits a target */
14
+ export declare const maxFittedCarsPerCatalog = 100000;
15
+ /**
16
+ * Estimates the rows of a car world without generating a single one.
17
+ *
18
+ * The counts are exact for everything that is unique by construction, and an
19
+ * upper bound where two rows may happen to be equal, like prices.
20
+ * @param config - The resolved configuration
21
+ */
22
+ export declare const estimateCarWorld: (config: EResolvedConfig) => EEstimate;
23
+ /**
24
+ * Returns the largest number of cars per catalog whose world stays within a
25
+ * number of rows: at least 1, at most maxFittedCarsPerCatalog.
26
+ *
27
+ * When the rows never reach the target, because the cars share their bills
28
+ * of materials and scenes, the result is maxFittedCarsPerCatalog. More rows
29
+ * then come from more catalogs or from sharing per car.
30
+ * @param config - The resolved configuration
31
+ * @param targetRows - The number of rows the world should have at most
32
+ */
33
+ export declare const fitCarsPerCatalog: (config: EResolvedConfig, targetRows: number) => number;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Returns the entry at an index, wrapping around the end of the list.
3
+ * @param list - The list to pick from
4
+ * @param index - Any non-negative index
5
+ */
6
+ export declare const pick: <T>(list: readonly T[], index: number) => T;
7
+ /**
8
+ * Returns count entries starting at an offset, wrapping around the end.
9
+ *
10
+ * The entries are distinct as long as count does not exceed the length.
11
+ * @param list - The list to pick from
12
+ * @param offset - The index of the first entry
13
+ * @param count - The number of entries
14
+ */
15
+ export declare const pickMany: <T>(list: readonly T[], offset: number, count: number) => T[];
16
+ /**
17
+ * Tells whether an index falls into a share of a sequence.
18
+ *
19
+ * Of n consecutive indices, exactly round(n * share) are in the share, spread
20
+ * evenly: with a share of 0.25 every fourth index is in.
21
+ * @param index - The index within the sequence
22
+ * @param share - The share between 0 and 1
23
+ */
24
+ export declare const inShare: (index: number, share: number) => boolean;
25
+ /** Where an index sits and how many buckets share the sequence */
26
+ export interface EZipfOptions {
27
+ /** The index within the sequence */
28
+ index: number;
29
+ /** The length of the sequence */
30
+ count: number;
31
+ /** The number of buckets */
32
+ buckets: number;
33
+ }
34
+ /**
35
+ * Returns the harmonic number of n: 1 + 1/2 + … + 1/n.
36
+ * @param n - The number of terms
37
+ */
38
+ export declare const harmonic: (n: number) => number;
39
+ /**
40
+ * Maps an index of a sequence to a bucket, following a Zipf distribution.
41
+ *
42
+ * Bucket 0 receives the most indices, bucket 1 half as many, bucket 2 a
43
+ * third, and so on. Consecutive indices land in the same bucket.
44
+ * @param options - The index, the length of the sequence and the buckets
45
+ */
46
+ export declare const zipfBucket: (options: EZipfOptions) => number;
47
+ /**
48
+ * Pads a number with leading zeros.
49
+ * @param value - The number
50
+ * @param width - The minimum number of digits
51
+ */
52
+ export declare const padded: (value: number, width: number) => string;
53
+ /**
54
+ * Turns a name into a kebab case slug: lower case, ASCII letters and digits.
55
+ * @param name - The name, e.g. "Lynk & Co"
56
+ */
57
+ export declare const slug: (name: string) => string;
58
+ /**
59
+ * Rounds a value to the nearest multiple of a step.
60
+ * @param value - The value
61
+ * @param step - The step, e.g. 100
62
+ */
63
+ export declare const roundTo: (value: number, step: number) => number;
64
+ /**
65
+ * Rounds a value to a number of decimals.
66
+ * @param value - The value
67
+ * @param decimals - The decimals to keep
68
+ */
69
+ export declare const roundDecimals: (value: number, decimals: number) => number;
@@ -0,0 +1,49 @@
1
+ import { Rljson, Row, TableCfg, TableKey } from '@rljson/rljson';
2
+ /**
3
+ * Receives the rows of a run.
4
+ *
5
+ * Edge writes nothing itself: no file, no database. The application decides
6
+ * where the rows go, in Node.js, in the browser or in a Web Worker.
7
+ */
8
+ export interface ESink {
9
+ /**
10
+ * Receives a row of a table. The rows come in the order of their
11
+ * references. A returned promise is awaited, so a slow sink slows the
12
+ * generator down.
13
+ * @param table - The key of the table
14
+ * @param row - The hashed row
15
+ */
16
+ onRow(table: TableKey, row: Row): void | Promise<void>;
17
+ /**
18
+ * Receives the configuration of a table before its first row. A database
19
+ * creates the table here.
20
+ * @param table - The key of the table
21
+ * @param tableCfg - The hashed configuration of the table
22
+ */
23
+ onTable?(table: TableKey, tableCfg: TableCfg): void | Promise<void>;
24
+ }
25
+ /** Collects the rows of a run in memory: the sink behind generate() */
26
+ export declare class EMemorySink implements ESink {
27
+ /**
28
+ * Remembers the configuration of a table.
29
+ * @param table - The key of the table
30
+ * @param tableCfg - The hashed configuration of the table
31
+ */
32
+ onTable(table: TableKey, tableCfg: TableCfg): void;
33
+ /**
34
+ * Collects a row.
35
+ * @param table - The key of the table
36
+ * @param row - The hashed row
37
+ */
38
+ onRow(table: TableKey, row: Row): void;
39
+ /**
40
+ * Returns the collected rows as an Rljson object.
41
+ *
42
+ * Every table carries its content type, the hash of its configuration and
43
+ * a hash of its own.
44
+ */
45
+ toRljson(): Rljson;
46
+ private readonly tables;
47
+ private entry;
48
+ private tableOf;
49
+ }
@@ -0,0 +1,13 @@
1
+ /** A system group of a CAD scene (level 1) with its component groups (level 2) */
2
+ export interface ECadSystem {
3
+ /** The id of the group, unique among the children of the scene */
4
+ id: string;
5
+ /** The ids of the component groups below the system */
6
+ children: readonly string[];
7
+ }
8
+ /** The system groups of a car scene, each with six components */
9
+ export declare const cadSystems: readonly ECadSystem[];
10
+ /** Names for the nodes below the component groups (level 3 and deeper) */
11
+ export declare const cadDetails: readonly string[];
12
+ /** The materials of meshes, picked by index */
13
+ export declare const cadMaterials: readonly string[];
@@ -0,0 +1,21 @@
1
+ /** A car manufacturer or brand with a few facts about it */
2
+ export interface EManufacturerEntry {
3
+ /** The id of the manufacturer: the brand in kebab case */
4
+ id: string;
5
+ /** The name of the company */
6
+ name: string;
7
+ /** The brand name the cars carry */
8
+ brand: string;
9
+ /** The ISO 3166 country code of the headquarters */
10
+ country: string;
11
+ /** The city of the headquarters, listed in the places dictionary */
12
+ city: string;
13
+ /** The year the brand was founded, approximately */
14
+ founded: number;
15
+ }
16
+ /**
17
+ * Car manufacturers and brands from around the world.
18
+ *
19
+ * The facts are approximate and meant for test data only.
20
+ */
21
+ export declare const manufacturers: readonly EManufacturerEntry[];
@@ -0,0 +1,29 @@
1
+ /** A sub assembly of an assembly, with the names of its parts (level 2 and 3) */
2
+ export interface ESubAssembly {
3
+ /** The name of the sub assembly */
4
+ name: string;
5
+ /** The names of the parts the sub assembly consists of */
6
+ parts: readonly string[];
7
+ }
8
+ /** An assembly of a car: level 1 of a bill of materials */
9
+ export interface EAssembly {
10
+ /** The name of the assembly */
11
+ name: string;
12
+ /** The category of the assembly and of everything below it */
13
+ category: string;
14
+ /** The sub assemblies the assembly consists of */
15
+ subAssemblies: readonly ESubAssembly[];
16
+ }
17
+ /** A standard part shared by many bills of materials: level 4 */
18
+ export interface EStandardPart {
19
+ /** The name of the standard part */
20
+ name: string;
21
+ /** The material of the standard part */
22
+ material: string;
23
+ }
24
+ /** The assemblies of a car, each with six sub assemblies of six parts */
25
+ export declare const assemblies: readonly EAssembly[];
26
+ /** Standard parts: screws, seals, bearings, shared by every bill of materials */
27
+ export declare const standardParts: readonly EStandardPart[];
28
+ /** The materials of the parts of a category, picked by index */
29
+ export declare const materialsOf: Readonly<Record<string, readonly string[]>>;
@@ -0,0 +1,4 @@
1
+ /** First names from many countries */
2
+ export declare const firstNames: readonly string[];
3
+ /** Last names from many countries */
4
+ export declare const lastNames: readonly string[];
@@ -0,0 +1,27 @@
1
+ /** A city with its country, a postal code and coordinates */
2
+ export interface ECity {
3
+ /** The name of the city */
4
+ name: string;
5
+ /** The ISO 3166 country code, e.g. DE */
6
+ country: string;
7
+ /** A postal code of the city */
8
+ zip: string;
9
+ /** The latitude in degrees */
10
+ lat: number;
11
+ /** The longitude in degrees */
12
+ lng: number;
13
+ }
14
+ /** Cities around the world, including the headquarters of every manufacturer */
15
+ export declare const cities: readonly ECity[];
16
+ /** Street names from many countries */
17
+ export declare const streets: readonly string[];
18
+ /**
19
+ * Returns the cities of a country, or all cities when the country has none.
20
+ * @param country - The ISO 3166 country code
21
+ */
22
+ export declare const citiesIn: (country: string) => readonly ECity[];
23
+ /**
24
+ * Returns the city with a name, or throws when the dictionary has none.
25
+ * @param name - The name of the city
26
+ */
27
+ export declare const cityNamed: (name: string) => ECity;
@@ -0,0 +1,22 @@
1
+ /** The body types of the vehicles */
2
+ export type EBodyType = 'sedan' | 'hatchback' | 'wagon' | 'suv' | 'coupe' | 'convertible' | 'van' | 'pickup' | 'truck' | 'sportscar' | 'minivan' | 'microcar';
3
+ /** The fuels of the vehicles */
4
+ export type EFuel = 'petrol' | 'diesel' | 'hybrid' | 'electric' | 'hydrogen';
5
+ /** A vehicle model of a brand */
6
+ export interface EVehicleModel {
7
+ /** The brand, as in the manufacturers dictionary */
8
+ brand: string;
9
+ /** The name of the model */
10
+ model: string;
11
+ /** The body type of the model */
12
+ bodyType: EBodyType;
13
+ /** The fuel of the model */
14
+ fuel: EFuel;
15
+ }
16
+ /** Vehicle models of every brand in the manufacturers dictionary */
17
+ export declare const vehicles: readonly EVehicleModel[];
18
+ /**
19
+ * Returns the models of a brand, in the order of the dictionary.
20
+ * @param brand - The brand, as in the manufacturers dictionary
21
+ */
22
+ export declare const modelsOf: (brand: string) => readonly EVehicleModel[];