@anil-labs/factory 0.1.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.
- package/CHANGELOG.md +54 -0
- package/LICENSE +21 -0
- package/README.md +371 -0
- package/dist/builders/index.d.cts +40 -0
- package/dist/builders/index.d.ts +40 -0
- package/dist/chunks/faker-BOtDMmjd.cjs +1430 -0
- package/dist/chunks/faker-BOtDMmjd.cjs.map +1 -0
- package/dist/chunks/faker-BlEhpR26.mjs +1287 -0
- package/dist/chunks/faker-BlEhpR26.mjs.map +1 -0
- package/dist/chunks/persist-DcARfeC-.cjs +134 -0
- package/dist/chunks/persist-DcARfeC-.cjs.map +1 -0
- package/dist/chunks/persist-ZGX3NWMF.mjs +117 -0
- package/dist/chunks/persist-ZGX3NWMF.mjs.map +1 -0
- package/dist/core/collection.d.cts +41 -0
- package/dist/core/collection.d.ts +41 -0
- package/dist/core/factory.d.cts +115 -0
- package/dist/core/factory.d.ts +115 -0
- package/dist/core/index.d.cts +6 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/registry.d.cts +20 -0
- package/dist/core/registry.d.ts +20 -0
- package/dist/core/sequence.d.cts +36 -0
- package/dist/core/sequence.d.ts +36 -0
- package/dist/core/types.d.cts +47 -0
- package/dist/core/types.d.ts +47 -0
- package/dist/faker/color.d.cts +22 -0
- package/dist/faker/color.d.ts +22 -0
- package/dist/faker/commerce.d.cts +21 -0
- package/dist/faker/commerce.d.ts +21 -0
- package/dist/faker/company.d.cts +20 -0
- package/dist/faker/company.d.ts +20 -0
- package/dist/faker/datatype.d.cts +16 -0
- package/dist/faker/datatype.d.ts +16 -0
- package/dist/faker/date.d.cts +29 -0
- package/dist/faker/date.d.ts +29 -0
- package/dist/faker/faker.d.cts +82 -0
- package/dist/faker/faker.d.ts +82 -0
- package/dist/faker/finance.d.cts +25 -0
- package/dist/faker/finance.d.ts +25 -0
- package/dist/faker/helpers.d.cts +52 -0
- package/dist/faker/helpers.d.ts +52 -0
- package/dist/faker/image.d.cts +22 -0
- package/dist/faker/image.d.ts +22 -0
- package/dist/faker/index.d.cts +21 -0
- package/dist/faker/index.d.ts +21 -0
- package/dist/faker/internet.d.cts +33 -0
- package/dist/faker/internet.d.ts +33 -0
- package/dist/faker/locale.d.cts +26 -0
- package/dist/faker/locale.d.ts +26 -0
- package/dist/faker/location.d.cts +30 -0
- package/dist/faker/location.d.ts +30 -0
- package/dist/faker/lorem.d.cts +26 -0
- package/dist/faker/lorem.d.ts +26 -0
- package/dist/faker/number.d.cts +31 -0
- package/dist/faker/number.d.ts +31 -0
- package/dist/faker/person.d.cts +29 -0
- package/dist/faker/person.d.ts +29 -0
- package/dist/faker/regex.d.cts +19 -0
- package/dist/faker/regex.d.ts +19 -0
- package/dist/faker/string.d.cts +33 -0
- package/dist/faker/string.d.ts +33 -0
- package/dist/faker/system.d.cts +29 -0
- package/dist/faker/system.d.ts +29 -0
- package/dist/faker.cjs +26 -0
- package/dist/faker.mjs +3 -0
- package/dist/index.cjs +635 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +37 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.mjs +596 -0
- package/dist/index.mjs.map +1 -0
- package/dist/locales/en.cjs +351 -0
- package/dist/locales/en.cjs.map +1 -0
- package/dist/locales/en.d.cts +11 -0
- package/dist/locales/en.d.ts +11 -0
- package/dist/locales/en.mjs +350 -0
- package/dist/locales/en.mjs.map +1 -0
- package/dist/locales/types.d.cts +30 -0
- package/dist/locales/types.d.ts +30 -0
- package/dist/persist/console.d.cts +15 -0
- package/dist/persist/console.d.ts +15 -0
- package/dist/persist/http.d.cts +42 -0
- package/dist/persist/http.d.ts +42 -0
- package/dist/persist/index.d.cts +5 -0
- package/dist/persist/index.d.ts +5 -0
- package/dist/persist/memory.d.cts +26 -0
- package/dist/persist/memory.d.ts +26 -0
- package/dist/persist.cjs +5 -0
- package/dist/persist.mjs +2 -0
- package/dist/prng/index.d.cts +5 -0
- package/dist/prng/index.d.ts +5 -0
- package/dist/prng/mulberry32.d.cts +19 -0
- package/dist/prng/mulberry32.d.ts +19 -0
- package/dist/prng/types.d.cts +23 -0
- package/dist/prng/types.d.ts +23 -0
- package/dist/snapshot/index.d.cts +16 -0
- package/dist/snapshot/index.d.ts +16 -0
- package/package.json +136 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
//#region src/locales/en.ts
|
|
2
|
+
/**
|
|
3
|
+
* English (US) locale corpus. The default and the only one shipped — adding
|
|
4
|
+
* locales is a downstream concern via `registerLocale()`.
|
|
5
|
+
*
|
|
6
|
+
* Kept small on purpose: enough variety for realistic test data without
|
|
7
|
+
* inflating the bundle. Production faker.js ships hundreds of names per
|
|
8
|
+
* locale; we ship ~25 of each. Tests should not depend on specific values.
|
|
9
|
+
*/
|
|
10
|
+
var en = {
|
|
11
|
+
title: "English (US)",
|
|
12
|
+
firstNames: [
|
|
13
|
+
"Adam",
|
|
14
|
+
"Alex",
|
|
15
|
+
"Amara",
|
|
16
|
+
"Ava",
|
|
17
|
+
"Benjamin",
|
|
18
|
+
"Carlos",
|
|
19
|
+
"Charlotte",
|
|
20
|
+
"David",
|
|
21
|
+
"Diego",
|
|
22
|
+
"Elena",
|
|
23
|
+
"Emma",
|
|
24
|
+
"Fatima",
|
|
25
|
+
"George",
|
|
26
|
+
"Hannah",
|
|
27
|
+
"Isabella",
|
|
28
|
+
"James",
|
|
29
|
+
"Jin",
|
|
30
|
+
"Kira",
|
|
31
|
+
"Liam",
|
|
32
|
+
"Maria",
|
|
33
|
+
"Noah",
|
|
34
|
+
"Olivia",
|
|
35
|
+
"Priya",
|
|
36
|
+
"Sarah",
|
|
37
|
+
"William",
|
|
38
|
+
"Yuki"
|
|
39
|
+
],
|
|
40
|
+
firstNamesFemale: [
|
|
41
|
+
"Amara",
|
|
42
|
+
"Ava",
|
|
43
|
+
"Charlotte",
|
|
44
|
+
"Elena",
|
|
45
|
+
"Emma",
|
|
46
|
+
"Fatima",
|
|
47
|
+
"Hannah",
|
|
48
|
+
"Isabella",
|
|
49
|
+
"Kira",
|
|
50
|
+
"Maria",
|
|
51
|
+
"Olivia",
|
|
52
|
+
"Priya",
|
|
53
|
+
"Sarah",
|
|
54
|
+
"Yuki"
|
|
55
|
+
],
|
|
56
|
+
firstNamesMale: [
|
|
57
|
+
"Adam",
|
|
58
|
+
"Alex",
|
|
59
|
+
"Benjamin",
|
|
60
|
+
"Carlos",
|
|
61
|
+
"David",
|
|
62
|
+
"Diego",
|
|
63
|
+
"George",
|
|
64
|
+
"James",
|
|
65
|
+
"Jin",
|
|
66
|
+
"Liam",
|
|
67
|
+
"Noah",
|
|
68
|
+
"William"
|
|
69
|
+
],
|
|
70
|
+
lastNames: [
|
|
71
|
+
"Anderson",
|
|
72
|
+
"Brown",
|
|
73
|
+
"Chen",
|
|
74
|
+
"Davis",
|
|
75
|
+
"Garcia",
|
|
76
|
+
"Gupta",
|
|
77
|
+
"Hernandez",
|
|
78
|
+
"Jackson",
|
|
79
|
+
"Johnson",
|
|
80
|
+
"Kim",
|
|
81
|
+
"Lee",
|
|
82
|
+
"Lopez",
|
|
83
|
+
"Martin",
|
|
84
|
+
"Miller",
|
|
85
|
+
"Patel",
|
|
86
|
+
"Rodriguez",
|
|
87
|
+
"Sato",
|
|
88
|
+
"Singh",
|
|
89
|
+
"Smith",
|
|
90
|
+
"Taylor",
|
|
91
|
+
"Thompson",
|
|
92
|
+
"Wang",
|
|
93
|
+
"Williams",
|
|
94
|
+
"Wilson"
|
|
95
|
+
],
|
|
96
|
+
prefixes: [
|
|
97
|
+
"Dr.",
|
|
98
|
+
"Mr.",
|
|
99
|
+
"Mrs.",
|
|
100
|
+
"Ms.",
|
|
101
|
+
"Prof."
|
|
102
|
+
],
|
|
103
|
+
suffixes: [
|
|
104
|
+
"Jr.",
|
|
105
|
+
"Sr.",
|
|
106
|
+
"II",
|
|
107
|
+
"III",
|
|
108
|
+
"PhD",
|
|
109
|
+
"MD"
|
|
110
|
+
],
|
|
111
|
+
streetNames: [
|
|
112
|
+
"Main",
|
|
113
|
+
"Oak",
|
|
114
|
+
"Pine",
|
|
115
|
+
"Maple",
|
|
116
|
+
"Cedar",
|
|
117
|
+
"Elm",
|
|
118
|
+
"Lake",
|
|
119
|
+
"Hill",
|
|
120
|
+
"Park",
|
|
121
|
+
"Spring",
|
|
122
|
+
"River",
|
|
123
|
+
"Valley",
|
|
124
|
+
"Forest",
|
|
125
|
+
"Sunset",
|
|
126
|
+
"Highland"
|
|
127
|
+
],
|
|
128
|
+
streetSuffixes: [
|
|
129
|
+
"St",
|
|
130
|
+
"Ave",
|
|
131
|
+
"Blvd",
|
|
132
|
+
"Rd",
|
|
133
|
+
"Ln",
|
|
134
|
+
"Dr",
|
|
135
|
+
"Way",
|
|
136
|
+
"Ct",
|
|
137
|
+
"Pl"
|
|
138
|
+
],
|
|
139
|
+
cities: [
|
|
140
|
+
"Austin",
|
|
141
|
+
"Boston",
|
|
142
|
+
"Chicago",
|
|
143
|
+
"Denver",
|
|
144
|
+
"Houston",
|
|
145
|
+
"Los Angeles",
|
|
146
|
+
"Miami",
|
|
147
|
+
"Nashville",
|
|
148
|
+
"New York",
|
|
149
|
+
"Philadelphia",
|
|
150
|
+
"Phoenix",
|
|
151
|
+
"Portland",
|
|
152
|
+
"San Diego",
|
|
153
|
+
"San Francisco",
|
|
154
|
+
"Seattle"
|
|
155
|
+
],
|
|
156
|
+
states: [
|
|
157
|
+
"AL",
|
|
158
|
+
"AK",
|
|
159
|
+
"AZ",
|
|
160
|
+
"CA",
|
|
161
|
+
"CO",
|
|
162
|
+
"CT",
|
|
163
|
+
"FL",
|
|
164
|
+
"GA",
|
|
165
|
+
"IL",
|
|
166
|
+
"MA",
|
|
167
|
+
"NY",
|
|
168
|
+
"OH",
|
|
169
|
+
"OR",
|
|
170
|
+
"PA",
|
|
171
|
+
"TX",
|
|
172
|
+
"WA"
|
|
173
|
+
],
|
|
174
|
+
country: "United States",
|
|
175
|
+
countries: [
|
|
176
|
+
"United States",
|
|
177
|
+
"Canada",
|
|
178
|
+
"United Kingdom",
|
|
179
|
+
"Australia",
|
|
180
|
+
"Germany",
|
|
181
|
+
"France",
|
|
182
|
+
"Spain",
|
|
183
|
+
"Italy",
|
|
184
|
+
"Japan",
|
|
185
|
+
"Brazil",
|
|
186
|
+
"India",
|
|
187
|
+
"Mexico",
|
|
188
|
+
"Nepal"
|
|
189
|
+
],
|
|
190
|
+
emailDomains: [
|
|
191
|
+
"example.com",
|
|
192
|
+
"gmail.com",
|
|
193
|
+
"outlook.com",
|
|
194
|
+
"yahoo.com",
|
|
195
|
+
"hotmail.com",
|
|
196
|
+
"protonmail.com",
|
|
197
|
+
"fastmail.com"
|
|
198
|
+
],
|
|
199
|
+
tlds: [
|
|
200
|
+
"com",
|
|
201
|
+
"net",
|
|
202
|
+
"org",
|
|
203
|
+
"io",
|
|
204
|
+
"dev",
|
|
205
|
+
"app",
|
|
206
|
+
"co"
|
|
207
|
+
],
|
|
208
|
+
companies: [
|
|
209
|
+
"Acme Corp",
|
|
210
|
+
"Aperture Science",
|
|
211
|
+
"Cyberdyne Systems",
|
|
212
|
+
"Globex",
|
|
213
|
+
"Hooli",
|
|
214
|
+
"Initech",
|
|
215
|
+
"Massive Dynamic",
|
|
216
|
+
"Pied Piper",
|
|
217
|
+
"Stark Industries",
|
|
218
|
+
"Umbrella Inc",
|
|
219
|
+
"Wayne Enterprises",
|
|
220
|
+
"Wonka Industries"
|
|
221
|
+
],
|
|
222
|
+
jobTitles: [
|
|
223
|
+
"Backend Developer",
|
|
224
|
+
"Data Analyst",
|
|
225
|
+
"Designer",
|
|
226
|
+
"DevOps Engineer",
|
|
227
|
+
"Engineering Manager",
|
|
228
|
+
"Frontend Developer",
|
|
229
|
+
"Full Stack Developer",
|
|
230
|
+
"HR Manager",
|
|
231
|
+
"Marketing Manager",
|
|
232
|
+
"Product Manager",
|
|
233
|
+
"QA Engineer",
|
|
234
|
+
"Sales Representative",
|
|
235
|
+
"Software Engineer",
|
|
236
|
+
"Tech Lead"
|
|
237
|
+
],
|
|
238
|
+
buzzPhrases: [
|
|
239
|
+
"leverage cross-platform synergies",
|
|
240
|
+
"unlock turn-key paradigms",
|
|
241
|
+
"engineer scalable mindshare",
|
|
242
|
+
"reinvent vertical e-commerce",
|
|
243
|
+
"evolve frictionless platforms"
|
|
244
|
+
],
|
|
245
|
+
productNames: [
|
|
246
|
+
"Aerogel Mug",
|
|
247
|
+
"Bamboo Notebook",
|
|
248
|
+
"Cordless Drill",
|
|
249
|
+
"Desk Lamp",
|
|
250
|
+
"Espresso Press",
|
|
251
|
+
"Floor Cushion",
|
|
252
|
+
"Glass Carafe",
|
|
253
|
+
"Headphones",
|
|
254
|
+
"Insulated Tumbler",
|
|
255
|
+
"Joystick",
|
|
256
|
+
"Kettle",
|
|
257
|
+
"Linen Blanket"
|
|
258
|
+
],
|
|
259
|
+
departments: [
|
|
260
|
+
"Books",
|
|
261
|
+
"Clothing",
|
|
262
|
+
"Electronics",
|
|
263
|
+
"Garden",
|
|
264
|
+
"Grocery",
|
|
265
|
+
"Health",
|
|
266
|
+
"Home",
|
|
267
|
+
"Kids",
|
|
268
|
+
"Movies",
|
|
269
|
+
"Music",
|
|
270
|
+
"Outdoors",
|
|
271
|
+
"Toys"
|
|
272
|
+
],
|
|
273
|
+
colors: [
|
|
274
|
+
"red",
|
|
275
|
+
"blue",
|
|
276
|
+
"green",
|
|
277
|
+
"yellow",
|
|
278
|
+
"purple",
|
|
279
|
+
"orange",
|
|
280
|
+
"pink",
|
|
281
|
+
"cyan",
|
|
282
|
+
"teal",
|
|
283
|
+
"indigo",
|
|
284
|
+
"lime",
|
|
285
|
+
"amber",
|
|
286
|
+
"brown",
|
|
287
|
+
"grey",
|
|
288
|
+
"black",
|
|
289
|
+
"white"
|
|
290
|
+
],
|
|
291
|
+
loremWords: [
|
|
292
|
+
"lorem",
|
|
293
|
+
"ipsum",
|
|
294
|
+
"dolor",
|
|
295
|
+
"sit",
|
|
296
|
+
"amet",
|
|
297
|
+
"consectetur",
|
|
298
|
+
"adipiscing",
|
|
299
|
+
"elit",
|
|
300
|
+
"sed",
|
|
301
|
+
"do",
|
|
302
|
+
"eiusmod",
|
|
303
|
+
"tempor",
|
|
304
|
+
"incididunt",
|
|
305
|
+
"ut",
|
|
306
|
+
"labore",
|
|
307
|
+
"et",
|
|
308
|
+
"dolore",
|
|
309
|
+
"magna",
|
|
310
|
+
"aliqua",
|
|
311
|
+
"enim",
|
|
312
|
+
"ad",
|
|
313
|
+
"minim",
|
|
314
|
+
"veniam",
|
|
315
|
+
"quis",
|
|
316
|
+
"nostrud",
|
|
317
|
+
"exercitation"
|
|
318
|
+
],
|
|
319
|
+
mimeTypes: [
|
|
320
|
+
"application/json",
|
|
321
|
+
"application/pdf",
|
|
322
|
+
"application/zip",
|
|
323
|
+
"audio/mpeg",
|
|
324
|
+
"image/gif",
|
|
325
|
+
"image/jpeg",
|
|
326
|
+
"image/png",
|
|
327
|
+
"image/webp",
|
|
328
|
+
"text/csv",
|
|
329
|
+
"text/html",
|
|
330
|
+
"text/plain",
|
|
331
|
+
"video/mp4"
|
|
332
|
+
],
|
|
333
|
+
fileExtensions: [
|
|
334
|
+
"csv",
|
|
335
|
+
"gif",
|
|
336
|
+
"jpg",
|
|
337
|
+
"json",
|
|
338
|
+
"mp3",
|
|
339
|
+
"mp4",
|
|
340
|
+
"pdf",
|
|
341
|
+
"png",
|
|
342
|
+
"txt",
|
|
343
|
+
"webp",
|
|
344
|
+
"zip"
|
|
345
|
+
]
|
|
346
|
+
};
|
|
347
|
+
//#endregion
|
|
348
|
+
export { en };
|
|
349
|
+
|
|
350
|
+
//# sourceMappingURL=en.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.mjs","names":[],"sources":["../../src/locales/en.ts"],"sourcesContent":["import type { LocaleData } from './types'\n\nexport type { LocaleData }\n\n/**\n * English (US) locale corpus. The default and the only one shipped — adding\n * locales is a downstream concern via `registerLocale()`.\n *\n * Kept small on purpose: enough variety for realistic test data without\n * inflating the bundle. Production faker.js ships hundreds of names per\n * locale; we ship ~25 of each. Tests should not depend on specific values.\n */\nexport const en: LocaleData = {\n title: 'English (US)',\n\n firstNames: [\n 'Adam',\n 'Alex',\n 'Amara',\n 'Ava',\n 'Benjamin',\n 'Carlos',\n 'Charlotte',\n 'David',\n 'Diego',\n 'Elena',\n 'Emma',\n 'Fatima',\n 'George',\n 'Hannah',\n 'Isabella',\n 'James',\n 'Jin',\n 'Kira',\n 'Liam',\n 'Maria',\n 'Noah',\n 'Olivia',\n 'Priya',\n 'Sarah',\n 'William',\n 'Yuki',\n ],\n firstNamesFemale: [\n 'Amara',\n 'Ava',\n 'Charlotte',\n 'Elena',\n 'Emma',\n 'Fatima',\n 'Hannah',\n 'Isabella',\n 'Kira',\n 'Maria',\n 'Olivia',\n 'Priya',\n 'Sarah',\n 'Yuki',\n ],\n firstNamesMale: [\n 'Adam',\n 'Alex',\n 'Benjamin',\n 'Carlos',\n 'David',\n 'Diego',\n 'George',\n 'James',\n 'Jin',\n 'Liam',\n 'Noah',\n 'William',\n ],\n lastNames: [\n 'Anderson',\n 'Brown',\n 'Chen',\n 'Davis',\n 'Garcia',\n 'Gupta',\n 'Hernandez',\n 'Jackson',\n 'Johnson',\n 'Kim',\n 'Lee',\n 'Lopez',\n 'Martin',\n 'Miller',\n 'Patel',\n 'Rodriguez',\n 'Sato',\n 'Singh',\n 'Smith',\n 'Taylor',\n 'Thompson',\n 'Wang',\n 'Williams',\n 'Wilson',\n ],\n prefixes: ['Dr.', 'Mr.', 'Mrs.', 'Ms.', 'Prof.'],\n suffixes: ['Jr.', 'Sr.', 'II', 'III', 'PhD', 'MD'],\n\n streetNames: [\n 'Main',\n 'Oak',\n 'Pine',\n 'Maple',\n 'Cedar',\n 'Elm',\n 'Lake',\n 'Hill',\n 'Park',\n 'Spring',\n 'River',\n 'Valley',\n 'Forest',\n 'Sunset',\n 'Highland',\n ],\n streetSuffixes: ['St', 'Ave', 'Blvd', 'Rd', 'Ln', 'Dr', 'Way', 'Ct', 'Pl'],\n cities: [\n 'Austin',\n 'Boston',\n 'Chicago',\n 'Denver',\n 'Houston',\n 'Los Angeles',\n 'Miami',\n 'Nashville',\n 'New York',\n 'Philadelphia',\n 'Phoenix',\n 'Portland',\n 'San Diego',\n 'San Francisco',\n 'Seattle',\n ],\n states: [\n 'AL',\n 'AK',\n 'AZ',\n 'CA',\n 'CO',\n 'CT',\n 'FL',\n 'GA',\n 'IL',\n 'MA',\n 'NY',\n 'OH',\n 'OR',\n 'PA',\n 'TX',\n 'WA',\n ],\n country: 'United States',\n countries: [\n 'United States',\n 'Canada',\n 'United Kingdom',\n 'Australia',\n 'Germany',\n 'France',\n 'Spain',\n 'Italy',\n 'Japan',\n 'Brazil',\n 'India',\n 'Mexico',\n 'Nepal',\n ],\n\n emailDomains: [\n 'example.com',\n 'gmail.com',\n 'outlook.com',\n 'yahoo.com',\n 'hotmail.com',\n 'protonmail.com',\n 'fastmail.com',\n ],\n tlds: ['com', 'net', 'org', 'io', 'dev', 'app', 'co'],\n\n companies: [\n 'Acme Corp',\n 'Aperture Science',\n 'Cyberdyne Systems',\n 'Globex',\n 'Hooli',\n 'Initech',\n 'Massive Dynamic',\n 'Pied Piper',\n 'Stark Industries',\n 'Umbrella Inc',\n 'Wayne Enterprises',\n 'Wonka Industries',\n ],\n jobTitles: [\n 'Backend Developer',\n 'Data Analyst',\n 'Designer',\n 'DevOps Engineer',\n 'Engineering Manager',\n 'Frontend Developer',\n 'Full Stack Developer',\n 'HR Manager',\n 'Marketing Manager',\n 'Product Manager',\n 'QA Engineer',\n 'Sales Representative',\n 'Software Engineer',\n 'Tech Lead',\n ],\n buzzPhrases: [\n 'leverage cross-platform synergies',\n 'unlock turn-key paradigms',\n 'engineer scalable mindshare',\n 'reinvent vertical e-commerce',\n 'evolve frictionless platforms',\n ],\n\n productNames: [\n 'Aerogel Mug',\n 'Bamboo Notebook',\n 'Cordless Drill',\n 'Desk Lamp',\n 'Espresso Press',\n 'Floor Cushion',\n 'Glass Carafe',\n 'Headphones',\n 'Insulated Tumbler',\n 'Joystick',\n 'Kettle',\n 'Linen Blanket',\n ],\n departments: [\n 'Books',\n 'Clothing',\n 'Electronics',\n 'Garden',\n 'Grocery',\n 'Health',\n 'Home',\n 'Kids',\n 'Movies',\n 'Music',\n 'Outdoors',\n 'Toys',\n ],\n\n colors: [\n 'red',\n 'blue',\n 'green',\n 'yellow',\n 'purple',\n 'orange',\n 'pink',\n 'cyan',\n 'teal',\n 'indigo',\n 'lime',\n 'amber',\n 'brown',\n 'grey',\n 'black',\n 'white',\n ],\n\n loremWords: [\n 'lorem',\n 'ipsum',\n 'dolor',\n 'sit',\n 'amet',\n 'consectetur',\n 'adipiscing',\n 'elit',\n 'sed',\n 'do',\n 'eiusmod',\n 'tempor',\n 'incididunt',\n 'ut',\n 'labore',\n 'et',\n 'dolore',\n 'magna',\n 'aliqua',\n 'enim',\n 'ad',\n 'minim',\n 'veniam',\n 'quis',\n 'nostrud',\n 'exercitation',\n ],\n\n mimeTypes: [\n 'application/json',\n 'application/pdf',\n 'application/zip',\n 'audio/mpeg',\n 'image/gif',\n 'image/jpeg',\n 'image/png',\n 'image/webp',\n 'text/csv',\n 'text/html',\n 'text/plain',\n 'video/mp4',\n ],\n fileExtensions: ['csv', 'gif', 'jpg', 'json', 'mp3', 'mp4', 'pdf', 'png', 'txt', 'webp', 'zip'],\n}\n"],"mappings":";;;;;;;;;AAYA,IAAa,KAAiB;CAC5B,OAAO;CAEP,YAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,kBAAkB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,gBAAgB;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU;EAAC;EAAO;EAAO;EAAQ;EAAO;CAAO;CAC/C,UAAU;EAAC;EAAO;EAAO;EAAM;EAAO;EAAO;CAAI;CAEjD,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,gBAAgB;EAAC;EAAM;EAAO;EAAQ;EAAM;EAAM;EAAM;EAAO;EAAM;CAAI;CACzE,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,SAAS;CACT,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,cAAc;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,MAAM;EAAC;EAAO;EAAO;EAAO;EAAM;EAAO;EAAO;CAAI;CAEpD,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;CACF;CAEA,cAAc;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,YAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,WAAW;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,gBAAgB;EAAC;EAAO;EAAO;EAAO;EAAQ;EAAO;EAAO;EAAO;EAAO;EAAO;EAAQ;CAAK;AAChG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shape of a locale corpus. Add a locale by exporting a `LocaleData` from a
|
|
3
|
+
* new module under `src/faker/locales/` and calling `registerLocale(name, data)`.
|
|
4
|
+
*/
|
|
5
|
+
export interface LocaleData {
|
|
6
|
+
readonly buzzPhrases: readonly string[];
|
|
7
|
+
readonly cities: readonly string[];
|
|
8
|
+
readonly colors: readonly string[];
|
|
9
|
+
readonly companies: readonly string[];
|
|
10
|
+
readonly countries: readonly string[];
|
|
11
|
+
readonly country: string;
|
|
12
|
+
readonly departments: readonly string[];
|
|
13
|
+
readonly emailDomains: readonly string[];
|
|
14
|
+
readonly fileExtensions: readonly string[];
|
|
15
|
+
readonly firstNames: readonly string[];
|
|
16
|
+
readonly firstNamesFemale?: readonly string[];
|
|
17
|
+
readonly firstNamesMale?: readonly string[];
|
|
18
|
+
readonly jobTitles: readonly string[];
|
|
19
|
+
readonly lastNames: readonly string[];
|
|
20
|
+
readonly loremWords: readonly string[];
|
|
21
|
+
readonly mimeTypes: readonly string[];
|
|
22
|
+
readonly prefixes: readonly string[];
|
|
23
|
+
readonly productNames: readonly string[];
|
|
24
|
+
readonly states: readonly string[];
|
|
25
|
+
readonly streetNames: readonly string[];
|
|
26
|
+
readonly streetSuffixes: readonly string[];
|
|
27
|
+
readonly suffixes: readonly string[];
|
|
28
|
+
readonly title: string;
|
|
29
|
+
readonly tlds: readonly string[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shape of a locale corpus. Add a locale by exporting a `LocaleData` from a
|
|
3
|
+
* new module under `src/faker/locales/` and calling `registerLocale(name, data)`.
|
|
4
|
+
*/
|
|
5
|
+
export interface LocaleData {
|
|
6
|
+
readonly buzzPhrases: readonly string[];
|
|
7
|
+
readonly cities: readonly string[];
|
|
8
|
+
readonly colors: readonly string[];
|
|
9
|
+
readonly companies: readonly string[];
|
|
10
|
+
readonly countries: readonly string[];
|
|
11
|
+
readonly country: string;
|
|
12
|
+
readonly departments: readonly string[];
|
|
13
|
+
readonly emailDomains: readonly string[];
|
|
14
|
+
readonly fileExtensions: readonly string[];
|
|
15
|
+
readonly firstNames: readonly string[];
|
|
16
|
+
readonly firstNamesFemale?: readonly string[];
|
|
17
|
+
readonly firstNamesMale?: readonly string[];
|
|
18
|
+
readonly jobTitles: readonly string[];
|
|
19
|
+
readonly lastNames: readonly string[];
|
|
20
|
+
readonly loremWords: readonly string[];
|
|
21
|
+
readonly mimeTypes: readonly string[];
|
|
22
|
+
readonly prefixes: readonly string[];
|
|
23
|
+
readonly productNames: readonly string[];
|
|
24
|
+
readonly states: readonly string[];
|
|
25
|
+
readonly streetNames: readonly string[];
|
|
26
|
+
readonly streetSuffixes: readonly string[];
|
|
27
|
+
readonly suffixes: readonly string[];
|
|
28
|
+
readonly title: string;
|
|
29
|
+
readonly tlds: readonly string[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Persist } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Logging persistence — prints each item to the console and returns it
|
|
4
|
+
* unchanged. Handy when wiring up a factory and you want to inspect what
|
|
5
|
+
* `create()` would send before pointing it at a real backend.
|
|
6
|
+
*
|
|
7
|
+
* The factory wraps in `<T>()` so it satisfies `Persist<T>` for any model
|
|
8
|
+
* type without losing the model's static type.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* UserFactory.persist(consolePersist()).create()
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function consolePersist<T>(label?: string): Persist<T>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Persist } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* Logging persistence — prints each item to the console and returns it
|
|
4
|
+
* unchanged. Handy when wiring up a factory and you want to inspect what
|
|
5
|
+
* `create()` would send before pointing it at a real backend.
|
|
6
|
+
*
|
|
7
|
+
* The factory wraps in `<T>()` so it satisfies `Persist<T>` for any model
|
|
8
|
+
* type without losing the model's static type.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* UserFactory.persist(consolePersist()).create()
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function consolePersist<T>(label?: string): Persist<T>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Persist } from '../core/types';
|
|
2
|
+
/** Minimal `fetch`-like interface — works with `fetch`, `axios.request`, etc. */
|
|
3
|
+
type FetchLike = (url: string, init: {
|
|
4
|
+
body: string;
|
|
5
|
+
headers: Record<string, string>;
|
|
6
|
+
method: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
json(): Promise<unknown>;
|
|
9
|
+
ok: boolean;
|
|
10
|
+
status: number;
|
|
11
|
+
text(): Promise<string>;
|
|
12
|
+
}>;
|
|
13
|
+
export interface HttpPersistOptions {
|
|
14
|
+
/** Custom fetch implementation (defaults to global `fetch`). */
|
|
15
|
+
fetch?: FetchLike;
|
|
16
|
+
/** Extra HTTP headers — combined with `Content-Type: application/json`. */
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Function that extracts the persisted entity from the HTTP response.
|
|
20
|
+
* Defaults to `(json) => json.data ?? json` to handle both wrapped + flat shapes.
|
|
21
|
+
*/
|
|
22
|
+
parse?: (responseJson: unknown) => unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* HTTP persistence adapter. POSTs each built item to `url` and returns the
|
|
26
|
+
* server-assigned representation.
|
|
27
|
+
*
|
|
28
|
+
* Works with any `fetch`-shaped implementation — pass `axios.request` or a
|
|
29
|
+
* test double if you need to intercept.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { httpPersist } from '@anil-labs/factory'
|
|
34
|
+
*
|
|
35
|
+
* const UserFactory = defineFactory<User>(...).persist(
|
|
36
|
+
* httpPersist<User>('/api/users')
|
|
37
|
+
* )
|
|
38
|
+
* await UserFactory.count(3).create()
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function httpPersist<T>(url: string, options?: HttpPersistOptions): Persist<T>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Persist } from '../core/types';
|
|
2
|
+
/** Minimal `fetch`-like interface — works with `fetch`, `axios.request`, etc. */
|
|
3
|
+
type FetchLike = (url: string, init: {
|
|
4
|
+
body: string;
|
|
5
|
+
headers: Record<string, string>;
|
|
6
|
+
method: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
json(): Promise<unknown>;
|
|
9
|
+
ok: boolean;
|
|
10
|
+
status: number;
|
|
11
|
+
text(): Promise<string>;
|
|
12
|
+
}>;
|
|
13
|
+
export interface HttpPersistOptions {
|
|
14
|
+
/** Custom fetch implementation (defaults to global `fetch`). */
|
|
15
|
+
fetch?: FetchLike;
|
|
16
|
+
/** Extra HTTP headers — combined with `Content-Type: application/json`. */
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Function that extracts the persisted entity from the HTTP response.
|
|
20
|
+
* Defaults to `(json) => json.data ?? json` to handle both wrapped + flat shapes.
|
|
21
|
+
*/
|
|
22
|
+
parse?: (responseJson: unknown) => unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* HTTP persistence adapter. POSTs each built item to `url` and returns the
|
|
26
|
+
* server-assigned representation.
|
|
27
|
+
*
|
|
28
|
+
* Works with any `fetch`-shaped implementation — pass `axios.request` or a
|
|
29
|
+
* test double if you need to intercept.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { httpPersist } from '@anil-labs/factory'
|
|
34
|
+
*
|
|
35
|
+
* const UserFactory = defineFactory<User>(...).persist(
|
|
36
|
+
* httpPersist<User>('/api/users')
|
|
37
|
+
* )
|
|
38
|
+
* await UserFactory.count(3).create()
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function httpPersist<T>(url: string, options?: HttpPersistOptions): Persist<T>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Persist } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* In-memory persistence store. Each call appends to a shared array and
|
|
4
|
+
* returns the item with an auto-assigned `id` if it didn't have one.
|
|
5
|
+
*
|
|
6
|
+
* Built for unit-tests of business logic that consumes "persisted" entities
|
|
7
|
+
* without involving a real backend.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { memoryPersist } from '@anil-labs/factory'
|
|
12
|
+
*
|
|
13
|
+
* const store = memoryPersist<User>()
|
|
14
|
+
* const UserFactory = defineFactory<User>(...).persist(store)
|
|
15
|
+
* await UserFactory.count(3).create()
|
|
16
|
+
* store.all() // → 3 users
|
|
17
|
+
* store.find(1) // → first user
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function memoryPersist<T extends {
|
|
21
|
+
id?: number | string;
|
|
22
|
+
}>(): Persist<T> & {
|
|
23
|
+
all(): T[];
|
|
24
|
+
find(id: T['id']): T | undefined;
|
|
25
|
+
reset(): void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Persist } from '../core/types';
|
|
2
|
+
/**
|
|
3
|
+
* In-memory persistence store. Each call appends to a shared array and
|
|
4
|
+
* returns the item with an auto-assigned `id` if it didn't have one.
|
|
5
|
+
*
|
|
6
|
+
* Built for unit-tests of business logic that consumes "persisted" entities
|
|
7
|
+
* without involving a real backend.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { memoryPersist } from '@anil-labs/factory'
|
|
12
|
+
*
|
|
13
|
+
* const store = memoryPersist<User>()
|
|
14
|
+
* const UserFactory = defineFactory<User>(...).persist(store)
|
|
15
|
+
* await UserFactory.count(3).create()
|
|
16
|
+
* store.all() // → 3 users
|
|
17
|
+
* store.find(1) // → first user
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function memoryPersist<T extends {
|
|
21
|
+
id?: number | string;
|
|
22
|
+
}>(): Persist<T> & {
|
|
23
|
+
all(): T[];
|
|
24
|
+
find(id: T['id']): T | undefined;
|
|
25
|
+
reset(): void;
|
|
26
|
+
};
|
package/dist/persist.cjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_persist = require("./chunks/persist-DcARfeC-.cjs");
|
|
3
|
+
exports.consolePersist = require_persist.consolePersist;
|
|
4
|
+
exports.httpPersist = require_persist.httpPersist;
|
|
5
|
+
exports.memoryPersist = require_persist.memoryPersist;
|
package/dist/persist.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Prng } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Mulberry32 — 32-bit, ~4 billion period, very fast, deterministic.
|
|
4
|
+
*
|
|
5
|
+
* Good enough for test data and snapshots. NOT cryptographically secure.
|
|
6
|
+
*
|
|
7
|
+
* @see https://gist.github.com/tommyettinger/46a3b8f97c8e3a59e1e0c7f8e85bcde6
|
|
8
|
+
*/
|
|
9
|
+
export declare class Mulberry32 implements Prng {
|
|
10
|
+
private state;
|
|
11
|
+
constructor(seed?: number);
|
|
12
|
+
get currentSeed(): number;
|
|
13
|
+
seed(seed: number): void;
|
|
14
|
+
next(): number;
|
|
15
|
+
int(min: number, max: number): number;
|
|
16
|
+
float(min: number, max: number, decimals?: number): number;
|
|
17
|
+
bool(chance?: number): boolean;
|
|
18
|
+
pick<T>(items: readonly T[]): T;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Prng } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Mulberry32 — 32-bit, ~4 billion period, very fast, deterministic.
|
|
4
|
+
*
|
|
5
|
+
* Good enough for test data and snapshots. NOT cryptographically secure.
|
|
6
|
+
*
|
|
7
|
+
* @see https://gist.github.com/tommyettinger/46a3b8f97c8e3a59e1e0c7f8e85bcde6
|
|
8
|
+
*/
|
|
9
|
+
export declare class Mulberry32 implements Prng {
|
|
10
|
+
private state;
|
|
11
|
+
constructor(seed?: number);
|
|
12
|
+
get currentSeed(): number;
|
|
13
|
+
seed(seed: number): void;
|
|
14
|
+
next(): number;
|
|
15
|
+
int(min: number, max: number): number;
|
|
16
|
+
float(min: number, max: number, decimals?: number): number;
|
|
17
|
+
bool(chance?: number): boolean;
|
|
18
|
+
pick<T>(items: readonly T[]): T;
|
|
19
|
+
}
|