@jaypie/fabricator 0.2.0 → 0.3.0

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.
@@ -5,12 +5,7 @@ export interface FabricatorNameParams {
5
5
  }
6
6
  export interface FabricatorOptions {
7
7
  generator?: Record<string, string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>)>;
8
- name?: string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>) | Array<string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>)>;
9
- seed?: string | number;
10
- }
11
- export interface PrefabResultsFunctionConfig<T> {
12
- generate: (params: FabricatorNameParams) => T;
13
- results: T[];
8
+ name?: string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>);
14
9
  seed?: string | number;
15
10
  }
16
11
  /**
@@ -18,7 +13,7 @@ export interface PrefabResultsFunctionConfig<T> {
18
13
  */
19
14
  export interface NestedFabricatorConfig {
20
15
  generator?: Record<string, string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>)>;
21
- name?: string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>) | Array<string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>)>;
16
+ name?: string | ((params: FabricatorNameParams) => string) | ((params: FabricatorNameParams) => Promise<string>);
22
17
  fabricators?: Record<string, NestedFabricatorConfig>;
23
18
  seed?: string | number;
24
19
  }
@@ -46,11 +41,7 @@ export declare class Fabricator {
46
41
  private _generator?;
47
42
  private _id;
48
43
  private _name;
49
- private _nameOption?;
50
44
  private _random;
51
- private _remainingNameArray?;
52
- private _seedMap;
53
- private _nestedConfig?;
54
45
  /**
55
46
  * Creates a new Fabricator instance
56
47
  * Supports multiple signatures:
@@ -104,11 +95,6 @@ export declare class Fabricator {
104
95
  * Gets the fabricator name
105
96
  */
106
97
  get name(): string;
107
- /**
108
- * Creates a new Fabricator instance with next seed from _seedMap
109
- * @returns A new Fabricator instance seeded with the next UUID, chaining the name option and nested config if present
110
- */
111
- next(): Fabricator;
112
98
  /**
113
99
  * Gets the internal random function
114
100
  */
@@ -143,31 +129,6 @@ export declare class Fabricator {
143
129
  lastName: string;
144
130
  fullName: string;
145
131
  };
146
- /**
147
- * Utility namespace for helper functions
148
- */
149
- util: {
150
- /**
151
- * Creates a function that returns predetermined results in sequence,
152
- * then falls back to generated values
153
- *
154
- * @param config - Configuration object
155
- * @param config.generate - Function to generate values after results are exhausted
156
- * @param config.results - Array of predetermined results to return in order
157
- * @param config.seed - Optional seed for the fabricator passed to generate function
158
- * @returns A function that returns results sequentially, then generates new values
159
- *
160
- * @example
161
- * const getName = fab.generate.util.prefab({
162
- * results: ["Alice", "Bob"],
163
- * generate: ({ fabricator }) => fabricator.person.firstName(),
164
- * });
165
- * getName(); // "Alice"
166
- * getName(); // "Bob"
167
- * getName(); // Generated name
168
- */
169
- prefab: <T>(config: PrefabResultsFunctionConfig<T>) => (() => T);
170
- };
171
132
  };
172
133
  get airline(): Faker["airline"];
173
134
  get animal(): Faker["animal"];
@@ -62,10 +62,5 @@ export declare class WorldFabricator extends Fabricator {
62
62
  */
63
63
  exports(): Generator<Fabricator, void, undefined>;
64
64
  exports(count: number): Fabricator[];
65
- /**
66
- * Creates a new WorldFabricator instance with next seed
67
- * @returns A new WorldFabricator instance seeded with the next UUID
68
- */
69
- next(): WorldFabricator;
70
65
  }
71
66
  export {};