-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.d.ts
13255 lines (12615 loc) · 275 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* **Random fake data generator for k6.**
*
* Altought there is several good JavaScript fake data generator,
* but using these in [k6](https://k6.io) tests has several disadvantages (download size, memory usage, startup time, etc).
* The xk6-faker implemented as a golang extension, so tests starts faster and use less memory.
* The price is a little bit smaller feature set compared with popular JavaScript fake data generators.
*
* For convenience, the xk6-faker API resembles the popular [Faker.js](https://fakerjs.dev/).
* The category names and the generator function names are often different
* (due to the [underlying go faker library](https://github.com/brianvoe/gofakeit)),
* but the way of use is similar.
*
* @example
* For convenient use, the default export of the module is a Faker instance,
* it just needs to be imported and it is ready for use.
*
* ```ts
* import faker from "k6/x/faker"
*
* export default function() {
* console.log(faker.person.firstName())
* }
*
* // prints a random first name
* ```
* For a reproducible test run, a random seed value can be passed to the constructor of the Faker class.
*
* ```ts
* import { Faker } from "k6/x/faker"
*
* const faker = new Faker(11)
*
* export default function() {
* console.log(faker.person.firstName())
* }
* ```
* **Output** (formatted as JSON value)
* ```json
* "Josiah"
* ```
* The reproducibility of the test can also be achieved using the default Faker instance,
* if the seed value is set in the `XK6_FAKER_SEED` environment variable.
* ```bash
* k6 run --env XK6_FAKER_SEED=11 script.js
* ```
* then
* ```ts
* import faker from "k6/x/faker"
*
* export default function() {
* console.log(faker.person.firstName())
* }
* ```
* **Output** (formatted as JSON value)
* ```json
* "Josiah"
* ```
*
* @module faker
*/
export as namespace faker;
/**
* This is the faker module's main class containing all generators that can be used to generate data.
*
* Please have a look at the individual generators and methods for more information.
*
* @example
* ```ts
* import { Faker } from "k6/x/faker"
*
* const faker = new Faker(11)
*
* export default function() {
* console.log(faker.person.firstName())
* }
* ```
* **Output** (formatted as JSON value)
* ```json
* "Josiah"
* ```
*/
export declare class Faker {
/**
* Creates a new instance of Faker.
*
* Optionally, the value of the random seed can be set as a constructor parameter.
* This is intended to allow for consistent values in a tests,
* so you might want to use hardcoded values as the seed.
*
* Please note that generated values are dependent on both the seed and the number
* of calls that have been made.
*
* Setting seed to 0 (or omitting it) will use seed derived from system entropy.
*
* @param seed random seed value for deterministic generator
*
* @example
* ```ts
* const consistentFaker = new Faker(11)
* const semiRandomFaker = new Faker()
* ```
*/
constructor(seed?: number);
/**
* Call fake data generator function based on function name.
*
* @param func the name of the generator function to be called
* @param args parameters for the generator function to be called
*/
call(func: string, ...args: unknown[]): unknown;
/**
* Generator to generate addresses and locations.
*/
readonly address: Address;
/**
* Generator to generate animals.
*/
readonly animal: Animal;
/**
* Generator to generate application related entries.
*/
readonly app: App;
/**
* Generator to generate beer related entries.
*/
readonly beer: Beer;
/**
* Generator to generate book related entries.
*/
readonly book: Book;
/**
* Generator to generate car related entries.
*/
readonly car: Car;
/**
* Generator to generate celebrities.
*/
readonly celebrity: Celebrity;
/**
* Generator to generate colors.
*/
readonly color: Color;
/**
* Generator to generate company related entries.
*/
readonly company: Company;
/**
* Generator to generate emoji related entries.
*/
readonly emoji: Emoji;
/**
* Generator to generate various error codes and messages.
*/
readonly error: Error;
/**
* Generator to generate file related entries.
*/
readonly file: File;
/**
* Generator to generate finance related entries.
*/
readonly finance: Finance;
/**
* Generator to generate food related entries.
*/
readonly food: Food;
/**
* Generator to generate game related entries.
*/
readonly game: Game;
/**
* Generator to generate hacker/IT words and phrases.
*/
readonly hacker: Hacker;
/**
* Generator to generate hipster words, phrases and paragraphs.
*/
readonly hipster: Hipster;
/**
* Generator to generate internet related entries.
*/
readonly internet: Internet;
/**
* Generator to generate language related entries.
*/
readonly language: Language;
/**
* Generator to generate minecraft related entries.
*/
readonly minecraft: Minecraft;
/**
* Generator to generate movie related entries.
*/
readonly movie: Movie;
/**
* Generator to generate numbers.
*/
readonly numbers: Numbers;
/**
* Generator to generate payment related entries.
*/
readonly payment: Payment;
/**
* Generator to generate people's personal information.
*/
readonly person: Person;
/**
* Generator to generate product related entries.
*/
readonly product: Product;
/**
* Generator to generate strings.
*/
readonly strings: Strings;
/**
* Generator to generate time and date.
*/
readonly time: Time;
/**
* Generator to generate words and sentences.
*/
readonly word: Word;
/**
* Generator with all generator functions for convenient use.
*/
readonly zen: Zen;
}
/** Default Faker instance. */
declare const faker: Faker;
/** Default Faker instance */
export default faker;
/**
* Generator to generate addresses and locations.
*/
export declare interface Address {
/**
* Residential location including street, city, state, country and postal code.
* @returns a random address
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.address())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* {"Address":"53883 Villageborough, San Bernardino, Kentucky 56992","Street":"53883 Villageborough","City":"San Bernardino","State":"Kentucky","Zip":"56992","Country":"United States of America","Latitude":11.29359,"Longitude":-145.577493}
* ```
*/
address(): Record<string,unknown>;
/**
* Part of a country with significant population, often a central hub for culture and commerce.
* @returns a random city
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.city())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Hialeah"
* ```
*/
city(): string;
/**
* Nation with its own government and defined territory.
* @returns a random country
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.country())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Togo"
* ```
*/
country(): string;
/**
* Shortened 2-letter form of a country's name.
* @returns a random country abbreviation
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.countryAbbreviation())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "TG"
* ```
*/
countryAbbreviation(): string;
/**
* Geographic coordinate specifying north-south position on Earth's surface.
* @returns a random latitude
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.latitude())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* 11.394086
* ```
*/
latitude(): number;
/**
* Latitude number between the given range (default min=0, max=90).
* @param min - Min
* @param max - Max
* @returns a random latitude range
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.latitudeRange(0,90))
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* 50.697043
* ```
*/
latitudeRange(min: number, max: number): number;
/**
* Geographic coordinate indicating east-west position on Earth's surface.
* @returns a random longitude
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.longitude())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* 22.788172
* ```
*/
longitude(): number;
/**
* Longitude number between the given range (default min=0, max=180).
* @param min - Min
* @param max - Max
* @returns a random longitude range
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.longitudeRange(0,180))
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* 101.394086
* ```
*/
longitudeRange(min: number, max: number): number;
/**
* Governmental division within a country, often having its own laws and government.
* @returns a random state
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.state())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Massachusetts"
* ```
*/
state(): string;
/**
* Shortened 2-letter form of a country's state.
* @returns a random state abbreviation
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.stateAbbreviation())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "AA"
* ```
*/
stateAbbreviation(): string;
/**
* Public road in a city or town, typically with houses and buildings on each side.
* @returns a random street
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.street())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "53883 Villageborough"
* ```
*/
street(): string;
/**
* Name given to a specific road or street.
* @returns a random street name
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.streetName())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Fall"
* ```
*/
streetName(): string;
/**
* Numerical identifier assigned to a street.
* @returns a random street number
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.streetNumber())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "25388"
* ```
*/
streetNumber(): string;
/**
* Directional or descriptive term preceding a street name, like 'East' or 'Main'.
* @returns a random street prefix
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.streetPrefix())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "West"
* ```
*/
streetPrefix(): string;
/**
* Designation at the end of a street name indicating type, like 'Avenue' or 'Street'.
* @returns a random street suffix
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.streetSuffix())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "ville"
* ```
*/
streetSuffix(): string;
/**
* Numerical code for postal address sorting, specific to a geographic area.
* @returns a random zip
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.address.zip())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "25388"
* ```
*/
zip(): string;
}
/**
* Generator to generate animals.
*/
export declare interface Animal {
/**
* Living creature with the ability to move, eat, and interact with its environment.
* @returns a random animal
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.animal.animal())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "crow"
* ```
*/
animal(): string;
/**
* Type of animal, such as mammals, birds, reptiles, etc..
* @returns a random animal type
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.animal.animalType())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "amphibians"
* ```
*/
animalType(): string;
/**
* Distinct species of birds.
* @returns a random bird
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.animal.bird())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "lovebird"
* ```
*/
bird(): string;
/**
* Various breeds that define different cats.
* @returns a random cat
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.animal.cat())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Toyger"
* ```
*/
cat(): string;
/**
* Various breeds that define different dogs.
* @returns a random dog
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.animal.dog())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Staffordshire Bullterrier"
* ```
*/
dog(): string;
/**
* Animal name commonly found on a farm.
* @returns a random farm animal
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.animal.farmAnimal())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Cow"
* ```
*/
farmAnimal(): string;
/**
* Affectionate nickname given to a pet.
* @returns a random pet name
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.animal.petName())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Nacho"
* ```
*/
petName(): string;
}
/**
* Generator to generate application related entries.
*/
export declare interface App {
/**
* Person or group creating and developing an application.
* @returns a random app author
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.app.appAuthor())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Wendell Luettgen"
* ```
*/
appAuthor(): string;
/**
* Software program designed for a specific purpose or task on a computer or mobile device.
* @returns a random app name
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.app.appName())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Hillbe"
* ```
*/
appName(): string;
/**
* Particular release of an application in Semantic Versioning format.
* @returns a random app version
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.app.appVersion())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "5.3.20"
* ```
*/
appVersion(): string;
}
/**
* Generator to generate beer related entries.
*/
export declare interface Beer {
/**
* Measures the alcohol content in beer.
* @returns a random beer alcohol
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerAlcohol())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "6.5%"
* ```
*/
beerAlcohol(): string;
/**
* Scale indicating the concentration of extract in worts.
* @returns a random beer blg
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerBlg())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "13.4°Blg"
* ```
*/
beerBlg(): string;
/**
* The flower used in brewing to add flavor, aroma, and bitterness to beer.
* @returns a random beer hop
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerHop())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Nugget"
* ```
*/
beerHop(): string;
/**
* Scale measuring bitterness of beer from hops.
* @returns a random beer ibu
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerIbu())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "80 IBU"
* ```
*/
beerIbu(): string;
/**
* Processed barley or other grains, provides sugars for fermentation and flavor to beer.
* @returns a random beer malt
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerMalt())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "Roasted barley"
* ```
*/
beerMalt(): string;
/**
* Specific brand or variety of beer.
* @returns a random beer name
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerName())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "90 Minute IPA"
* ```
*/
beerName(): string;
/**
* Distinct characteristics and flavors of beer.
* @returns a random beer style
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerStyle())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "English Brown Ale"
* ```
*/
beerStyle(): string;
/**
* Microorganism used in brewing to ferment sugars, producing alcohol and carbonation in beer.
* @returns a random beer yeast
* @example
* ```ts
*import { Faker } from "k6/x/faker"
*
*let faker = new Faker(11)
*
*export default function () {
* console.log(faker.beer.beerYeast())
*}
*
*```
* **Output** (formatted as JSON value)
*```json
* "2035 - American Lager"