diff --git a/apps/web/src/tests/browser/app/functional/test-data/schema-grid-row-controls.spec.js b/apps/web/src/tests/browser/app/functional/test-data/schema-grid-row-controls.spec.js index 3a70bda4..9affebd7 100644 --- a/apps/web/src/tests/browser/app/functional/test-data/schema-grid-row-controls.spec.js +++ b/apps/web/src/tests/browser/app/functional/test-data/schema-grid-row-controls.spec.js @@ -18,7 +18,7 @@ test.describe('7. Test Data Generation', () => { const schemaText = await appPage.testDataPanel.getSchemaText(); expect(schemaText).toContain('New Column'); - expect(schemaText).toContain('literal()'); + expect(schemaText).toContain('literal("")'); expectNoPageErrors(pageErrors); }); diff --git a/docs-src/blog/2026-05-18-domain-abstraction-over-raw-faker.md b/docs-src/blog/2026-05-18-domain-abstraction-over-raw-faker.md index 12c9cbd3..58cb7eb4 100644 --- a/docs-src/blog/2026-05-18-domain-abstraction-over-raw-faker.md +++ b/docs-src/blog/2026-05-18-domain-abstraction-over-raw-faker.md @@ -6,7 +6,8 @@ tags: [release, architecture, test-data, faker, domain] date: 2026-05-18T10:30 --- -As AnyWayData usage grew across UI, CLI, API, and MCP, we found that directly exposing raw faker calls created avoidable fragility. +As AnyWayData usage grew across UI, CLI, API, and MCP, we found that directly exposing raw faker calls created avoidable fragility. + We moved to a **domain abstraction layer** so schemas describe intent (`internet.email`, `number.int`, `date.recent`) instead of vendor-specific call shapes. diff --git a/docs-src/blog/2026-05-19-string-counterstring-domain-method.md b/docs-src/blog/2026-05-19-string-counterstring-domain-method.md new file mode 100644 index 00000000..9b603bdd --- /dev/null +++ b/docs-src/blog/2026-05-19-string-counterstring-domain-method.md @@ -0,0 +1,71 @@ +--- +slug: string-counterstring-domain-method +title: "Added string.counterString to Domain Test Data" +authors: [alan] +tags: [release, test-data, domain] +--- + +`string.counterString` is now available in the domain model. + +This is the first `string.*` domain addition that is not backed directly by Faker, and is implemented as a custom domain delegate. + + + +## Why add it? + +Counterstrings are useful for field-length and truncation testing because each marker shows its position in the generated text. + +Example pattern: + +`*3*5*7*9*12*15*` + +If we entered the above into a field that truncated to 14 we would see: + +`*3*5*7*9*12*15` - this looks incorrect because I'm expecting to see a number before an `*`, if I see a number without an `*` then I know there has been some truncation. + +## Usage + +`string.counterString(min, max, delimiter="*")` + +- If only one integer is supplied, it is used as both min and max. +- If two integers are supplied, the lower value is used as min and the higher as max. +- Lowest allowed min is `1`. +- Delimiter defaults to `*`. +- If a delimiter longer than one character is passed, only the first character is used. + +Examples: + +```txt +Fixed15 +string.counterString(15) +``` + +```txt +Range5to12 +string.counterString(min=5, max=12) +``` + +```txt +HashDelimited +string.counterString(12, 12, "#") +``` + +## Take Care + +We've added no limits to the length of the counterstrings to take care in your definitions. Sure you can create 1,000,000 rows with counterstrings that are 1,000,000 characters long, but I'm not sure if your computer is going to like generating that. + +We default to a `1-25` character counterstring to mitigate this risk somewhat. + +## Other counterstring resources + +If you are interested in using CounterStrings in your testing then checkout this Chrome extension: + +- https://www.eviltester.com/page/tools/counterstringjs/ + +It allows you to generate counterstrings and other data directly into the browser fields. + +Also more information about CounterStrings here: + +- https://www.satisfice.com/blog/archives/22 +- https://www.eviltester.com/blog/eviltester/news/counterstring-new-version-dec-2025/ +- https://www.eviltester.com/categories/counterstrings/ \ No newline at end of file diff --git a/docs-src/docs/040-test-data/010-test-data-generation.md b/docs-src/docs/040-test-data/010-test-data-generation.md index 8f0e11f2..9815f20e 100644 --- a/docs-src/docs/040-test-data/010-test-data-generation.md +++ b/docs-src/docs/040-test-data/010-test-data-generation.md @@ -45,5 +45,6 @@ Both workflows support generation rules such as: - [Literal Data](/docs/test-data/literal-test-data) - [Regex Based Data](/docs/test-data/regex-test-data) - [Faker Based Data](/docs/test-data/faker-test-data) +- [Counterstrings](/docs/test-data/counterstrings) - [Domain Test Data](/docs/test-data/domain/domain-test-data) - [All Pairs Combinatorial Testing](/docs/test-data/pairwise-testing) - Generate optimal test combinations from enum data diff --git a/docs-src/docs/040-test-data/030-counterstrings.md b/docs-src/docs/040-test-data/030-counterstrings.md new file mode 100644 index 00000000..f786025e --- /dev/null +++ b/docs-src/docs/040-test-data/030-counterstrings.md @@ -0,0 +1,67 @@ +--- +sidebar_position: 30 +title: "Counterstrings" +description: "Use counterstrings to test length limits, truncation, and boundary handling." +--- + +A counterstring is a specially structured string where marker numbers show exact character positions. + +Example of a 15-character counterstring: + +```txt +*3*5*7*9*12*15* +``` + +Each `*` is preceded by the numeric position in the string. So the final `*` is at position 15. + +This makes it easy to see where text is cut off, wrapped, or rejected. + +## Why Use Counterstrings + +Counterstrings are useful for: + +- field length boundary testing +- truncation behavior checks +- UI clipping and overflow diagnostics +- API validation and error-message checks + +## AnyWayData Support + +AnyWayData supports counterstrings through: + +```txt +string.counterString(min, max, delimiter="*") +``` + +Behavior: + +- one integer: fixed length (`min == max`) +- two integers: range (smaller becomes min, larger becomes max) +- minimum effective length is `1` +- delimiter defaults to `*` +- multi-character delimiter uses first character + +Examples: + +```txt +string.counterString(15) +``` + +```txt +string.counterString(5, 12) +``` + +```txt +string.counterString(12, 12, "#") +``` + +## Related Links + +- [string domain reference](/docs/test-data/domain/string) +- [Domain Test Data overview](/docs/test-data/domain/domain-test-data) +- [Counterstring reference implementation](https://github.com/eviltester/counterstringjs/blob/master/extension/js/counterstring.js) +- [James Bach on counterstrings](https://www.satisfice.com/blog/archives/22) +- [CounterString Chrome Extension](https://www.eviltester.com/page/tools/counterstringjs/) +- [Alan Richardson on counterstrings](https://www.eviltester.com/categories/counterstrings/) + + diff --git a/docs-src/docs/040-test-data/domain/000-domain-test-data.md b/docs-src/docs/040-test-data/domain/000-domain-test-data.md index d793c7c0..6f98eb74 100644 --- a/docs-src/docs/040-test-data/domain/000-domain-test-data.md +++ b/docs-src/docs/040-test-data/domain/000-domain-test-data.md @@ -51,6 +51,11 @@ Num number.int(min=32, max=47) ``` +## Migration + +- Before (invalid): `domain.helpers.fake("...")` +- After: `faker.helpers.fake("...")` (or `helpers.fake("...")` in faker contexts) + For faker helper templates and utility functions, use faker helpers: - [Faker Helpers](/docs/test-data/faker/helpers) - [fakerjs.dev/api/helpers](https://fakerjs.dev/api/helpers) diff --git a/docs-src/docs/040-test-data/domain/020-airline.md b/docs-src/docs/040-test-data/domain/020-airline.md index d798b034..e368ee94 100644 --- a/docs-src/docs/040-test-data/domain/020-airline.md +++ b/docs-src/docs/040-test-data/domain/020-airline.md @@ -30,7 +30,7 @@ airline.aircraftType() ``` Example return values: -- `"narrowbody"` +- `regional` ### `airline.airline` @@ -48,8 +48,7 @@ airline.airline() ``` Example return values: -- `{"name":"Air China","iataCode":"CA"}` -- `{"name":"TUI Airways","iataCode":"BY"}` +- `{"name":"American Airlines","iataCode":"AA"}` ### `airline.airline.iataCode` @@ -67,8 +66,7 @@ airline.airline.iataCode() ``` Example return values: -- `"PK"` -- `"MN"` +- `AA` ### `airline.airline.name` @@ -86,8 +84,7 @@ airline.airline.name() ``` Example return values: -- `"Tunisair"` -- `"SunExpress"` +- `Acme Air` ### `airline.airplane` @@ -105,8 +102,7 @@ airline.airplane() ``` Example return values: -- `{"name":"Airbus A380-800","iataTypeCode":"388"}` -- `{"name":"Boeing 747-400","iataTypeCode":"744"}` +- `{"name":"Airbus A320","iataTypeCode":"A320"}` ### `airline.airplane.iataTypeCode` @@ -124,8 +120,7 @@ airline.airplane.iataTypeCode() ``` Example return values: -- `"M81"` -- `"732"` +- `A320` ### `airline.airplane.name` @@ -143,8 +138,7 @@ airline.airplane.name() ``` Example return values: -- `"Boeing 737-200"` -- `"Douglas DC-10"` +- `Boeing 737` ### `airline.airport` @@ -162,8 +156,7 @@ airline.airport() ``` Example return values: -- `{"name":"Noumea Magenta Airport","iataCode":"GEA"}` -- `{"name":"Melbourne International Airport","iataCode":"MEL"}` +- `{"name":"Heathrow Airport","iataCode":"LHR"}` ### `airline.airport.iataCode` @@ -181,8 +174,7 @@ airline.airport.iataCode() ``` Example return values: -- `"HBA"` -- `"AKL"` +- `LHR` ### `airline.airport.name` @@ -200,8 +192,7 @@ airline.airport.name() ``` Example return values: -- `"Chicago O'Hare International Airport"` -- `"Murtala Muhammed International Airport"` +- `London Heathrow Airport` ### `airline.flightNumber` @@ -219,8 +210,7 @@ airline.flightNumber() ``` Example return values: -- `"99"` -- `"15"` +- `1` ### `airline.recordLocator` @@ -238,8 +228,7 @@ airline.recordLocator() ``` Example return values: -- `"HSRWTV"` -- `"BKENFS"` +- `TCSJCN` ### `airline.seat` @@ -263,5 +252,4 @@ airline.seat(aircraftType="narrowbody") ``` Example return values: -- `"23D"` -- `"9E"` +- `17F` diff --git a/docs-src/docs/040-test-data/domain/030-animal.md b/docs-src/docs/040-test-data/domain/030-animal.md index b84a8ac9..d5c8d46a 100644 --- a/docs-src/docs/040-test-data/domain/030-animal.md +++ b/docs-src/docs/040-test-data/domain/030-animal.md @@ -30,8 +30,7 @@ animal.bear() ``` Example return values: -- `"Sloth bear"` -- `"Giant panda"` +- `Sloth bear` ### `animal.bird` @@ -49,8 +48,7 @@ animal.bird() ``` Example return values: -- `"Tropical Parula"` -- `"Cactus Wren"` +- `Orange-crowned Warbler` ### `animal.cat` @@ -68,8 +66,7 @@ animal.cat() ``` Example return values: -- `"Japanese Bobtail"` -- `"Russian Blue"` +- `Russian Blue` ### `animal.cetacean` @@ -87,8 +84,7 @@ animal.cetacean() ``` Example return values: -- `"Striped Dolphin"` -- `"Spinner Dolphin"` +- `Hector’s Dolphin` ### `animal.cow` @@ -106,8 +102,7 @@ animal.cow() ``` Example return values: -- `"Dwarf Lulu"` -- `"Pulikulam"` +- `Aubrac` ### `animal.crocodilia` @@ -125,8 +120,7 @@ animal.crocodilia() ``` Example return values: -- `"Cuvier’s Dwarf Caiman"` -- `"Yacare Caiman"` +- `Nile Crocodile` ### `animal.dog` @@ -144,8 +138,7 @@ animal.dog() ``` Example return values: -- `"Poitevin"` -- `"Lancashire Heeler"` +- `Jonangi` ### `animal.fish` @@ -163,8 +156,7 @@ animal.fish() ``` Example return values: -- `"Nile perch"` -- `"Short mackerel"` +- `Short mackerel` ### `animal.horse` @@ -182,8 +174,7 @@ animal.horse() ``` Example return values: -- `"Noriker Horse"` -- `"Kathiawari"` +- `Rottaler` ### `animal.insect` @@ -201,8 +192,7 @@ animal.insect() ``` Example return values: -- `"Silky ant"` -- `"Red ant"` +- `Pigeon tremex` ### `animal.lion` @@ -220,8 +210,7 @@ animal.lion() ``` Example return values: -- `"West African Lion"` -- `"Northeast Congo Lion"` +- `Masai Lion` ### `animal.petName` @@ -239,8 +228,7 @@ animal.petName() ``` Example return values: -- `"Ollie"` -- `"Bentley"` +- `Stella` ### `animal.rabbit` @@ -258,8 +246,7 @@ animal.rabbit() ``` Example return values: -- `"French Lop"` -- `"English Angora"` +- `Californian` ### `animal.rodent` @@ -277,8 +264,7 @@ animal.rodent() ``` Example return values: -- `"Strong tuco-tuco"` -- `"Bennett's chinchilla rat"` +- `Natterer's tuco-tuco` ### `animal.snake` @@ -296,8 +282,7 @@ animal.snake() ``` Example return values: -- `"Green tree pit viper"` -- `"Western ground snake"` +- `White-lipped python` ### `animal.type` @@ -315,5 +300,4 @@ animal.type() ``` Example return values: -- `"snake"` -- `"zebra"` +- `bear` diff --git a/docs-src/docs/040-test-data/domain/040-book.md b/docs-src/docs/040-test-data/domain/040-book.md index 228f71b7..436eb8ab 100644 --- a/docs-src/docs/040-test-data/domain/040-book.md +++ b/docs-src/docs/040-test-data/domain/040-book.md @@ -30,8 +30,7 @@ book.author() ``` Example return values: -- `"Jack Kerouac"` -- `"Jules Verne"` +- `Jacqueline Crooks` ### `book.format` @@ -49,8 +48,7 @@ book.format() ``` Example return values: -- `"Hardcover"` -- `"Paperback"` +- `Paperback` ### `book.genre` @@ -68,8 +66,7 @@ book.genre() ``` Example return values: -- `"Western"` -- `"Romance"` +- `Science Fiction` ### `book.publisher` @@ -87,8 +84,7 @@ book.publisher() ``` Example return values: -- `"Farrar, Straus & Giroux"` -- `"Bowes & Bowes"` +- `Butterworth-Heinemann` ### `book.series` @@ -106,8 +102,7 @@ book.series() ``` Example return values: -- `"The Dresden Files"` -- `"The Inheritance Cycle"` +- `The Inheritance Cycle` ### `book.title` @@ -125,5 +120,4 @@ book.title() ``` Example return values: -- `"Nineteen Eighty Four"` -- `"Bible"` +- `Animal Farm` diff --git a/docs-src/docs/040-test-data/domain/050-color.md b/docs-src/docs/040-test-data/domain/050-color.md index d021bd0a..0fb0e501 100644 --- a/docs-src/docs/040-test-data/domain/050-color.md +++ b/docs-src/docs/040-test-data/domain/050-color.md @@ -36,8 +36,7 @@ color.cmyk(format="hex") ``` Example return values: -- `[0.57,0.01,0.18,0.59]` -- `[0.56,0.85,0.64,0.2]` +- `[0.95,0.17,0.23,1]` ### `color.colorByCSSColorSpace` @@ -55,8 +54,7 @@ color.colorByCSSColorSpace() ``` Example return values: -- `[0.292,0.4075,0.5189]` -- `[0.0782,0.9207,0.6424]` +- `[0.5811,0.0479,0.1091]` ### `color.cssSupportedFunction` @@ -74,8 +72,7 @@ color.cssSupportedFunction() ``` Example return values: -- `"color"` -- `"rgba"` +- `hsla` ### `color.cssSupportedSpace` @@ -93,7 +90,7 @@ color.cssSupportedSpace() ``` Example return values: -- `"rec2020"` +- `sRGB` ### `color.hsl` @@ -118,8 +115,7 @@ color.hsl(format="hex", includeAlpha=true) ``` Example return values: -- `[109,0.86,0.08]` -- `[215,0.5,0.99]` +- `[212,0.78,0.54]` ### `color.human` @@ -137,8 +133,7 @@ color.human() ``` Example return values: -- `"orange"` -- `"black"` +- `green` ### `color.hwb` @@ -162,8 +157,7 @@ color.hwb(format="hex") ``` Example return values: -- `[324,0.03,0.76]` -- `[80,0.93,0.73]` +- `[328,0.27,0.33]` ### `color.lab` @@ -187,12 +181,11 @@ color.lab(format="hex") ``` Example return values: -- `[0.408016,47.4015,-64.2527]` -- `[0.935836,-55.9594,38.016]` +- `[0.071396,-55.6612,-66.7185]` ### `color.lch` -Returns a random LCH color value. +Returns an LCH color. - Canonical: `awd.domain.color.lch` - Faker docs: [https://fakerjs.dev/api/color](https://fakerjs.dev/api/color) @@ -212,8 +205,7 @@ color.lch(format="hex") ``` Example return values: -- `[0.770606,67.4,171.2]` -- `[0.241599,78.8,2.4]` +- `[0.469557,212.9,204.9]` ### `color.rgb` @@ -240,8 +232,7 @@ color.rgb(casing="lower", format="hex", includeAlpha=true, prefix="#") ``` Example return values: -- `"#d9a378"` -- `"#d8cd14"` +- `#ee8222` ### `color.space` @@ -259,5 +250,4 @@ color.space() ``` Example return values: -- `"Pantone Matching System (PMS)"` -- `"ProPhoto RGB Color Space"` +- `HSL` diff --git a/docs-src/docs/040-test-data/domain/060-commerce.md b/docs-src/docs/040-test-data/domain/060-commerce.md index 03d63d32..95f7e850 100644 --- a/docs-src/docs/040-test-data/domain/060-commerce.md +++ b/docs-src/docs/040-test-data/domain/060-commerce.md @@ -30,8 +30,7 @@ commerce.department() ``` Example return values: -- `"Industrial"` -- `"Baby"` +- `Tools` ### `commerce.isbn` @@ -42,8 +41,8 @@ Returns a random ISBN identifier. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `separator` | `string` | no | Character inserted between ISBN groups (for example `-`). | -| `variant` | `string` | no | ISBN length variant: use `"10"` for ISBN-10 or `"13"` for ISBN-13. | +| `separator` | `string` | no | Separator inserted between generated items. | +| `variant` | `string` | no | ISBN length variant: use "10" for ISBN-10 or "13" for ISBN-13. | Examples: @@ -56,8 +55,7 @@ commerce.isbn(separator="-", variant="13") ``` Example return values: -- `"978-1-74663-962-4"` -- `"978-1-158-06239-3"` +- `978-1-996134-54-2` ### `commerce.price` @@ -84,8 +82,7 @@ commerce.price(dec=1, max=1, min=1, symbol="$") ``` Example return values: -- `"348.35"` -- `"818.69"` +- `797.39` ### `commerce.product` @@ -103,8 +100,7 @@ commerce.product() ``` Example return values: -- `"Salad"` -- `"Pants"` +- `Bike` ### `commerce.productAdjective` @@ -122,8 +118,7 @@ commerce.productAdjective() ``` Example return values: -- `"Modern"` -- `"Tasty"` +- `Luxurious` ### `commerce.productDescription` @@ -141,8 +136,7 @@ commerce.productDescription() ``` Example return values: -- `"Roob - Wehner's most advanced Tuna technology increases concrete capabilities"` -- `"Stylish Car designed to make you stand out with impossible looks"` +- `The green Hat combines Colombia aesthetics with Scandium-based durability` ### `commerce.productMaterial` @@ -160,8 +154,7 @@ commerce.productMaterial() ``` Example return values: -- `"Bamboo"` -- `"Plastic"` +- `Steel` ### `commerce.productName` @@ -179,5 +172,4 @@ commerce.productName() ``` Example return values: -- `"Soft Gold Shoes"` -- `"Recycled Concrete Bike"` +- `Soft Bronze Towels` diff --git a/docs-src/docs/040-test-data/domain/070-company.md b/docs-src/docs/040-test-data/domain/070-company.md index 96387b97..8e2ff24e 100644 --- a/docs-src/docs/040-test-data/domain/070-company.md +++ b/docs-src/docs/040-test-data/domain/070-company.md @@ -30,8 +30,7 @@ company.buzzAdjective() ``` Example return values: -- `"cutting-edge"` -- `"24/7"` +- `out-of-the-box` ### `company.buzzNoun` @@ -49,8 +48,7 @@ company.buzzNoun() ``` Example return values: -- `"architectures"` -- `"supply-chains"` +- `deliverables` ### `company.buzzPhrase` @@ -68,8 +66,7 @@ company.buzzPhrase() ``` Example return values: -- `"empower sticky synergies"` -- `"empower robust mindshare"` +- `streamline cutting-edge platforms` ### `company.buzzVerb` @@ -87,8 +84,7 @@ company.buzzVerb() ``` Example return values: -- `"disintermediate"` -- `"optimize"` +- `disintermediate` ### `company.catchPhrase` @@ -106,8 +102,7 @@ company.catchPhrase() ``` Example return values: -- `"Cross-platform maximized hardware"` -- `"Monitored sustainable customer loyalty"` +- `Diverse AI-powered flexibility` ### `company.catchPhraseAdjective` @@ -125,8 +120,7 @@ company.catchPhraseAdjective() ``` Example return values: -- `"Virtual"` -- `"Face to face"` +- `Distributed` ### `company.catchPhraseDescriptor` @@ -144,8 +138,7 @@ company.catchPhraseDescriptor() ``` Example return values: -- `"leading edge"` -- `"asynchronous"` +- `encompassing` ### `company.catchPhraseNoun` @@ -163,8 +156,7 @@ company.catchPhraseNoun() ``` Example return values: -- `"pricing structure"` -- `"capability"` +- `attitude` ### `company.name` @@ -182,5 +174,4 @@ company.name() ``` Example return values: -- `"Hudson, Rogahn and Hane"` -- `"Monahan, Boyle and Crona"` +- `Lang - Little` diff --git a/docs-src/docs/040-test-data/domain/080-database.md b/docs-src/docs/040-test-data/domain/080-database.md index e66bf50c..0e2747e5 100644 --- a/docs-src/docs/040-test-data/domain/080-database.md +++ b/docs-src/docs/040-test-data/domain/080-database.md @@ -30,8 +30,7 @@ database.collation() ``` Example return values: -- `"ascii_bin"` -- `"ascii_general_ci"` +- `utf8_bin` ### `database.column` @@ -49,8 +48,7 @@ database.column() ``` Example return values: -- `"id"` -- `"updatedAt"` +- `status` ### `database.engine` @@ -68,8 +66,7 @@ database.engine() ``` Example return values: -- `"MyISAM"` -- `"BLACKHOLE"` +- `ARCHIVE` ### `database.mongodbObjectId` @@ -87,8 +84,7 @@ database.mongodbObjectId() ``` Example return values: -- `"3ef8f1042addecfc81fd98f9"` -- `"b1c85eb686a0a96e1ebbefdf"` +- `e80bba2ae67c0c7dcc16bd57` ### `database.type` @@ -106,5 +102,4 @@ database.type() ``` Example return values: -- `"enum"` -- `"bigint"` +- `smallint` diff --git a/docs-src/docs/040-test-data/domain/090-datatype.md b/docs-src/docs/040-test-data/domain/090-datatype.md index 35e5fcbc..4515c7ac 100644 --- a/docs-src/docs/040-test-data/domain/090-datatype.md +++ b/docs-src/docs/040-test-data/domain/090-datatype.md @@ -23,8 +23,7 @@ Returns the boolean value true or false. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `probability` | `number` | no | Probability threshold for returning `true` (between `0` and `1`). | -| `value` | `number` | no | Numeric toggle for deterministic output: 0 returns false and 1 returns true. | +| `probability` | `number` | no | Probability threshold for returning true (between 0 and 1). | Examples: @@ -33,7 +32,7 @@ datatype.boolean() ``` ```txt -datatype.boolean(probability=1, value=1) +datatype.boolean(probability=1) ``` Example return values: diff --git a/docs-src/docs/040-test-data/domain/100-date.md b/docs-src/docs/040-test-data/domain/100-date.md index e59cb1fb..27c7abad 100644 --- a/docs-src/docs/040-test-data/domain/100-date.md +++ b/docs-src/docs/040-test-data/domain/100-date.md @@ -36,8 +36,7 @@ date.anytime(refDate=1) ``` Example return values: -- `"2025-11-22T12:30:53.535Z"` -- `"2026-03-09T05:03:13.667Z"` +- `"2026-12-25T08:55:20.593Z"` ### `date.between` @@ -62,8 +61,7 @@ date.between(from=1, to=1) ``` Example return values: -- `"2001-01-03T09:27:56.772Z"` -- `"1988-04-02T17:24:17.440Z"` +- `2026-01-15T12:34:56.000Z` ### `date.betweens` @@ -89,8 +87,7 @@ date.betweens(count=1, from=1, to=1) ``` Example return values: -- `["1975-03-18T01:28:47.047Z","2005-08-03T07:55:22.524Z"]` -- `["1976-12-05T16:33:40.049Z","1978-06-04T00:02:41.826Z"]` +- `["2026-01-15T12:34:56.000Z","2026-02-01T09:00:00.000Z"]` ### `date.birthdate` @@ -117,8 +114,7 @@ date.birthdate(refDate=1, max=1, min=1, mode="age") ``` Example return values: -- `"1955-05-18T19:25:36.178Z"` -- `"1993-02-06T15:43:56.865Z"` +- `"1966-09-18T08:47:31.333Z"` ### `date.future` @@ -143,8 +139,7 @@ date.future(refDate=1, years=1) ``` Example return values: -- `"2026-10-12T16:19:33.811Z"` -- `"2026-11-24T03:18:00.421Z"` +- `"2027-02-07T18:41:48.525Z"` ### `date.month` @@ -169,8 +164,7 @@ date.month(abbreviated=false, context=false) ``` Example return values: -- `"May"` -- `"August"` +- `February` ### `date.past` @@ -195,8 +189,7 @@ date.past(refDate=1, years=1) ``` Example return values: -- `"2025-11-21T11:30:51.789Z"` -- `"2026-02-13T14:19:21.153Z"` +- `"2025-07-01T11:48:55.347Z"` ### `date.recent` @@ -221,8 +214,7 @@ date.recent(days=1, refDate=1) ``` Example return values: -- `"2026-05-17T13:46:00.558Z"` -- `"2026-05-17T22:45:20.752Z"` +- `"2026-04-27T23:46:16.707Z"` ### `date.soon` @@ -247,8 +239,7 @@ date.soon(days=1, refDate=1) ``` Example return values: -- `"2026-05-18T15:47:09.312Z"` -- `"2026-05-19T10:48:13.424Z"` +- `"2026-04-29T11:09:09.211Z"` ### `date.timeZone` @@ -266,8 +257,7 @@ date.timeZone() ``` Example return values: -- `"Europe/Amsterdam"` -- `"America/Juneau"` +- `Europe/Stockholm` ### `date.weekday` @@ -292,5 +282,4 @@ date.weekday(abbreviated=false, context=false) ``` Example return values: -- `"Thursday"` -- `"Tuesday"` +- `Tuesday` diff --git a/docs-src/docs/040-test-data/domain/110-finance.md b/docs-src/docs/040-test-data/domain/110-finance.md index 191c1054..75ca9ef8 100644 --- a/docs-src/docs/040-test-data/domain/110-finance.md +++ b/docs-src/docs/040-test-data/domain/110-finance.md @@ -30,8 +30,7 @@ finance.accountName() ``` Example return values: -- `"Savings Account"` -- `"Home Loan Account"` +- `Investment Account` ### `finance.accountNumber` @@ -55,8 +54,7 @@ finance.accountNumber(length=1) ``` Example return values: -- `"49018866"` -- `"60456794"` +- `43208795` ### `finance.amount` @@ -84,8 +82,7 @@ finance.amount(autoFormat=true, dec=1, max=1, min=1, symbol="$") ``` Example return values: -- `"149.16"` -- `"691.98"` +- `536.86` ### `finance.bic` @@ -109,8 +106,7 @@ finance.bic(includeBranchCode=true) ``` Example return values: -- `"JAHFCDRAXXX"` -- `"HDJFBRUQ"` +- `TXWRPYFT` ### `finance.bitcoinAddress` @@ -128,8 +124,7 @@ finance.bitcoinAddress() ``` Example return values: -- `"bc1pzsw5kl430n3mlhd5snxf8jsn8w8pkn5szswd2vdgswryyd6reuhljezh79"` -- `"bc1y7ndstl65j0lqw6zn65e7c2aglznrqyect4sejh"` +- `39fu5Nhnibj2xa8FPVxCbX7y4xZi5SWd` ### `finance.creditCardCVV` @@ -147,8 +142,7 @@ finance.creditCardCVV() ``` Example return values: -- `"642"` -- `"505"` +- `839` ### `finance.creditCardIssuer` @@ -166,8 +160,7 @@ finance.creditCardIssuer() ``` Example return values: -- `"diners_club"` -- `"discover"` +- `jcb` ### `finance.creditCardNumber` @@ -187,12 +180,11 @@ finance.creditCardNumber() ``` ```txt -finance.creditCardNumber(issuer="visa") +finance.creditCardNumber(issuer="value") ``` Example return values: -- `"4253595338386"` -- `"3680-760929-2509"` +- `6449-4462-4996-7580` ### `finance.currency` @@ -210,8 +202,7 @@ finance.currency() ``` Example return values: -- `{"name":"Pakistan Rupee","code":"PKR","symbol":"₨","numericCode":"586"}` -- `{"name":"Bahraini Dinar","code":"BHD","symbol":"","numericCode":"048"}` +- `{"name":"Rial Omani","code":"OMR","symbol":"﷼","numericCode":"512"}` ### `finance.currencyCode` @@ -229,8 +220,7 @@ finance.currencyCode() ``` Example return values: -- `"HNL"` -- `"VND"` +- `ISK` ### `finance.currencyName` @@ -248,8 +238,7 @@ finance.currencyName() ``` Example return values: -- `"Tugrik"` -- `"Lilangeni"` +- `South Sudanese pound` ### `finance.currencyNumericCode` @@ -267,7 +256,7 @@ finance.currencyNumericCode() ``` Example return values: -- `"784"` +- `270` ### `finance.currencySymbol` @@ -285,8 +274,7 @@ finance.currencySymbol() ``` Example return values: -- `"₨"` -- `"kr"` +- `₩` ### `finance.ethereumAddress` @@ -304,8 +292,7 @@ finance.ethereumAddress() ``` Example return values: -- `"0x607cf8c49d90bd4d367fd5dc2fc4af6bebdedf17"` -- `"0xff0d2ab192cfbeb8ebcd74c4306eceb3f150ae70"` +- `0xf5d385aff27de9dee6eeeffd924ffd7dd2d252ca` ### `finance.iban` @@ -330,8 +317,7 @@ finance.iban(countryCode="GB", formatted=true) ``` Example return values: -- `"IE60XZAD39998435857068"` -- `"NO1827072008009"` +- `CH67001759079BP5WA811` ### `finance.litecoinAddress` @@ -349,8 +335,7 @@ finance.litecoinAddress() ``` Example return values: -- `"Mx5xmnGzMKFjCoEa4sP7AtsMHWMqY1M7a"` -- `"MUt8eNXLSYpeiDoKiTof8BetGJpuM"` +- `M7nWopfUfSjA8cmGWvuENRLu6GU4C1iTK` ### `finance.maskedNumber` @@ -374,8 +359,7 @@ finance.maskedNumber(length=1) ``` Example return values: -- `"(...0214)"` -- `"(...5189)"` +- `(...0934)` ### `finance.pin` @@ -399,8 +383,7 @@ finance.pin(length=1) ``` Example return values: -- `"3243"` -- `"9247"` +- `1107` ### `finance.routingNumber` @@ -418,8 +401,7 @@ finance.routingNumber() ``` Example return values: -- `"128948329"` -- `"799587533"` +- `933657999` ### `finance.transactionDescription` @@ -437,8 +419,7 @@ finance.transactionDescription() ``` Example return values: -- `"Your deposit of YER 512.78 at Schoen and Sons was successful. Charged via card ****1684 to account ***5866."` -- `"payment at Gislason, Herzog and Ankunding with a card ending in ****9045 for PYG 683.99 from account ***3048."` +- `Transaction alert: deposit at Jones LLC using card ending ****4221 for an amount of GIP 94.88 on account ***3694.` ### `finance.transactionType` @@ -456,5 +437,4 @@ finance.transactionType() ``` Example return values: -- `"deposit"` -- `"payment"` +- `deposit` diff --git a/docs-src/docs/040-test-data/domain/120-food.md b/docs-src/docs/040-test-data/domain/120-food.md index 7844a5e6..ac3e2232 100644 --- a/docs-src/docs/040-test-data/domain/120-food.md +++ b/docs-src/docs/040-test-data/domain/120-food.md @@ -30,8 +30,7 @@ food.adjective() ``` Example return values: -- `"tangy"` -- `"juicy"` +- `salty` ### `food.description` @@ -49,8 +48,7 @@ food.description() ``` Example return values: -- `"Grilled venison kebabs, marinated in Mangalorean spices and served with a fresh rhubarb and blueberry salad."` -- `"A slow-roasted Willow Ptarmigan with a zesty, crunchy exterior. Stuffed with banana and covered in papaw sauce. Sides with broccoli puree and wild jicama."` +- `Fresh mixed greens tossed with pimento-rubbed pigeon, bean shoots, and a light dressing.` ### `food.dish` @@ -68,8 +66,7 @@ food.dish() ``` Example return values: -- `"German Chamomile-crusted Salmon"` -- `"Linguine With Clams"` +- `Chicken Fajitas` ### `food.ethnicCategory` @@ -87,8 +84,7 @@ food.ethnicCategory() ``` Example return values: -- `"Korean"` -- `"Keralite"` +- `Lithuanian` ### `food.fruit` @@ -106,8 +102,7 @@ food.fruit() ``` Example return values: -- `"mango"` -- `"sultana"` +- `snowpea` ### `food.ingredient` @@ -125,8 +120,7 @@ food.ingredient() ``` Example return values: -- `"taleggio cheese"` -- `"freekeh"` +- `spelt` ### `food.meat` @@ -144,8 +138,7 @@ food.meat() ``` Example return values: -- `"turkey"` -- `"venison"` +- `goose` ### `food.spice` @@ -163,8 +156,7 @@ food.spice() ``` Example return values: -- `"lime leaves"` -- `"paprika"` +- `poudre de colombo` ### `food.vegetable` @@ -182,5 +174,4 @@ food.vegetable() ``` Example return values: -- `"cabbage"` -- `"leeks"` +- `snowpea sprouts` diff --git a/docs-src/docs/040-test-data/domain/130-git.md b/docs-src/docs/040-test-data/domain/130-git.md index 0e714127..0d8954d9 100644 --- a/docs-src/docs/040-test-data/domain/130-git.md +++ b/docs-src/docs/040-test-data/domain/130-git.md @@ -30,8 +30,7 @@ git.branch() ``` Example return values: -- `"port-back-up"` -- `"monitor-calculate"` +- `array-compress` ### `git.commitDate` @@ -49,8 +48,7 @@ git.commitDate() ``` Example return values: -- `"Mon May 18 10:31:49 2026 -0300"` -- `"Mon May 18 08:25:50 2026 -0300"` +- `Tue Apr 28 04:28:58 2026 -0600` ### `git.commitEntry` @@ -68,8 +66,7 @@ git.commitEntry() ``` Example return values: -- `"commit b5bd65a287afbb55f0ce52ccf56f00acd5bfdbc6\r\nMerge: 7eddb5c d1385a7\r\nAuthor: Maynard.VonRueden59 \r\nDate: Mon May 18 05:26:35 2026 +0400\r\n\r\n    calculate online bandwidth\r\n"` -- `"commit 8d3253e2df2dad3cb16fe329322d9ed0b827bb2c\r\nAuthor: Taryn Heathcote \r\nDate: Mon May 18 09:17:13 2026 +0900\r\n\r\n    navigate cross-platform hard drive\r\n"` +- `commit 4f9a2d1c Author: Alex Example Date: Tue May 19 2026` ### `git.commitMessage` @@ -87,8 +84,7 @@ git.commitMessage() ``` Example return values: -- `"input open-source protocol"` -- `"input open-source hard drive"` +- `reboot cross-platform system` ### `git.commitSha` @@ -106,5 +102,4 @@ git.commitSha() ``` Example return values: -- `"034feebce56b2ced832476474ccaaa53559f90ac"` -- `"02c65f4ffa24625ae53c999dd6d75208eaf9191d"` +- `3418f0e64e8eae52ebd67b11d98e571fd6a81017` diff --git a/docs-src/docs/040-test-data/domain/140-hacker.md b/docs-src/docs/040-test-data/domain/140-hacker.md index df97bc83..0a186310 100644 --- a/docs-src/docs/040-test-data/domain/140-hacker.md +++ b/docs-src/docs/040-test-data/domain/140-hacker.md @@ -30,8 +30,7 @@ hacker.abbreviation() ``` Example return values: -- `"TLS"` -- `"SSD"` +- `GB` ### `hacker.adjective` @@ -49,8 +48,7 @@ hacker.adjective() ``` Example return values: -- `"optical"` -- `"auxiliary"` +- `bluetooth` ### `hacker.ingverb` @@ -68,8 +66,7 @@ hacker.ingverb() ``` Example return values: -- `"parsing"` -- `"compressing"` +- `synthesizing` ### `hacker.noun` @@ -87,7 +84,7 @@ hacker.noun() ``` Example return values: -- `"transmitter"` +- `program` ### `hacker.phrase` @@ -105,8 +102,7 @@ hacker.phrase() ``` Example return values: -- `"The TCP bus is down, synthesize the auxiliary feed so we can transmit the SSD capacitor!"` -- `"I'll back up the redundant HEX application, that should panel the SQL interface!"` +- `compressing the application won't do anything, we need to reboot the neural JSON hard drive!` ### `hacker.verb` @@ -124,5 +120,4 @@ hacker.verb() ``` Example return values: -- `"copy"` -- `"transmit"` +- `program` diff --git a/docs-src/docs/040-test-data/domain/150-image.md b/docs-src/docs/040-test-data/domain/150-image.md index 6d61c3c2..f671590f 100644 --- a/docs-src/docs/040-test-data/domain/150-image.md +++ b/docs-src/docs/040-test-data/domain/150-image.md @@ -30,8 +30,7 @@ image.avatar() ``` Example return values: -- `"https://avatars.githubusercontent.com/u/4737631"` -- `"https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/male/512/74.jpg"` +- `https://avatars.githubusercontent.com/u/2389220` ### `image.avatarGitHub` @@ -49,8 +48,7 @@ image.avatarGitHub() ``` Example return values: -- `"https://avatars.githubusercontent.com/u/21478609"` -- `"https://avatars.githubusercontent.com/u/94618277"` +- `https://avatars.githubusercontent.com/u/22969292` ### `image.avatarLegacy` @@ -68,8 +66,7 @@ image.avatarLegacy() ``` Example return values: -- `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/498.jpg"` -- `"https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/217.jpg"` +- `https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1198.jpg` ### `image.dataUri` @@ -87,8 +84,7 @@ image.dataUri() ``` Example return values: -- `"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%222411%22%20height%3D%222600%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22%23d474ad%22%2F%3E%3Ctext%20x%3D%221205.5%22%20y%3D%221300%22%20font-size%3D%2220%22%20alignment-baseline%3D%22middle%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%3E2411x2600%3C%2Ftext%3E%3C%2Fsvg%3E"` -- `"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20baseProfile%3D%22full%22%20width%3D%222648%22%20height%3D%223613%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22%23fe202c%22%2F%3E%3Ctext%20x%3D%221324%22%20y%3D%221806.5%22%20font-size%3D%2220%22%20alignment-baseline%3D%22middle%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%3E2648x3613%3C%2Ftext%3E%3C%2Fsvg%3E"` +- `data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4=` ### `image.personPortrait` @@ -106,8 +102,7 @@ image.personPortrait() ``` Example return values: -- `"https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/97.jpg"` -- `"https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/72.jpg"` +- `https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/99.jpg` ### `image.url` @@ -132,8 +127,7 @@ image.url(height=1, width=1) ``` Example return values: -- `"https://loremflickr.com/2047/2524?lock=8418418111332618"` -- `"https://loremflickr.com/3726/3449?lock=1810011656215161"` +- `https://loremflickr.com/3255/509?lock=5223276893828872` ### `image.urlLoremFlickr` @@ -151,8 +145,7 @@ image.urlLoremFlickr() ``` Example return values: -- `"https://loremflickr.com/3246/1034?lock=1014047844060749"` -- `"https://loremflickr.com/89/2631?lock=4768337721421349"` +- `https://loremflickr.com/3966/3602?lock=6417693540486546` ### `image.urlPicsumPhotos` @@ -170,8 +163,7 @@ image.urlPicsumPhotos() ``` Example return values: -- `"https://picsum.photos/seed/s2F0L/2185/1092?blur=7"` -- `"https://picsum.photos/seed/BGb8i/639/1119?blur=6"` +- `https://picsum.photos/seed/UBLQun43/2068/162?blur=8` ### `image.urlPlaceholder` @@ -189,5 +181,4 @@ image.urlPlaceholder() ``` Example return values: -- `"https://via.placeholder.com/954x3055/45ad7e/fcd4eb.png?text=incidunt%20eos%20id"` -- `"https://via.placeholder.com/234x1659/9dd0fd/de5f36.gif?text=agnitio%20decretum%20undique"` +- `https://via.placeholder.com/2302x1759/a80adf/2de69f.gif?text=utrimque%20summa%20dolores` diff --git a/docs-src/docs/040-test-data/domain/160-internet.md b/docs-src/docs/040-test-data/domain/160-internet.md index 1857ecd3..62b230ff 100644 --- a/docs-src/docs/040-test-data/domain/160-internet.md +++ b/docs-src/docs/040-test-data/domain/160-internet.md @@ -30,8 +30,7 @@ internet.color() ``` Example return values: -- `"#2d5c7d"` -- `"#604136"` +- `#290551` ### `internet.displayName` @@ -49,8 +48,7 @@ internet.displayName() ``` Example return values: -- `"Donna_Willms14"` -- `"Glenna70"` +- `Cordell0` ### `internet.domainName` @@ -68,8 +66,7 @@ internet.domainName() ``` Example return values: -- `"carefree-kiss.net"` -- `"monumental-independence.net"` +- `beloved-peony.org` ### `internet.domainSuffix` @@ -87,8 +84,7 @@ internet.domainSuffix() ``` Example return values: -- `"name"` -- `"org"` +- `com` ### `internet.domainWord` @@ -106,8 +102,7 @@ internet.domainWord() ``` Example return values: -- `"wry-outset"` -- `"oily-paintwork"` +- `inexperienced-ravioli` ### `internet.email` @@ -130,12 +125,11 @@ internet.email() ``` ```txt -internet.email(allowSpecialCharacters=true, firstName="Alex", lastName="Taylor", provider="gmail.com") +internet.email(allowSpecialCharacters=true, firstName="Alex", lastName="Taylor", provider="example.com") ``` Example return values: -- `"Mayra65@gmail.com"` -- `"Antone_Kub87@hotmail.com"` +- `Jana91@hotmail.com` ### `internet.emoji` @@ -159,8 +153,7 @@ internet.emoji(types=["food","nature"]) ``` Example return values: -- `"🥑"` -- `"👜"` +- `🤨` ### `internet.exampleEmail` @@ -178,8 +171,7 @@ internet.exampleEmail() ``` Example return values: -- `"Spencer_Mante@example.com"` -- `"Madison.Kub29@example.org"` +- `Jeremie37@example.net` ### `internet.httpMethod` @@ -197,8 +189,7 @@ internet.httpMethod() ``` Example return values: -- `"PUT"` -- `"DELETE"` +- `PATCH` ### `internet.httpStatusCode` @@ -216,8 +207,7 @@ internet.httpStatusCode() ``` Example return values: -- `505` -- `506` +- `303` ### `internet.ip` @@ -235,8 +225,7 @@ internet.ip() ``` Example return values: -- `"8eb3:eb0b:23f8:24af:dab0:32ff:b9e8:dfcb"` -- `"224.35.99.161"` +- `56.23.30.52` ### `internet.ipv4` @@ -261,8 +250,7 @@ internet.ipv4(cidrBlock="192.168.0.0/24", network="private-a") ``` Example return values: -- `"66.234.157.133"` -- `"87.85.6.113"` +- `192.168.0.42` ### `internet.ipv6` @@ -280,8 +268,7 @@ internet.ipv6() ``` Example return values: -- `"efab:dbdb:dbc0:f3ed:4fc0:be73:ec76:08ac"` -- `"8ccb:adb2:6eb1:eb7e:e6eb:bc3c:cd92:a021"` +- `2001:0db8:85a3:0000:0000:8a2e:0370:7334` ### `internet.jwt` @@ -292,8 +279,8 @@ Generates a random JWT (JSON Web Token). | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `header` | `array` | no | The header to use for the token. If present, it will replace any default values. | -| `payload` | `array` | no | The payload to use for the token. If present, it will replace any default values. | +| `header` | `object` | no | The header to use for the token. If present, it will replace any default values. | +| `payload` | `object` | no | The payload to use for the token. If present, it will replace any default values. | | `refDate` | `number` | no | Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor. | Examples: @@ -303,12 +290,11 @@ internet.jwt() ``` ```txt -internet.jwt(header=["sample"], payload=["sample"], refDate=1) +internet.jwt(header={"alg":"HS256","typ":"JWT"}, payload={"iss":"Acme"}, refDate=1) ``` Example return values: -- `"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzkxMDUxODQsImV4cCI6MTc3OTExNjI0MCwibmJmIjoxNzU2MzczMzM2LCJpc3MiOiJIdWRzb24gSW5jIiwic3ViIjoiZDE3MTJkYzQtYjZlZi00MTA2LWIxYzUtNjlmNDJiNjljMjZjIiwiYXVkIjoiYzdlNjliODYtOWE4OS00MDZmLTgzYWItMDkzYzQ5MWNmZjQyIiwianRpIjoiMDI0NjNhNGUtMWNhNy00MGE2LWI1ZDktZGJjNTYyZWNjNDFiIn0.Gs8gUfYlSgDoJOaDI2NoNEfyMG0UUL88TkJApQkhFjIBD66avEjmn0BWxPHOq3Ub"` -- `"eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzkwMjE1NDUsImV4cCI6MTc3OTA2MzMzMCwibmJmIjoxNzQ4Mjg4OTI2LCJpc3MiOiJWYW5kZXJ2b3J0LCBSb2JlbCBhbmQgQWx0ZW53ZXJ0aCIsInN1YiI6ImJkODUwNTg1LTI1YTAtNDAwOC04OWEzLTcwMDgyNGE2YjY5ZiIsImF1ZCI6IjhhYThhYzM0LWM1ZDgtNDdiZi1iMjVkLWE1MzI5NjVmMjdjNyIsImp0aSI6IjRlMjE3MDllLTg4ZGUtNDk1Ny04MzZmLTJiMTY3ODkzNDExZiJ9.o2Mmjn9y3Mfcj6N2LgWJGmv3fAbn2UyEbxIAeo1NyufQFwJA0UgzQ0e52Dv38mjo"` +- `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBY21lIn0.c2lnbmF0dXJl` ### `internet.jwtAlgorithm` @@ -326,7 +312,7 @@ internet.jwtAlgorithm() ``` Example return values: -- `"HS384"` +- `PS384` ### `internet.mac` @@ -350,8 +336,7 @@ internet.mac(separator="-") ``` Example return values: -- `"9d:65:b8:77:9e:e2"` -- `"9e:d7:be:f2:62:0e"` +- `ae:a9:d7:ba:d2:bd` ### `internet.password` @@ -374,12 +359,11 @@ internet.password() ``` ```txt -internet.password(length=12, memorable=true, pattern="a", prefix="#") +internet.password(length=1, memorable=false, pattern="[A-Za-z0-9]", prefix="#") ``` Example return values: -- `"7FRCloUvbQ8D4zB"` -- `"J89o3mPBaw0mEv9"` +- `og1ejoksrfwVbIF` ### `internet.port` @@ -397,8 +381,7 @@ internet.port() ``` Example return values: -- `29644` -- `51998` +- `24545` ### `internet.protocol` @@ -416,7 +399,7 @@ internet.protocol() ``` Example return values: -- `"https"` +- `http` ### `internet.url` @@ -441,8 +424,7 @@ internet.url(appendSlash=true, protocol="https") ``` Example return values: -- `"https://twin-newsletter.info"` -- `"https://productive-conservation.org/"` +- `https://brave-interior.biz/` ### `internet.userAgent` @@ -460,8 +442,7 @@ internet.userAgent() ``` Example return values: -- `"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/556.49.37 (KHTML, like Gecko) Version/16.1 Safari/584.80.32"` -- `"FakerBot/8.17.16"` +- `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36` ### `internet.username` @@ -486,8 +467,7 @@ internet.username(firstName="Alex", lastName="Taylor") ``` Example return values: -- `"Myles_King"` -- `"Allie_Witting"` +- `Deanna51` ### `internet.userName` @@ -505,5 +485,4 @@ internet.userName() ``` Example return values: -- `"Alba90"` -- `"Keith3"` +- `Ana_Keebler` diff --git a/docs-src/docs/040-test-data/domain/170-literal.md b/docs-src/docs/040-test-data/domain/170-literal.md index 739129cb..67d9db61 100644 --- a/docs-src/docs/040-test-data/domain/170-literal.md +++ b/docs-src/docs/040-test-data/domain/170-literal.md @@ -8,10 +8,6 @@ description: "Domain keyword reference for literal." The `literal` domain returns caller-provided values directly and does not invoke faker. -## Faker Documentation - -- [https://anywaydata.com/docs/category/generating-data](https://anywaydata.com/docs/category/generating-data) - ## Methods ### `literal.value` @@ -19,21 +15,21 @@ The `literal` domain returns caller-provided values directly and does not invoke Return the literal value provided by the caller. - Canonical: `awd.domain.literal.value` -- Faker docs: [https://anywaydata.com/docs/category/generating-data](https://anywaydata.com/docs/category/generating-data) +- Docs: [https://anywaydata.com/docs/category/generating-data](https://anywaydata.com/docs/category/generating-data) | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `value` | `string\|number\|boolean` | yes | Literal value to return. | +| `value` | `string\|number\|boolean` | no | Literal value to return. When omitted, defaults to an empty string. | Examples: ```txt -literal.value("sample") +literal.value("Pending") ``` ```txt -literal.value(value="sample") +literal.value("") ``` Example return values: -- `"sample"` +- `Pending` diff --git a/docs-src/docs/040-test-data/domain/180-location.md b/docs-src/docs/040-test-data/domain/180-location.md index 33ad4444..2bf8fe40 100644 --- a/docs-src/docs/040-test-data/domain/180-location.md +++ b/docs-src/docs/040-test-data/domain/180-location.md @@ -30,8 +30,7 @@ location.buildingNumber() ``` Example return values: -- `"5098"` -- `"8232"` +- `5075` ### `location.cardinalDirection` @@ -49,7 +48,7 @@ location.cardinalDirection() ``` Example return values: -- `"West"` +- `East` ### `location.city` @@ -67,8 +66,7 @@ location.city() ``` Example return values: -- `"Neldachester"` -- `"East Libbychester"` +- `Stellachester` ### `location.continent` @@ -86,8 +84,7 @@ location.continent() ``` Example return values: -- `"Antarctica"` -- `"Asia"` +- `Asia` ### `location.country` @@ -105,8 +102,7 @@ location.country() ``` Example return values: -- `"Indonesia"` -- `"Iraq"` +- `Svalbard & Jan Mayen Islands` ### `location.countryCode` @@ -124,8 +120,7 @@ location.countryCode() ``` Example return values: -- `"PE"` -- `"KI"` +- `MG` ### `location.county` @@ -143,8 +138,7 @@ location.county() ``` Example return values: -- `"Rutland"` -- `"Washington County"` +- `Northamptonshire` ### `location.direction` @@ -168,8 +162,7 @@ location.direction(abbreviated=false) ``` Example return values: -- `"East"` -- `"North"` +- `North` ### `location.language` @@ -187,8 +180,7 @@ location.language() ``` Example return values: -- `{"name":"Tagalog","alpha2":"tl","alpha3":"tgl"}` -- `{"name":"Azerbaijani","alpha2":"az","alpha3":"aze"}` +- `{"name":"Icelandic","alpha2":"is","alpha3":"isl"}` ### `location.latitude` @@ -214,8 +206,7 @@ location.latitude(min=1, max=1, precision=1) ``` Example return values: -- `38.5893` -- `57.5593` +- `51.5448` ### `location.longitude` @@ -241,8 +232,7 @@ location.longitude(min=1, max=1, precision=1) ``` Example return values: -- `-174.1417` -- `100.7973` +- `92.3892` ### `location.nearbyGPSCoordinate` @@ -260,8 +250,7 @@ location.nearbyGPSCoordinate() ``` Example return values: -- `[-5.738,-37.5877]` -- `[30.3643,59.1147]` +- `[58.313,9.9746]` ### `location.ordinalDirection` @@ -279,8 +268,7 @@ location.ordinalDirection() ``` Example return values: -- `"Southwest"` -- `"Southeast"` +- `Northeast` ### `location.secondaryAddress` @@ -298,8 +286,7 @@ location.secondaryAddress() ``` Example return values: -- `"Suite 588"` -- `"Apt. 105"` +- `Suite 634` ### `location.state` @@ -323,8 +310,7 @@ location.state(abbreviated=false) ``` Example return values: -- `"New Hampshire"` -- `"Louisiana"` +- `Hawaii` ### `location.street` @@ -342,8 +328,7 @@ location.street() ``` Example return values: -- `"Kemmer Forges"` -- `"Labadie Extension"` +- `Viva Harbor` ### `location.streetAddress` @@ -354,7 +339,7 @@ Generates a random localized street address. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `useFullAddress` | `boolean` | no | When true, generates a fuller address variant (for example including additional address detail). When false or omitted, generates a standard street address. | +| `useFullAddress` | `boolean` | no | Whether to expand to a full address including secondary address information. | Examples: @@ -367,8 +352,7 @@ location.streetAddress(useFullAddress=true) ``` Example return values: -- `"24973 Steuber Skyway"` -- `"555 Kali Summit"` +- `12056 Vandervort Common` ### `location.timeZone` @@ -386,8 +370,7 @@ location.timeZone() ``` Example return values: -- `"America/Anchorage"` -- `"Asia/Pyongyang"` +- `Australia/Perth` ### `location.zipCode` @@ -405,5 +388,4 @@ location.zipCode() ``` Example return values: -- `"24867"` -- `"55040-0535"` +- `36791` diff --git a/docs-src/docs/040-test-data/domain/190-lorem.md b/docs-src/docs/040-test-data/domain/190-lorem.md index 90c8448c..47b277f8 100644 --- a/docs-src/docs/040-test-data/domain/190-lorem.md +++ b/docs-src/docs/040-test-data/domain/190-lorem.md @@ -23,8 +23,8 @@ Generates the given number lines of lorem separated by `'\n'`. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `min` | `number` | no | The minimum number of words per generated line. | -| `max` | `number` | no | The maximum number of words per generated line. | +| `min` | `number` | no | Minimum bound used when generating a value. | +| `max` | `number` | no | Maximum bound used when generating a value. | | `lineCount` | `number` | no | Exact number of lines to generate. | | `lineCountMax` | `number` | no | The maximum number of lines to generate. | | `lineCountMin` | `number` | no | The minimum number of lines to generate. | @@ -40,8 +40,7 @@ lorem.lines(min=1, max=1, lineCount=1, lineCountMax=1, lineCountMin=1) ``` Example return values: -- `"Conventus constans explicabo claustrum ait tepesco compono benigne cupressus.\nCapillus caries degusto vito vehemens denuo usus vinculum caput.\nCalamitas atque dolorem civitas.\nOptio talio curso abeo maiores tui.\nVerbera ago vere solium ut ratione vulnero civitas utilis."` -- `"Spargo quod auctor condico.\nAmissio ratione culpa."` +- `Illum qui ocer creptio. Antepono aro vergo voluptatem acervus compono apud.` ### `lorem.paragraph` @@ -69,8 +68,7 @@ lorem.paragraph(min=1, max=1, sentenceCount=1, sentenceCountMax=1, sentenceCount ``` Example return values: -- `"Approbo uterque adipiscor tricesimus labore stillicidium confero non patrocinor. Adficio acquiro sublime conor ullam cursim spectaculum adulescens confido. Tamdiu ter avaritia beatus vito deleo terreo utor eius."` -- `"Vox amiculum crepusculum vinco comminor. Enim vaco doloribus auctus varietas aspicio suppono velit aperte accusator. Volaticus coadunatio demoror tenetur accusamus."` +- `Quisquam dolorum modi quae atque.` ### `lorem.paragraphs` @@ -99,8 +97,7 @@ lorem.paragraphs(min=1, max=1, paragraphCount=1, separator="-", paragraphCountMa ``` Example return values: -- `"Thermae possimus denique deleniti desino. Decerno umquam caveo arbor sequi astrum. Via carmen thymum tot architecto voluptas summopere compello.\nTremo tot speculum eius audentia tibi at creator corrumpo ver. Vero spero asper. Amor vespillo ciminatio facere ter ater creo sol.\nDens cubo advenio tepesco nulla alioqui conitor voluptatum aeternus. Totam strenuus censura triduana alter vel. Agnitio comprehendo tero cattus."` -- `"Ventito similique tot curis correptius. Articulus curso admoneo aetas terga ars suscipit minus vulnero. Decimus reprehenderit sit videlicet terminatio decens tamen aer arceo esse.\nThymum audio claustrum patrocinor cruentus depono. Cupio adipiscor comitatus aspicio veritas caste voluntarius arcus suffoco careo. Atqui defetiscor virgo.\nLaborum conservo admoneo adeptio aliquam tollo certe. Alter impedit torrens alienus corrumpo creta tyrannus crastinus. Vito teneo templum voluptatum solio tamisium perspiciatis quisquam."` +- `Primus paragraphus.\n\nSecundus paragraphus.` ### `lorem.sentence` @@ -128,8 +125,7 @@ lorem.sentence(min=1, max=1, wordCount=1, wordCountMax=1, wordCountMin=1) ``` Example return values: -- `"Defendo adulescens color tertius sufficio nulla balbus vitae tabernus."` -- `"Aperio abutor aestus ambitus temptatio architecto adfectus."` +- `Auctor cum deorsum attero cum tergo aut.` ### `lorem.sentences` @@ -158,8 +154,7 @@ lorem.sentences(min=1, max=1, sentenceCount=1, separator="-", sentenceCountMax=1 ``` Example return values: -- `"Voveo video quod convoco denuncio defaeco textus tepesco. Averto attonbitus talis. Aurum desipio carus aperio truculenter comes. Bestia doloribus comprehendo. Cimentarius aegrotatio assentator defendo allatus tero talus despecto expedita."` -- `"Solvo tamquam coma cimentarius tutis vigilo rem corpus cunabula libero. Aufero caterva aqua. Ancilla thymum iure. Cupio porro terebro delectus verumtamen combibo vivo."` +- `Vicissitudo amet candidus. Urbanus magni carbo artificiose tenus at ambulo.` ### `lorem.slug` @@ -187,8 +182,7 @@ lorem.slug(min=1, max=1, wordCount=1, wordCountMax=1, wordCountMin=1) ``` Example return values: -- `"suus-aequus-caries"` -- `"usque-suus-ait"` +- `dolore-accusator-atqui` ### `lorem.text` @@ -206,8 +200,7 @@ lorem.text() ``` Example return values: -- `"Caterva capitulus comes celebrer tergiversatio dicta conservo enim arbor.\nVolubilis veritas ipsa.\nEos venia conicio earum caries doloremque cernuus.\nCaelum deludo conduco at viduo tenetur saepe victus ager venio."` -- `"Absconditus curatio truculenter usitas fugiat tracto aurum super defaeco. Averto ustilo talis. Veritatis tempus nesciunt curia advenio valens provident.\nCausa textus turpis. Sodalitas pecto timidus trans cibo adhuc quis velit cubicularis magni. Compono dapifer crux vigor pauci ara.\nItaque usitas acidus considero utique. Deludo culpo tristis circumvenio crudelis. Vigor conservo desparatus corrigo surgo supra."` +- `A short sample text generated from lorem.` ### `lorem.word` @@ -234,8 +227,7 @@ lorem.word(min=1, max=1, length=1, strategy="any-length") ``` Example return values: -- `"veniam"` -- `"sum"` +- `cumque` ### `lorem.words` @@ -263,5 +255,4 @@ lorem.words(min=1, max=1, wordCount=1, wordCountMax=1, wordCountMin=1) ``` Example return values: -- `"comis voluptates versus"` -- `"crebro copiose iste"` +- `desidero conforto decimus` diff --git a/docs-src/docs/040-test-data/domain/200-music.md b/docs-src/docs/040-test-data/domain/200-music.md index a53f18e5..8c0e3cff 100644 --- a/docs-src/docs/040-test-data/domain/200-music.md +++ b/docs-src/docs/040-test-data/domain/200-music.md @@ -30,8 +30,7 @@ music.album() ``` Example return values: -- `"The Beatles (White Album)"` -- `"Threat to Survival"` +- `R&G (Rhythm & Gangsta): The Masterpiece` ### `music.artist` @@ -49,8 +48,7 @@ music.artist() ``` Example return values: -- `"Fine Young Cannibals"` -- `"The Platters"` +- `Chuck Berry` ### `music.genre` @@ -68,8 +66,7 @@ music.genre() ``` Example return values: -- `"Easy Listening"` -- `"Latin"` +- `Mainstream Jazz` ### `music.songName` @@ -87,5 +84,4 @@ music.songName() ``` Example return values: -- `"Spanish Harlem"` -- `"Rock Around the Clock"` +- `I'm Sorry` diff --git a/docs-src/docs/040-test-data/domain/210-number.md b/docs-src/docs/040-test-data/domain/210-number.md index 92957913..8b74cea0 100644 --- a/docs-src/docs/040-test-data/domain/210-number.md +++ b/docs-src/docs/040-test-data/domain/210-number.md @@ -23,7 +23,7 @@ Returns a BigInt number. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `value` | `string\|number\|boolean` | no | Legacy placeholder argument from Faker signatures; currently has no effect. Use documented options instead. | +| `value` | `bigint\|number\|string\|boolean` | no | Base value used for generation. Supports bigint, number, string, or boolean inputs. For range constraints use min, max, and multipleOf. | Examples: @@ -32,12 +32,11 @@ number.bigInt() ``` ```txt -number.bigInt(value=42) +number.bigInt(value="value") ``` Example return values: -- `"347465151663036n"` -- `"918273645546372n"` +- `347465151663036` ### `number.binary` @@ -62,7 +61,7 @@ number.binary(max=1, min=1) ``` Example return values: -- `"0"` +- `0` ### `number.float` @@ -73,7 +72,6 @@ Returns a single random floating-point number, by default between `0.0` and `1.0 | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `value` | `number` | no | Legacy placeholder argument from Faker signatures; currently has no effect. Use documented options instead. | | `fractionDigits` | `number` | no | The maximum number of digits to appear after the decimal point, for example 2 will round to 2 decimal points. Only one of multipleOf or fractionDigits should be passed. | | `max` | `number` | no | Upper bound for generated number, exclusive, unless multipleOf or fractionDigits are passed. | | `min` | `number` | no | Lower bound for generated number, inclusive. | @@ -87,10 +85,6 @@ number.float() Type-in examples (named params): -```txt -number.float(value=1) -``` - ```txt number.float(fractionDigits=1) ``` @@ -108,8 +102,7 @@ number.float(multipleOf=1) ``` Example return values: -- `0.11027820838106395` -- `0.5898499201943372` +- `0.5433707701438405` ### `number.hex` @@ -122,7 +115,6 @@ Returns a lowercase hexadecimal number. | --- | --- | --- | --- | | `min` | `number` | no | Minimum bound used when generating a value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy placeholder argument from Faker signatures; currently has no effect. Use documented options instead. | Examples: @@ -131,12 +123,11 @@ number.hex() ``` ```txt -number.hex(min=1, max=1, value=1) +number.hex(min=1, max=1) ``` Example return values: -- `"5"` -- `"7"` +- `d` ### `number.int` @@ -162,8 +153,7 @@ number.int(min=1, max=1, multipleOf=1) ``` Example return values: -- `108688750608405` -- `4041549375676296` +- `5190574431878510` ### `number.octal` @@ -188,8 +178,7 @@ number.octal(max=1, min=1) ``` Example return values: -- `"3"` -- `"7"` +- `6` ### `number.romanNumeral` @@ -202,7 +191,6 @@ Returns a roman numeral in String format. | --- | --- | --- | --- | | `min` | `number` | no | Minimum bound used when generating a value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy placeholder argument from Faker signatures; currently has no effect. Use documented options instead. | Examples: @@ -211,9 +199,8 @@ number.romanNumeral() ``` ```txt -number.romanNumeral(min=1, max=1, value=1) +number.romanNumeral(min=1, max=1) ``` Example return values: -- `"MLXXXII"` -- `"DXXXVI"` +- `XXXV` diff --git a/docs-src/docs/040-test-data/domain/220-person.md b/docs-src/docs/040-test-data/domain/220-person.md index bd3f6a7b..0d8a2981 100644 --- a/docs-src/docs/040-test-data/domain/220-person.md +++ b/docs-src/docs/040-test-data/domain/220-person.md @@ -30,8 +30,7 @@ person.bio() ``` Example return values: -- `"designer, engineer, developer"` -- `"leader, leader"` +- `musician` ### `person.firstName` @@ -42,7 +41,7 @@ Returns a random first name. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `sex` | `string` | no | Optional sex for first-name selection. Valid values: `female` or `male`. | +| `sex` | `string` | no | Optional sex for first-name selection. Valid values: female or male. | Examples: @@ -51,12 +50,11 @@ person.firstName() ``` ```txt -person.firstName(sex="female") +person.firstName(sex="male") ``` Example return values: -- `"David"` -- `"Alvera"` +- `David` ### `person.fullName` @@ -74,8 +72,7 @@ person.fullName() ``` Example return values: -- `"Miss Chelsea Heller"` -- `"Mrs. Diane McClure"` +- `Mrs. Sheryl Zemlak DVM` ### `person.gender` @@ -93,8 +90,7 @@ person.gender() ``` Example return values: -- `"Demiflux"` -- `"M2F"` +- `Female to male` ### `person.jobArea` @@ -112,8 +108,7 @@ person.jobArea() ``` Example return values: -- `"Integration"` -- `"Quality"` +- `Branding` ### `person.jobDescriptor` @@ -131,8 +126,7 @@ person.jobDescriptor() ``` Example return values: -- `"Central"` -- `"Human"` +- `Direct` ### `person.jobTitle` @@ -150,8 +144,7 @@ person.jobTitle() ``` Example return values: -- `"Lead Communications Assistant"` -- `"Regional Operations Technician"` +- `Senior Identity Technician` ### `person.jobType` @@ -169,8 +162,7 @@ person.jobType() ``` Example return values: -- `"Engineer"` -- `"Director"` +- `Engineer` ### `person.lastName` @@ -181,7 +173,7 @@ Returns a random last name. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `sex` | `string` | no | Optional sex for last-name selection. Valid values: `female` or `male`. | +| `sex` | `string` | no | Optional sex for last-name selection. Valid values: female or male. | Examples: @@ -194,8 +186,7 @@ person.lastName(sex="male") ``` Example return values: -- `"Heller"` -- `"Schneider"` +- `Bernhard` ### `person.middleName` @@ -206,7 +197,7 @@ Returns a random middle name. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `sex` | `string` | no | Optional sex for middle-name selection. Valid values: `female` or `male`. | +| `sex` | `string` | no | Optional sex for middle-name selection. Valid values: female or male. | Examples: @@ -215,12 +206,11 @@ person.middleName() ``` ```txt -person.middleName(sex="female") +person.middleName(sex="male") ``` Example return values: -- `"August"` -- `"Emerson"` +- `Ryan` ### `person.prefix` @@ -244,8 +234,7 @@ person.prefix(sex="male") ``` Example return values: -- `"Dr."` -- `"Ms."` +- `Mr.` ### `person.sex` @@ -263,7 +252,7 @@ person.sex() ``` Example return values: -- `"male"` +- `male` ### `person.sexType` @@ -281,7 +270,7 @@ person.sexType() ``` Example return values: -- `"male"` +- `male` ### `person.suffix` @@ -299,8 +288,7 @@ person.suffix() ``` Example return values: -- `"DVM"` -- `"III"` +- `IV` ### `person.zodiacSign` @@ -318,5 +306,4 @@ person.zodiacSign() ``` Example return values: -- `"Pisces"` -- `"Capricorn"` +- `Cancer` diff --git a/docs-src/docs/040-test-data/domain/230-phone.md b/docs-src/docs/040-test-data/domain/230-phone.md index d6712002..d550786f 100644 --- a/docs-src/docs/040-test-data/domain/230-phone.md +++ b/docs-src/docs/040-test-data/domain/230-phone.md @@ -30,8 +30,7 @@ phone.imei() ``` Example return values: -- `"62-254603-841402-5"` -- `"52-339397-830295-5"` +- `44-358223-971834-1` ### `phone.number` @@ -55,5 +54,4 @@ phone.number(style="human") ``` Example return values: -- `"732.568.2497 x89386"` -- `"500-203-7039"` +- `298.756.9044` diff --git a/docs-src/docs/040-test-data/domain/240-science.md b/docs-src/docs/040-test-data/domain/240-science.md index 37fd054a..6028b822 100644 --- a/docs-src/docs/040-test-data/domain/240-science.md +++ b/docs-src/docs/040-test-data/domain/240-science.md @@ -30,8 +30,7 @@ science.chemicalElement() ``` Example return values: -- `{"symbol":"N","name":"Nitrogen","atomicNumber":7}` -- `{"symbol":"Sn","name":"Tin","atomicNumber":50}` +- `{"name":"Oxygen","symbol":"O","atomicNumber":8}` ### `science.chemicalElement.atomicNumber` @@ -49,8 +48,7 @@ science.chemicalElement.atomicNumber() ``` Example return values: -- `102` -- `78` +- `8` ### `science.chemicalElement.name` @@ -68,8 +66,7 @@ science.chemicalElement.name() ``` Example return values: -- `"Cobalt"` -- `"Actinium"` +- `Oxygen` ### `science.chemicalElement.symbol` @@ -87,8 +84,7 @@ science.chemicalElement.symbol() ``` Example return values: -- `"Hs"` -- `"Bh"` +- `O` ### `science.unit` @@ -106,5 +102,4 @@ science.unit() ``` Example return values: -- `{"name":"sievert","symbol":"Sv"}` -- `{"name":"pascal","symbol":"Pa"}` +- `{"name":"farad","symbol":"F"}` diff --git a/docs-src/docs/040-test-data/domain/250-string.md b/docs-src/docs/040-test-data/domain/250-string.md index a7aee890..7ab99996 100644 --- a/docs-src/docs/040-test-data/domain/250-string.md +++ b/docs-src/docs/040-test-data/domain/250-string.md @@ -34,12 +34,11 @@ string.alpha() ``` ```txt -string.alpha(length=5, casing="lower", exclude=["a"]) +string.alpha(length=1, casing="lower", exclude=["item"]) ``` Example return values: -- `"S"` -- `"u"` +- `R` ### `string.alphanumeric` @@ -61,12 +60,11 @@ string.alphanumeric() ``` ```txt -string.alphanumeric(length=5, casing="lower", exclude=["a", "1"]) +string.alphanumeric(length=1, casing="lower", exclude=["item"]) ``` Example return values: -- `"D"` -- `"K"` +- `s` ### `string.binary` @@ -91,7 +89,42 @@ string.binary(length=1, prefix="#") ``` Example return values: -- `"0b1"` +- `0b0` + +### `string.counterString` + +Generates a counterstring for a random length between min and max (or fixed length when only one value is provided). Defaults to min=1 and max=25 when omitted. + +- Canonical: `awd.domain.string.counterString` +- Docs: [/docs/test-data/counterstrings](/docs/test-data/counterstrings) + +| Arg | Type | Required | Description | +| --- | --- | --- | --- | +| `min` | `number` | no | Minimum counterstring length (integer). If max is omitted and min is provided, min is also used as max. Defaults to 1 when omitted. Non-integer values throw an exception. | +| `max` | `number` | no | Maximum counterstring length (integer). If less than min, values are swapped. Defaults to 25 when omitted. Non-integer values throw an exception. | +| `delimiter` | `string` | no | Delimiter character used between position markers. Defaults to "*". | + +Examples: + +```txt +string.counterString() +``` + +```txt +string.counterString(15) +``` + +```txt +string.counterString(min=5, max=12) +``` + +```txt +string.counterString(min=12, max=12, delimiter="#") +``` + +Example return values: +- `*3*5*7*9*12*15*` +- `#3#5#7#9#12#` ### `string.fromCharacters` @@ -108,16 +141,16 @@ Generates a string from the given characters. Examples: ```txt -string.fromCharacters("sample") +string.fromCharacters("ABC123", 6) ``` ```txt -string.fromCharacters(characters="abcdef", length=3) +string.fromCharacters(characters=["A", "B", "C"], length=4) ``` Example return values: -- `"m"` -- `"l"` +- `A1B2` +- `CB2A` ### `string.hexadecimal` @@ -143,8 +176,7 @@ string.hexadecimal(casing="lower", length=1, prefix="#") ``` Example return values: -- `"0xd"` -- `"0xB"` +- `0x1` ### `string.nanoid` @@ -164,12 +196,11 @@ string.nanoid() ``` ```txt -string.nanoid(length=10) +string.nanoid(length=1) ``` Example return values: -- `"bt_JjqxXXh9GHz1MALPW2"` -- `"mjTRAlIjzdQ5Tg9rjv57R"` +- `KLm49ferlh-eUmJpZdSIO` ### `string.numeric` @@ -191,12 +222,11 @@ string.numeric() ``` ```txt -string.numeric(length=5, allowLeadingZeros=true, exclude=["0"]) +string.numeric(length=1, allowLeadingZeros=true, exclude=["item"]) ``` Example return values: -- `"4"` -- `"0"` +- `7` ### `string.octal` @@ -221,8 +251,7 @@ string.octal(length=1, prefix="#") ``` Example return values: -- `"0o1"` -- `"0o3"` +- `0o6` ### `string.sample` @@ -242,12 +271,11 @@ string.sample() ``` ```txt -string.sample(length=10) +string.sample(length=1) ``` Example return values: -- `"R4A;9BcLzj"` -- `"X`ARt%ku=7"` +- `\Fw;0e:G.H` ### `string.symbol` @@ -267,12 +295,11 @@ string.symbol() ``` ```txt -string.symbol(length=3) +string.symbol(length=1) ``` Example return values: -- `"/"` -- `"_"` +- `.` ### `string.ulid` @@ -296,8 +323,7 @@ string.ulid(refDate=1) ``` Example return values: -- `"01KRXH5AE8V36069S9HB6G3CKY"` -- `"01KRXH5AE8FNGNXFP3JBW5NJXW"` +- `01KQADM2A0728G4D2HKCPWKS6N` ### `string.uuid` @@ -306,7 +332,7 @@ Returns a UUID v4 (Universally Unique Identifier). - Canonical: `awd.domain.string.uuid` - Faker docs: [https://fakerjs.dev/api/string](https://fakerjs.dev/api/string) -No arguments. +No parameters. Examples: @@ -315,5 +341,4 @@ string.uuid() ``` Example return values: -- `"522928a9-04aa-4ec4-948a-5bbbfe882f64"` -- `"bd37a9cb-1f37-4d4a-aa6f-9681735bd00a"` +- `0628ae51-7b6c-4d33-9f24-dae19fb245df` diff --git a/docs-src/docs/040-test-data/domain/260-system.md b/docs-src/docs/040-test-data/domain/260-system.md index 2fd89986..18fa82a2 100644 --- a/docs-src/docs/040-test-data/domain/260-system.md +++ b/docs-src/docs/040-test-data/domain/260-system.md @@ -30,8 +30,7 @@ system.commonFileExt() ``` Example return values: -- `"gif"` -- `"png"` +- `pdf` ### `system.commonFileName` @@ -55,8 +54,7 @@ system.commonFileName(extension="txt") ``` Example return values: -- `"monocle_unhappy.gif"` -- `"seal_fax.gif"` +- `bleak.pdf` ### `system.commonFileType` @@ -74,8 +72,7 @@ system.commonFileType() ``` Example return values: -- `"image"` -- `"video"` +- `video` ### `system.cron` @@ -86,7 +83,7 @@ Returns a random cron expression. | Arg | Type | Required | Description | | --- | --- | --- | --- | -| `includeNonStandard` | `boolean` | no | Whether to include @yearly, @monthly, @daily, etc. text labels in the generated expression. | +| `includeNonStandard` | `boolean` | no | Whether to include a @yearly, @monthly, @daily, etc text labels in the generated expression. | | `includeYear` | `boolean` | no | Whether to include a year in the generated expression. | Examples: @@ -100,8 +97,7 @@ system.cron(includeNonStandard=true, includeYear=true) ``` Example return values: -- `"* * 23 * *"` -- `"* 12 ? * ?"` +- `* 15 * * SAT` ### `system.directoryPath` @@ -119,8 +115,7 @@ system.directoryPath() ``` Example return values: -- `"/lost+found"` -- `"/root"` +- `/bin` ### `system.fileExt` @@ -144,8 +139,7 @@ system.fileExt(mimeType="image/png") ``` Example return values: -- `"odp"` -- `"bz"` +- `xsl` ### `system.fileName` @@ -163,8 +157,7 @@ system.fileName() ``` Example return values: -- `"ew_deep_mothball.webm"` -- `"whale.ogg"` +- `unsightly.woff` ### `system.filePath` @@ -182,8 +175,7 @@ system.filePath() ``` Example return values: -- `"/Applications/but_holster.dms"` -- `"/lib/anenst_glaring.xsl"` +- `/tmp/ouch.xlt` ### `system.fileType` @@ -201,7 +193,7 @@ system.fileType() ``` Example return values: -- `"image"` +- `font` ### `system.mimeType` @@ -219,8 +211,7 @@ system.mimeType() ``` Example return values: -- `"image/jpeg"` -- `"application/x-7z-compressed"` +- `application/gzip` ### `system.networkInterface` @@ -238,8 +229,7 @@ system.networkInterface() ``` Example return values: -- `"ens9d1"` -- `"wlp8s6f4"` +- `wlx3fba717f9f9c` ### `system.semver` @@ -257,5 +247,4 @@ system.semver() ``` Example return values: -- `"1.8.17"` -- `"5.12.0"` +- `4.3.6` diff --git a/docs-src/docs/040-test-data/domain/270-vehicle.md b/docs-src/docs/040-test-data/domain/270-vehicle.md index a32f7384..16b7a813 100644 --- a/docs-src/docs/040-test-data/domain/270-vehicle.md +++ b/docs-src/docs/040-test-data/domain/270-vehicle.md @@ -30,8 +30,7 @@ vehicle.bicycle() ``` Example return values: -- `"Hybrid Bicycle"` -- `"Fitness Bicycle"` +- `Touring Bicycle` ### `vehicle.color` @@ -49,8 +48,7 @@ vehicle.color() ``` Example return values: -- `"yellow"` -- `"mint green"` +- `sky blue` ### `vehicle.fuel` @@ -68,7 +66,7 @@ vehicle.fuel() ``` Example return values: -- `"Electric"` +- `Gasoline` ### `vehicle.manufacturer` @@ -86,8 +84,7 @@ vehicle.manufacturer() ``` Example return values: -- `"NIO"` -- `"Citroën"` +- `Hyundai` ### `vehicle.model` @@ -105,8 +102,7 @@ vehicle.model() ``` Example return values: -- `"Land Cruiser"` -- `"Mercielago"` +- `Aventador` ### `vehicle.type` @@ -124,8 +120,7 @@ vehicle.type() ``` Example return values: -- `"Sedan"` -- `"Wagon"` +- `Hatchback` ### `vehicle.vehicle` @@ -143,8 +138,7 @@ vehicle.vehicle() ``` Example return values: -- `"Rivian CTS"` -- `"Bentley Impala"` +- `Ford CTS` ### `vehicle.vin` @@ -162,8 +156,7 @@ vehicle.vin() ``` Example return values: -- `"D3UH0YUMBVV327816"` -- `"Z254G22MJDSC55053"` +- `7SJ9N0LM3LM265056` ### `vehicle.vrm` @@ -181,5 +174,4 @@ vehicle.vrm() ``` Example return values: -- `"PB29ZCN"` -- `"ZH04BJQ"` +- `OD11RTZ` diff --git a/docs-src/docs/040-test-data/domain/280-word.md b/docs-src/docs/040-test-data/domain/280-word.md index 303c747d..a4ef18d4 100644 --- a/docs-src/docs/040-test-data/domain/280-word.md +++ b/docs-src/docs/040-test-data/domain/280-word.md @@ -25,7 +25,6 @@ Returns a random adjective. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -35,12 +34,11 @@ word.adjective() ``` ```txt -word.adjective(length=1, max=1, value=1, strategy="any-length") +word.adjective(length=1, max=1, strategy="any-length") ``` Example return values: -- `"agile"` -- `"oval"` +- `heavenly` ### `word.adverb` @@ -53,7 +51,6 @@ Returns a random adverb. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -63,12 +60,11 @@ word.adverb() ``` ```txt -word.adverb(length=1, max=1, value=1, strategy="any-length") +word.adverb(length=1, max=1, strategy="any-length") ``` Example return values: -- `"triumphantly"` -- `"blindly"` +- `selfishly` ### `word.conjunction` @@ -81,7 +77,6 @@ Returns a random conjunction. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -91,11 +86,11 @@ word.conjunction() ``` ```txt -word.conjunction(length=1, max=1, value=1, strategy="any-length") +word.conjunction(length=1, max=1, strategy="any-length") ``` Example return values: -- `"consequently"` +- `indeed` ### `word.interjection` @@ -108,7 +103,6 @@ Returns a random interjection. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -118,12 +112,11 @@ word.interjection() ``` ```txt -word.interjection(length=1, max=1, value=1, strategy="any-length") +word.interjection(length=1, max=1, strategy="any-length") ``` Example return values: -- `"duh"` -- `"yuck"` +- `er` ### `word.noun` @@ -136,7 +129,6 @@ Returns a random noun. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -146,12 +138,11 @@ word.noun() ``` ```txt -word.noun(length=1, max=1, value=1, strategy="any-length") +word.noun(length=1, max=1, strategy="any-length") ``` Example return values: -- `"freezing"` -- `"stump"` +- `cook` ### `word.preposition` @@ -164,7 +155,6 @@ Returns a random preposition. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -174,12 +164,11 @@ word.preposition() ``` ```txt -word.preposition(length=1, max=1, value=1, strategy="any-length") +word.preposition(length=1, max=1, strategy="any-length") ``` Example return values: -- `"over"` -- `"circa"` +- `beside` ### `word.sample` @@ -192,7 +181,6 @@ Returns a random word, that can be an adjective, adverb, conjunction, interjecti | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -202,12 +190,11 @@ word.sample() ``` ```txt -word.sample(length=1, max=1, value=1, strategy="any-length") +word.sample(length=1, max=1, strategy="any-length") ``` Example return values: -- `"smarten"` -- `"tidy"` +- `snoopy` ### `word.verb` @@ -220,7 +207,6 @@ Returns a random verb. | --- | --- | --- | --- | | `length` | `number` | no | Desired length of the generated value. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for target word length. Prefer the length option. | | `strategy` | `string` | no | The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length. | Examples: @@ -230,12 +216,11 @@ word.verb() ``` ```txt -word.verb(length=1, max=1, value=1, strategy="any-length") +word.verb(length=1, max=1, strategy="any-length") ``` Example return values: -- `"graft"` -- `"banish"` +- `embalm` ### `word.words` @@ -248,7 +233,6 @@ Returns a random string containing some words separated by spaces. | --- | --- | --- | --- | | `count` | `number` | no | Number of items to generate. | | `max` | `number` | no | Maximum bound used when generating a value. | -| `value` | `number` | no | Legacy shorthand for number of words to generate. Prefer the count option. | Examples: @@ -257,9 +241,8 @@ word.words() ``` ```txt -word.words(count=1, max=1, value=1) +word.words(count=1, max=1) ``` Example return values: -- `"sternly which"` -- `"while approach though"` +- `geez` diff --git a/packages/core-ui/js/gui_components/data-generator-page.js b/packages/core-ui/js/gui_components/data-generator-page.js index b522046b..f0fb4d5e 100644 --- a/packages/core-ui/js/gui_components/data-generator-page.js +++ b/packages/core-ui/js/gui_components/data-generator-page.js @@ -119,13 +119,25 @@ function buildRuleSpecFromSchemaRow(row) { const literalValue = String(row?.value ?? ''); const trimmedLiteralValue = literalValue.trim(); if (trimmedLiteralValue.length === 0) { - return 'literal()'; + return 'literal("")'; } if (/^(literal|datatype\.literal|awd\.datatype\.literal)\s*\(/i.test(trimmedLiteralValue)) { return trimmedLiteralValue; } return `literal(${literalValue})`; } + if (sourceType === SOURCE_TYPE_REGEX) { + const regexValue = String(row?.value ?? ''); + const trimmedRegexValue = regexValue.trim(); + const hasName = String(row?.name ?? '').trim().length > 0; + if (trimmedRegexValue.length === 0 && hasName) { + return 'regex("")'; + } + if (/^(regex|datatype\.regex|awd\.datatype\.regex)\s*\(/i.test(trimmedRegexValue)) { + return trimmedRegexValue; + } + return regexValue; + } return String(row?.value ?? '').trim(); } @@ -135,7 +147,24 @@ function extractLiteralValueFromRuleSpec(ruleSpec) { if (!match) { return value; } - return match[1]; + const unwrapped = match[1]; + if (unwrapped === '""' || unwrapped === "''") { + return ''; + } + return unwrapped; +} + +function extractRegexValueFromRuleSpec(ruleSpec) { + const value = String(ruleSpec ?? ''); + const match = value.match(/^(?:regex|datatype\.regex|awd\.datatype\.regex)\s*\(([\s\S]*)\)$/i); + if (!match) { + return value; + } + const unwrapped = match[1]; + if (unwrapped === '""' || unwrapped === "''") { + return ''; + } + return unwrapped; } function schemaRowsToSpec(schemaRows) { @@ -1184,7 +1213,7 @@ enum(active,inactive,pending) return; } rule.type = SOURCE_TYPE_REGEX; - rule.ruleSpec = buildRuleSpecFromSchemaRow(row); + rule.ruleSpec = extractRegexValueFromRuleSpec(buildRuleSpecFromSchemaRow(row)); }); generator.compiler.validate(); @@ -1616,6 +1645,7 @@ export { DataGeneratorPage, buildRuleSpecFromSchemaRow, extractLiteralValueFromRuleSpec, + extractRegexValueFromRuleSpec, schemaRowsToSpec, schemaRowsToSpecWithTokens, validateSchemaRows, diff --git a/packages/core-ui/js/gui_components/testdatadefn.js b/packages/core-ui/js/gui_components/testdatadefn.js index d5d7f2b9..b56c3bd2 100644 --- a/packages/core-ui/js/gui_components/testdatadefn.js +++ b/packages/core-ui/js/gui_components/testdatadefn.js @@ -1022,12 +1022,27 @@ function normalizeEnumRuleDefinition(value) { function normalizeLiteralRuleDefinition(value) { const rawValue = String(value ?? ''); const trimmedValue = rawValue.trim(); + if (trimmedValue.length === 0) { + return 'literal("")'; + } if (/^(literal|datatype\.literal|awd\.datatype\.literal)\s*\(/i.test(trimmedValue)) { return trimmedValue; } return `literal(${rawValue})`; } +function normalizeRegexRuleDefinition(value) { + const rawValue = String(value ?? ''); + const trimmedValue = rawValue.trim(); + if (trimmedValue.length === 0) { + return 'regex("")'; + } + if (/^(regex|datatype\.regex|awd\.datatype\.regex)\s*\(/i.test(trimmedValue)) { + return trimmedValue; + } + return rawValue; +} + function convertGridToText() { if (!defnGridBridge) { return; @@ -1045,7 +1060,7 @@ function convertGridToText() { const lowerType = resolvedType.toLowerCase(); switch (lowerType) { case 'regex': - ruleLine = resolvedRowData.value || ''; + ruleLine = normalizeRegexRuleDefinition(resolvedRowData.value); break; case 'enum': ruleLine = normalizeEnumRuleDefinition(resolvedRowData.value); diff --git a/packages/core-ui/src/tests/generator/data-generator-page.test.js b/packages/core-ui/src/tests/generator/data-generator-page.test.js index 3377f431..d87bbdb4 100644 --- a/packages/core-ui/src/tests/generator/data-generator-page.test.js +++ b/packages/core-ui/src/tests/generator/data-generator-page.test.js @@ -6,6 +6,7 @@ import { DataGeneratorPage, buildRuleSpecFromSchemaRow, extractLiteralValueFromRuleSpec, + extractRegexValueFromRuleSpec, schemaRowsToSpec, schemaRowsToSpecWithTokens, validateSchemaRows, @@ -101,8 +102,9 @@ describe('DataGeneratorPage', () => { 'number.int(1,10)' ); expect(buildRuleSpecFromSchemaRow({ sourceType: 'regex', value: '[A-Z]{3}' })).toBe('[A-Z]{3}'); + expect(buildRuleSpecFromSchemaRow({ name: 'Code', sourceType: 'regex', value: ' ' })).toBe('regex("")'); expect(buildRuleSpecFromSchemaRow({ sourceType: 'literal', value: 'Fixed' })).toBe('literal(Fixed)'); - expect(buildRuleSpecFromSchemaRow({ sourceType: 'literal', value: ' ' })).toBe('literal()'); + expect(buildRuleSpecFromSchemaRow({ sourceType: 'literal', value: ' ' })).toBe('literal("")'); const spec = schemaRowsToSpec([ { name: 'A', sourceType: 'faker', command: 'word.noun', params: '()' }, @@ -113,12 +115,19 @@ describe('DataGeneratorPage', () => { test('literal rule extraction unwraps literal(...) variants for generation', () => { expect(extractLiteralValueFromRuleSpec('literal(Fixed)')).toBe('Fixed'); - expect(extractLiteralValueFromRuleSpec('literal()')).toBe(''); + expect(extractLiteralValueFromRuleSpec('literal("")')).toBe(''); expect(extractLiteralValueFromRuleSpec('datatype.literal( 123)')).toBe(' 123'); expect(extractLiteralValueFromRuleSpec('awd.datatype.literal(value)')).toBe('value'); expect(extractLiteralValueFromRuleSpec('plain value')).toBe('plain value'); }); + test('regex rule extraction unwraps regex(...) variants for generation', () => { + expect(extractRegexValueFromRuleSpec('regex("[A-Z]{3}")')).toBe('"[A-Z]{3}"'); + expect(extractRegexValueFromRuleSpec('regex("")')).toBe(''); + expect(extractRegexValueFromRuleSpec('datatype.regex(\\d{2})')).toBe('\\d{2}'); + expect(extractRegexValueFromRuleSpec('plain regex')).toBe('plain regex'); + }); + test('schemaRowsToSpec omits fully blank rows', () => { const spec = schemaRowsToSpec([{ name: '', sourceType: 'regex', value: '' }]); expect(spec).toBe(''); @@ -1391,14 +1400,14 @@ Authorization Token const schemaErrorStatus = document.getElementById('generatorSchemaErrorText'); expect(schemaErrorStatus.textContent).toBe( - "column t1 requires a data definition, use 'literal()' for blank data" + 'column t1 requires a data definition, use \'literal("")\' for blank data' ); expect(document.getElementById('generatorStatusText').textContent).toBe(''); expect(alertFn).not.toHaveBeenCalled(); jest.advanceTimersByTime(4999); expect(schemaErrorStatus.textContent).toBe( - "column t1 requires a data definition, use 'literal()' for blank data" + 'column t1 requires a data definition, use \'literal("")\' for blank data' ); jest.advanceTimersByTime(1); diff --git a/packages/core-ui/src/tests/grid/test-data-defn-engine-compat.test.js b/packages/core-ui/src/tests/grid/test-data-defn-engine-compat.test.js index 05a20744..a1f4acc7 100644 --- a/packages/core-ui/src/tests/grid/test-data-defn-engine-compat.test.js +++ b/packages/core-ui/src/tests/grid/test-data-defn-engine-compat.test.js @@ -573,13 +573,13 @@ describe('test data definition editor engine compatibility', () => { await flushUi(); const schemaText = document.getElementById('testdatadefntext').value; - expect(schemaText).toContain('EmptyLiteral\nliteral()'); - expect(schemaText).toContain('SpaceLiteral\nliteral( )'); + expect(schemaText).toContain('EmptyLiteral\nliteral("")'); + expect(schemaText).toContain('SpaceLiteral\nliteral("")'); delete global.Tabulator; }); - test('text schema literal() parses to literal row type (not regex)', async () => { + test('text schema literal("") parses to literal row type (not regex)', async () => { const TabulatorMock = installTabulatorMock(); enableTestDataGenerationInterface( @@ -597,7 +597,7 @@ describe('test data definition editor engine compatibility', () => { ); const schemaTextArea = document.getElementById('testdatadefntext'); - schemaTextArea.value = 't\nliteral()'; + schemaTextArea.value = 't\nliteral("")'; schemaTextArea.dispatchEvent(new Event('input', { bubbles: true })); await new Promise((resolve) => setTimeout(resolve, 1100)); await flushUi(); diff --git a/packages/core-ui/src/tests/grid/testdatadefn-faker-dropdown-literals.test.js b/packages/core-ui/src/tests/grid/testdatadefn-faker-dropdown-literals.test.js index 402bc12e..30324478 100644 --- a/packages/core-ui/src/tests/grid/testdatadefn-faker-dropdown-literals.test.js +++ b/packages/core-ui/src/tests/grid/testdatadefn-faker-dropdown-literals.test.js @@ -90,6 +90,7 @@ describe('Faker Dropdown Literal Commands', () => { const domainCommands = getDomainCommands(); expect(domainCommands.length).toBeGreaterThan(0); expect(domainCommands).toContain('number.int'); + expect(domainCommands).toContain('string.counterString'); expect(domainCommands.some((command) => command.startsWith('helpers.'))).toBe(false); }); diff --git a/packages/core/js/data_generation/schema-parsing-errors.js b/packages/core/js/data_generation/schema-parsing-errors.js index 0115aecd..324cd950 100644 --- a/packages/core/js/data_generation/schema-parsing-errors.js +++ b/packages/core/js/data_generation/schema-parsing-errors.js @@ -52,7 +52,7 @@ export class SchemaParsingErrors { static missingRuleDefinition(column, line) { return { code: 'missing_rule_definition', - message: `column ${column} requires a data definition, use 'literal()' for blank data`, + message: `column ${column} requires a data definition, use 'literal("")' for blank data`, column, ...(Number.isInteger(line) ? { line } : {}), }; diff --git a/packages/core/js/data_generation/schema-rules-adapter.js b/packages/core/js/data_generation/schema-rules-adapter.js index 175b7a43..381a8d46 100644 --- a/packages/core/js/data_generation/schema-rules-adapter.js +++ b/packages/core/js/data_generation/schema-rules-adapter.js @@ -52,13 +52,25 @@ function buildRuleSpecFromRow(row) { const value = String(row?.value ?? ''); const trimmedValue = value.trim(); if (trimmedValue.length === 0) { - return 'literal()'; + return 'literal("")'; } if (/^(literal|datatype\.literal|awd\.datatype\.literal)\s*\(/i.test(trimmedValue)) { return trimmedValue; } return `literal(${value})`; } + if (sourceType === SOURCE_TYPE_REGEX) { + const value = String(row?.value ?? ''); + const trimmedValue = value.trim(); + const hasName = String(row?.name ?? '').trim().length > 0; + if (trimmedValue.length === 0 && hasName) { + return 'regex("")'; + } + if (/^(regex|datatype\.regex|awd\.datatype\.regex)\s*\(/i.test(trimmedValue)) { + return trimmedValue; + } + return value; + } return String(row?.value ?? '').trim(); } diff --git a/packages/core/js/data_generation/testDataRulesCompiler.js b/packages/core/js/data_generation/testDataRulesCompiler.js index ec4f9dbf..ce9ad0c8 100644 --- a/packages/core/js/data_generation/testDataRulesCompiler.js +++ b/packages/core/js/data_generation/testDataRulesCompiler.js @@ -56,6 +56,14 @@ export class TestDataRulesCompiler { return; } + if (this.isRegexPattern(rule.ruleSpec)) { + const regexValue = this.extractRegexValue(rule.ruleSpec); + this.compilationReportLines.push(`${rule.name} is a valid 'regex': ${rule.ruleSpec}`); + rule.ruleSpec = regexValue; + rule.type = 'regex'; + return; + } + // Check for enum patterns first if (this.isEnumPattern(rule.ruleSpec)) { enumValidator.validate(rule); @@ -112,6 +120,12 @@ export class TestDataRulesCompiler { rule.type = 'literal'; } else { this.compilationReportLines.push(`Type for '${rule.name}' declared as '${rule.type}'`); + if (rule.type === 'literal' && this.isLiteralPattern(rule.ruleSpec)) { + rule.ruleSpec = this.extractLiteralValue(rule.ruleSpec); + } + if (rule.type === 'regex' && this.isRegexPattern(rule.ruleSpec)) { + rule.ruleSpec = this.extractRegexValue(rule.ruleSpec); + } } } }); @@ -206,13 +220,35 @@ export class TestDataRulesCompiler { return spec.startsWith('awd.domain.helpers.') || spec.startsWith('domain.helpers.'); } + isRegexPattern(ruleSpec) { + const spec = String(ruleSpec || '').trim(); + return /^(regex|datatype\.regex|awd\.datatype\.regex)\s*\(/i.test(spec); + } + extractLiteralValue(ruleSpec) { const spec = String(ruleSpec || '').trim(); const match = spec.match(/^(?:literal|datatype\.literal|awd\.datatype\.literal)\s*\(([\s\S]*)\)\s*$/i); if (!match) { return spec; } - return match[1]; + const unwrapped = match[1]; + if (unwrapped === '""' || unwrapped === "''") { + return ''; + } + return unwrapped; + } + + extractRegexValue(ruleSpec) { + const spec = String(ruleSpec || '').trim(); + const match = spec.match(/^(?:regex|datatype\.regex|awd\.datatype\.regex)\s*\(([\s\S]*)\)\s*$/i); + if (!match) { + return spec; + } + const unwrapped = match[1]; + if (unwrapped === '""' || unwrapped === "''") { + return ''; + } + return unwrapped; } isValid() { diff --git a/packages/core/js/domain/counterstring.js b/packages/core/js/domain/counterstring.js new file mode 100644 index 00000000..e94f1bda --- /dev/null +++ b/packages/core/js/domain/counterstring.js @@ -0,0 +1,48 @@ +function reverseString(reverseMe) { + return String(reverseMe).split('').reverse().join(''); +} + +function getCounterString(count, delimiter) { + let counter = Number(count); + let token = String(delimiter ?? '').trim(); + if (!token) { + token = '*'; + } + token = token[0]; + + let counterString = ''; + while (counter > 0) { + let appendThis = `${token}${reverseString(counter.toString())}`; + if (appendThis.length > counter) { + appendThis = appendThis.substring(0, counter); + } + counterString += appendThis; + counter -= appendThis.length; + } + return reverseString(counterString); +} + +function getIntegerArg(value, argName) { + if (!Number.isInteger(value)) { + throw new Error(`Invalid argument for ${argName}: expected an integer.`); + } + return value; +} + +function executeCustomCounterString(executionContext = {}) { + const args = Array.isArray(executionContext.args) ? executionContext.args : []; + const hasMin = typeof args[0] !== 'undefined'; + const hasMax = typeof args[1] !== 'undefined'; + + const minArg = hasMin ? getIntegerArg(args[0], 'min') : 1; + const maxArg = hasMax ? getIntegerArg(args[1], 'max') : hasMin ? minArg : 25; + + const lowest = Math.max(1, Math.min(minArg, maxArg)); + const highest = Math.max(1, Math.max(minArg, maxArg)); + const delimiter = typeof args[2] === 'undefined' ? '*' : args[2]; + + const length = lowest + Math.floor(Math.random() * (highest - lowest + 1)); + return getCounterString(length, delimiter); +} + +export { executeCustomCounterString }; diff --git a/packages/core/js/domain/domain-custom-literal-keyword-definitions.js b/packages/core/js/domain/domain-custom-literal-keyword-definitions.js new file mode 100644 index 00000000..025f06ef --- /dev/null +++ b/packages/core/js/domain/domain-custom-literal-keyword-definitions.js @@ -0,0 +1,27 @@ +const DOMAIN_CUSTOM_LITERAL_KEYWORD_DEFINITIONS = [ + { + keyword: 'literal.value', + delegate: { + type: 'custom', + target: 'literal.value', + }, + help: { + summary: 'Return the literal value provided by the caller.', + docsUrl: 'https://anywaydata.com/docs/category/generating-data', + example: 'Pending', + examples: ['literal.value("Pending")', 'literal.value("")'], + exampleReturnValues: ['Pending', ''], + returnType: 'string|number|boolean', + args: [ + { + name: 'value', + type: 'string|number|boolean', + required: false, + description: 'Literal value to return. When omitted, defaults to an empty string.', + }, + ], + }, + }, +]; + +export { DOMAIN_CUSTOM_LITERAL_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-custom-string-keyword-definitions.js b/packages/core/js/domain/domain-custom-string-keyword-definitions.js new file mode 100644 index 00000000..87537f87 --- /dev/null +++ b/packages/core/js/domain/domain-custom-string-keyword-definitions.js @@ -0,0 +1,47 @@ +const DOMAIN_CUSTOM_STRING_KEYWORD_DEFINITIONS = [ + { + keyword: 'string.counterString', + delegate: { + type: 'custom', + target: 'string.counterString', + }, + help: { + summary: + 'Generates a counterstring for a random length between min and max (or fixed length when only one value is provided). Defaults to min=1 and max=25 when omitted.', + docsUrl: '/docs/test-data/counterstrings', + example: '*3*5*7*9*12*15*', + examples: [ + 'string.counterString()', + 'string.counterString(15)', + 'string.counterString(min=5, max=12)', + 'string.counterString(min=12, max=12, delimiter="#")', + ], + exampleReturnValues: ['*3*5*7*9*12*15*', '#3#5#7#9#12#'], + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: + 'Minimum counterstring length (integer). If max is omitted and min is provided, min is also used as max. Defaults to 1 when omitted. Non-integer values throw an exception.', + }, + { + name: 'max', + type: 'number', + required: false, + description: + 'Maximum counterstring length (integer). If less than min, values are swapped. Defaults to 25 when omitted. Non-integer values throw an exception.', + }, + { + name: 'delimiter', + type: 'string', + required: false, + description: 'Delimiter character used between position markers. Defaults to "*".', + }, + ], + }, + }, +]; + +export { DOMAIN_CUSTOM_STRING_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-doc-markdown.js b/packages/core/js/domain/domain-doc-markdown.js new file mode 100644 index 00000000..9c9f00d5 --- /dev/null +++ b/packages/core/js/domain/domain-doc-markdown.js @@ -0,0 +1,10 @@ +export function toInlineCode(value) { + const text = String(value ?? '') + .replaceAll('\r\n', '\n') + .replaceAll('\r', '\n') + .replaceAll('\n', '\\n'); + const backtickRuns = text.match(/`+/g) || []; + const longestRun = backtickRuns.reduce((max, run) => Math.max(max, run.length), 0); + const fence = '`'.repeat(longestRun + 1); + return `${fence}${text}${fence}`; +} diff --git a/packages/core/js/domain/domain-faker-airline-keyword-definitions.js b/packages/core/js/domain/domain-faker-airline-keyword-definitions.js new file mode 100644 index 00000000..19818bc7 --- /dev/null +++ b/packages/core/js/domain/domain-faker-airline-keyword-definitions.js @@ -0,0 +1,201 @@ +const DOMAIN_FAKER_AIRLINE_KEYWORD_DEFINITIONS = [ + { + keyword: 'airline.aircraftType', + delegate: { + type: 'faker', + target: 'airline.aircraftType', + }, + help: { + summary: 'Returns a random aircraft type.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'regional', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.airline', + delegate: { + type: 'faker', + target: 'airline.airline', + }, + help: { + summary: 'Generate a value using faker airline.airline.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: '{"name":"American Airlines","iataCode":"AA"}', + returnType: 'object', + args: [], + }, + }, + { + keyword: 'airline.airline.iataCode', + delegate: { + type: 'faker', + target: 'airline.airline', + resultPath: 'iataCode', + }, + help: { + summary: 'Generate an airline IATA code.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'AA', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.airline.name', + delegate: { + type: 'faker', + target: 'airline.airline', + resultPath: 'name', + }, + help: { + summary: 'Generate an airline name.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'Acme Air', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.airplane', + delegate: { + type: 'faker', + target: 'airline.airplane', + }, + help: { + summary: 'Generate a value using faker airline.airplane.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: '{"name":"Airbus A320","iataTypeCode":"A320"}', + returnType: 'object', + args: [], + }, + }, + { + keyword: 'airline.airplane.iataTypeCode', + delegate: { + type: 'faker', + target: 'airline.airplane', + resultPath: 'iataTypeCode', + }, + help: { + summary: 'Generate an airplane IATA type code.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'A320', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.airplane.name', + delegate: { + type: 'faker', + target: 'airline.airplane', + resultPath: 'name', + }, + help: { + summary: 'Generate an airplane model name.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'Boeing 737', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.airport', + delegate: { + type: 'faker', + target: 'airline.airport', + }, + help: { + summary: 'Generate a value using faker airline.airport.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: '{"name":"Heathrow Airport","iataCode":"LHR"}', + returnType: 'object', + args: [], + }, + }, + { + keyword: 'airline.airport.iataCode', + delegate: { + type: 'faker', + target: 'airline.airport', + resultPath: 'iataCode', + }, + help: { + summary: 'Generate an airport IATA code.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'LHR', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.airport.name', + delegate: { + type: 'faker', + target: 'airline.airport', + resultPath: 'name', + }, + help: { + summary: 'Generate an airport name.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'London Heathrow Airport', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.flightNumber', + delegate: { + type: 'faker', + target: 'airline.flightNumber', + }, + help: { + summary: + 'Returns a random flight number. Flight numbers are always 1 to 4 digits long and may include leading zeros.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: '1', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.recordLocator', + delegate: { + type: 'faker', + target: 'airline.recordLocator', + }, + help: { + summary: 'Generates a random record locator. Record locators are 6-character alphanumeric booking references.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: 'TCSJCN', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'airline.seat', + delegate: { + type: 'faker', + target: 'airline.seat', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random seat.', + docsUrl: 'https://fakerjs.dev/api/airline', + example: '17F', + returnType: 'string', + args: [ + { + name: 'aircraftType', + type: 'string', + required: false, + description: 'The aircraft type. Can be one of narrowbody, regional, widebody.', + }, + ], + }, + }, +]; + +export { DOMAIN_FAKER_AIRLINE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-animal-keyword-definitions.js b/packages/core/js/domain/domain-faker-animal-keyword-definitions.js new file mode 100644 index 00000000..52f64c81 --- /dev/null +++ b/packages/core/js/domain/domain-faker-animal-keyword-definitions.js @@ -0,0 +1,228 @@ +const DOMAIN_FAKER_ANIMAL_KEYWORD_DEFINITIONS = [ + { + keyword: 'animal.bear', + delegate: { + type: 'faker', + target: 'animal.bear', + }, + help: { + summary: 'Returns a random bear species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Sloth bear', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.bird', + delegate: { + type: 'faker', + target: 'animal.bird', + }, + help: { + summary: 'Returns a random bird species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Orange-crowned Warbler', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.cat', + delegate: { + type: 'faker', + target: 'animal.cat', + }, + help: { + summary: 'Returns a random cat breed.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Russian Blue', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.cetacean', + delegate: { + type: 'faker', + target: 'animal.cetacean', + }, + help: { + summary: 'Returns a random cetacean species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Hector’s Dolphin', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.cow', + delegate: { + type: 'faker', + target: 'animal.cow', + }, + help: { + summary: 'Returns a random cow species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Aubrac', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.crocodilia', + delegate: { + type: 'faker', + target: 'animal.crocodilia', + }, + help: { + summary: 'Returns a random crocodilian species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Nile Crocodile', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.dog', + delegate: { + type: 'faker', + target: 'animal.dog', + }, + help: { + summary: 'Returns a random dog breed.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Jonangi', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.fish', + delegate: { + type: 'faker', + target: 'animal.fish', + }, + help: { + summary: 'Returns a random fish species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Short mackerel', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.horse', + delegate: { + type: 'faker', + target: 'animal.horse', + }, + help: { + summary: 'Returns a random horse breed.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Rottaler', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.insect', + delegate: { + type: 'faker', + target: 'animal.insect', + }, + help: { + summary: 'Returns a random insect species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Pigeon tremex', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.lion', + delegate: { + type: 'faker', + target: 'animal.lion', + }, + help: { + summary: 'Returns a random lion species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Masai Lion', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.petName', + delegate: { + type: 'faker', + target: 'animal.petName', + }, + help: { + summary: 'Returns a random pet name.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Stella', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.rabbit', + delegate: { + type: 'faker', + target: 'animal.rabbit', + }, + help: { + summary: 'Returns a random rabbit species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'Californian', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.rodent', + delegate: { + type: 'faker', + target: 'animal.rodent', + }, + help: { + summary: 'Returns a random rodent breed.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: "Natterer's tuco-tuco", + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.snake', + delegate: { + type: 'faker', + target: 'animal.snake', + }, + help: { + summary: 'Returns a random snake species.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'White-lipped python', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'animal.type', + delegate: { + type: 'faker', + target: 'animal.type', + }, + help: { + summary: 'Returns a random animal type.', + docsUrl: 'https://fakerjs.dev/api/animal', + example: 'bear', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_ANIMAL_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-book-keyword-definitions.js b/packages/core/js/domain/domain-faker-book-keyword-definitions.js new file mode 100644 index 00000000..67658c84 --- /dev/null +++ b/packages/core/js/domain/domain-faker-book-keyword-definitions.js @@ -0,0 +1,88 @@ +const DOMAIN_FAKER_BOOK_KEYWORD_DEFINITIONS = [ + { + keyword: 'book.author', + delegate: { + type: 'faker', + target: 'book.author', + }, + help: { + summary: 'Returns a random author name.', + docsUrl: 'https://fakerjs.dev/api/book', + example: 'Jacqueline Crooks', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'book.format', + delegate: { + type: 'faker', + target: 'book.format', + }, + help: { + summary: 'Returns a random book format.', + docsUrl: 'https://fakerjs.dev/api/book', + example: 'Paperback', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'book.genre', + delegate: { + type: 'faker', + target: 'book.genre', + }, + help: { + summary: 'Returns a random genre.', + docsUrl: 'https://fakerjs.dev/api/book', + example: 'Science Fiction', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'book.publisher', + delegate: { + type: 'faker', + target: 'book.publisher', + }, + help: { + summary: 'Returns a random publisher.', + docsUrl: 'https://fakerjs.dev/api/book', + example: 'Butterworth-Heinemann', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'book.series', + delegate: { + type: 'faker', + target: 'book.series', + }, + help: { + summary: 'Returns a random series.', + docsUrl: 'https://fakerjs.dev/api/book', + example: 'The Inheritance Cycle', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'book.title', + delegate: { + type: 'faker', + target: 'book.title', + }, + help: { + summary: 'Returns a random title.', + docsUrl: 'https://fakerjs.dev/api/book', + example: 'Animal Farm', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_BOOK_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-color-keyword-definitions.js b/packages/core/js/domain/domain-faker-color-keyword-definitions.js new file mode 100644 index 00000000..cc6118b2 --- /dev/null +++ b/packages/core/js/domain/domain-faker-color-keyword-definitions.js @@ -0,0 +1,230 @@ +const DOMAIN_FAKER_COLOR_KEYWORD_DEFINITIONS = [ + { + keyword: 'color.cmyk', + delegate: { + type: 'faker', + target: 'color.cmyk', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a CMYK color.', + docsUrl: 'https://fakerjs.dev/api/color', + example: '[0.95,0.17,0.23,1]', + returnType: 'array', + args: [ + { + name: 'format', + type: 'string', + required: false, + description: 'Format of generated CMYK color.', + }, + ], + }, + }, + { + keyword: 'color.colorByCSSColorSpace', + delegate: { + type: 'faker', + target: 'color.colorByCSSColorSpace', + }, + help: { + summary: 'Returns a random color based on CSS color space specified.', + docsUrl: 'https://fakerjs.dev/api/color', + example: '[0.5811,0.0479,0.1091]', + returnType: 'array', + args: [], + }, + }, + { + keyword: 'color.cssSupportedFunction', + delegate: { + type: 'faker', + target: 'color.cssSupportedFunction', + }, + help: { + summary: 'Returns a random css supported color function name.', + docsUrl: 'https://fakerjs.dev/api/color', + example: 'hsla', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'color.cssSupportedSpace', + delegate: { + type: 'faker', + target: 'color.cssSupportedSpace', + }, + help: { + summary: 'Returns a random css supported color space name.', + docsUrl: 'https://fakerjs.dev/api/color', + example: 'sRGB', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'color.hsl', + delegate: { + type: 'faker', + target: 'color.hsl', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns an HSL color.', + docsUrl: 'https://fakerjs.dev/api/color', + example: '[212,0.78,0.54]', + returnType: 'array', + args: [ + { + name: 'format', + type: 'string', + required: false, + description: 'Format of generated HSL color.', + }, + { + name: 'includeAlpha', + type: 'boolean', + required: false, + description: 'Adds an alpha value to the color (RGBA).', + }, + ], + }, + }, + { + keyword: 'color.human', + delegate: { + type: 'faker', + target: 'color.human', + }, + help: { + summary: 'Returns a random human-readable color name.', + docsUrl: 'https://fakerjs.dev/api/color', + example: 'green', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'color.hwb', + delegate: { + type: 'faker', + target: 'color.hwb', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns an HWB color.', + docsUrl: 'https://fakerjs.dev/api/color', + example: '[328,0.27,0.33]', + returnType: 'array', + args: [ + { + name: 'format', + type: 'string', + required: false, + description: 'Format of generated RGB color.', + }, + ], + }, + }, + { + keyword: 'color.lab', + delegate: { + type: 'faker', + target: 'color.lab', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a LAB (CIELAB) color.', + docsUrl: 'https://fakerjs.dev/api/color', + example: '[0.071396,-55.6612,-66.7185]', + returnType: 'array', + args: [ + { + name: 'format', + type: 'string', + required: false, + description: 'Format of generated RGB color.', + }, + ], + }, + }, + { + keyword: 'color.lch', + delegate: { + type: 'faker', + target: 'color.lch', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns an LCH color.', + docsUrl: 'https://fakerjs.dev/api/color', + example: '[0.469557,212.9,204.9]', + returnType: 'array', + args: [ + { + name: 'format', + type: 'string', + required: false, + description: 'Format of generated RGB color.', + }, + ], + }, + }, + { + keyword: 'color.rgb', + delegate: { + type: 'faker', + target: 'color.rgb', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns an RGB color.', + docsUrl: 'https://fakerjs.dev/api/color', + example: '#ee8222', + returnType: 'string', + args: [ + { + name: 'casing', + type: 'string', + required: false, + description: "Letter type case of the generated hex color. Only applied when 'hex' format is used.", + }, + { + name: 'format', + type: 'string', + required: false, + description: 'Format of generated RGB color.', + }, + { + name: 'includeAlpha', + type: 'boolean', + required: false, + description: 'Adds an alpha value to the color (RGBA).', + }, + { + name: 'prefix', + type: 'string', + required: false, + description: "Prefix of the generated hex color. Only applied when 'hex' format is used.", + }, + ], + }, + }, + { + keyword: 'color.space', + delegate: { + type: 'faker', + target: 'color.space', + }, + help: { + summary: 'Returns a random color space name from the worldwide accepted color spaces.', + docsUrl: 'https://fakerjs.dev/api/color', + example: 'HSL', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_COLOR_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-commerce-keyword-definitions.js b/packages/core/js/domain/domain-faker-commerce-keyword-definitions.js new file mode 100644 index 00000000..4846dd33 --- /dev/null +++ b/packages/core/js/domain/domain-faker-commerce-keyword-definitions.js @@ -0,0 +1,156 @@ +const DOMAIN_FAKER_COMMERCE_KEYWORD_DEFINITIONS = [ + { + keyword: 'commerce.department', + delegate: { + type: 'faker', + target: 'commerce.department', + }, + help: { + summary: 'Returns a department inside a shop.', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: 'Tools', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'commerce.isbn', + delegate: { + type: 'faker', + target: 'commerce.isbn', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random ISBN identifier.', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: '978-1-996134-54-2', + returnType: 'string', + args: [ + { + name: 'separator', + type: 'string', + required: false, + description: 'Separator inserted between generated items.', + }, + { + name: 'variant', + type: 'string', + required: false, + description: 'ISBN length variant: use "10" for ISBN-10 or "13" for ISBN-13.', + }, + ], + }, + }, + { + keyword: 'commerce.price', + delegate: { + type: 'faker', + target: 'commerce.price', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a price between min and max (inclusive).', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: '797.39', + returnType: 'number', + args: [ + { + name: 'dec', + type: 'number', + required: false, + description: 'The number of decimal places.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'The maximum price.', + }, + { + name: 'min', + type: 'number', + required: false, + description: 'The minimum price.', + }, + { + name: 'symbol', + type: 'string', + required: false, + description: 'The currency value to use.', + }, + ], + }, + }, + { + keyword: 'commerce.product', + delegate: { + type: 'faker', + target: 'commerce.product', + }, + help: { + summary: 'Returns a short product name.', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: 'Bike', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'commerce.productAdjective', + delegate: { + type: 'faker', + target: 'commerce.productAdjective', + }, + help: { + summary: 'Returns an adjective describing a product.', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: 'Luxurious', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'commerce.productDescription', + delegate: { + type: 'faker', + target: 'commerce.productDescription', + }, + help: { + summary: 'Returns a product description.', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: 'The green Hat combines Colombia aesthetics with Scandium-based durability', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'commerce.productMaterial', + delegate: { + type: 'faker', + target: 'commerce.productMaterial', + }, + help: { + summary: 'Returns a material of a product.', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: 'Steel', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'commerce.productName', + delegate: { + type: 'faker', + target: 'commerce.productName', + }, + help: { + summary: 'Generates a random descriptive product name.', + docsUrl: 'https://fakerjs.dev/api/commerce', + example: 'Soft Bronze Towels', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_COMMERCE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-company-keyword-definitions.js b/packages/core/js/domain/domain-faker-company-keyword-definitions.js new file mode 100644 index 00000000..4090053f --- /dev/null +++ b/packages/core/js/domain/domain-faker-company-keyword-definitions.js @@ -0,0 +1,130 @@ +const DOMAIN_FAKER_COMPANY_KEYWORD_DEFINITIONS = [ + { + keyword: 'company.buzzAdjective', + delegate: { + type: 'faker', + target: 'company.buzzAdjective', + }, + help: { + summary: 'Returns a random buzz adjective that can be used to demonstrate data being viewed by a manager.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'out-of-the-box', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.buzzNoun', + delegate: { + type: 'faker', + target: 'company.buzzNoun', + }, + help: { + summary: 'Returns a random buzz noun that can be used to demonstrate data being viewed by a manager.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'deliverables', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.buzzPhrase', + delegate: { + type: 'faker', + target: 'company.buzzPhrase', + }, + help: { + summary: 'Generates a random buzz phrase that can be used to demonstrate data being viewed by a manager.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'streamline cutting-edge platforms', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.buzzVerb', + delegate: { + type: 'faker', + target: 'company.buzzVerb', + }, + help: { + summary: 'Returns a random buzz verb that can be used to demonstrate data being viewed by a manager.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'disintermediate', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.catchPhrase', + delegate: { + type: 'faker', + target: 'company.catchPhrase', + }, + help: { + summary: 'Generates a random catch phrase that can be displayed to an end user.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'Diverse AI-powered flexibility', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.catchPhraseAdjective', + delegate: { + type: 'faker', + target: 'company.catchPhraseAdjective', + }, + help: { + summary: 'Returns a random catch phrase adjective that can be displayed to an end user.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'Distributed', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.catchPhraseDescriptor', + delegate: { + type: 'faker', + target: 'company.catchPhraseDescriptor', + }, + help: { + summary: 'Returns a random catch phrase descriptor that can be displayed to an end user.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'encompassing', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.catchPhraseNoun', + delegate: { + type: 'faker', + target: 'company.catchPhraseNoun', + }, + help: { + summary: 'Returns a random catch phrase noun that can be displayed to an end user.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'attitude', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'company.name', + delegate: { + type: 'faker', + target: 'company.name', + }, + help: { + summary: 'Generates a random company name.', + docsUrl: 'https://fakerjs.dev/api/company', + example: 'Lang - Little', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_COMPANY_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-database-keyword-definitions.js b/packages/core/js/domain/domain-faker-database-keyword-definitions.js new file mode 100644 index 00000000..b4f2f129 --- /dev/null +++ b/packages/core/js/domain/domain-faker-database-keyword-definitions.js @@ -0,0 +1,74 @@ +const DOMAIN_FAKER_DATABASE_KEYWORD_DEFINITIONS = [ + { + keyword: 'database.collation', + delegate: { + type: 'faker', + target: 'database.collation', + }, + help: { + summary: 'Returns a random database collation.', + docsUrl: 'https://fakerjs.dev/api/database', + example: 'utf8_bin', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'database.column', + delegate: { + type: 'faker', + target: 'database.column', + }, + help: { + summary: 'Returns a random database column name.', + docsUrl: 'https://fakerjs.dev/api/database', + example: 'status', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'database.engine', + delegate: { + type: 'faker', + target: 'database.engine', + }, + help: { + summary: 'Returns a random database engine.', + docsUrl: 'https://fakerjs.dev/api/database', + example: 'ARCHIVE', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'database.mongodbObjectId', + delegate: { + type: 'faker', + target: 'database.mongodbObjectId', + }, + help: { + summary: 'Returns a MongoDB ObjectId string.', + docsUrl: 'https://fakerjs.dev/api/database', + example: 'e80bba2ae67c0c7dcc16bd57', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'database.type', + delegate: { + type: 'faker', + target: 'database.type', + }, + help: { + summary: 'Returns a random database column type.', + docsUrl: 'https://fakerjs.dev/api/database', + example: 'smallint', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_DATABASE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-datatype-keyword-definitions.js b/packages/core/js/domain/domain-faker-datatype-keyword-definitions.js new file mode 100644 index 00000000..a90e520f --- /dev/null +++ b/packages/core/js/domain/domain-faker-datatype-keyword-definitions.js @@ -0,0 +1,26 @@ +const DOMAIN_FAKER_DATATYPE_KEYWORD_DEFINITIONS = [ + { + keyword: 'datatype.boolean', + delegate: { + type: 'faker', + target: 'datatype.boolean', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns the boolean value true or false.', + docsUrl: 'https://fakerjs.dev/api/datatype', + example: 'true', + returnType: 'boolean', + args: [ + { + name: 'probability', + type: 'number', + required: false, + description: 'Probability threshold for returning true (between 0 and 1).', + }, + ], + }, + }, +]; + +export { DOMAIN_FAKER_DATATYPE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-date-keyword-definitions.js b/packages/core/js/domain/domain-faker-date-keyword-definitions.js new file mode 100644 index 00000000..0bc04157 --- /dev/null +++ b/packages/core/js/domain/domain-faker-date-keyword-definitions.js @@ -0,0 +1,314 @@ +const DOMAIN_FAKER_DATE_KEYWORD_DEFINITIONS = [ + { + keyword: 'date.anytime', + delegate: { + type: 'faker', + target: 'date.anytime', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random date that can be either in the past or in the future.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '"2026-12-25T08:55:20.593Z"', + returnType: 'date', + args: [ + { + name: 'refDate', + type: 'number', + required: false, + description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', + }, + ], + }, + }, + { + keyword: 'date.between', + delegate: { + type: 'faker', + target: 'date.between', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random date between the given boundaries.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '2026-01-15T12:34:56.000Z', + returnType: 'date', + args: [ + { + name: 'from', + type: 'number', + required: false, + description: 'Start boundary as a Unix timestamp in milliseconds since epoch.', + }, + { + name: 'to', + type: 'number', + required: false, + description: 'End boundary as a Unix timestamp in milliseconds since epoch.', + }, + ], + }, + }, + { + keyword: 'date.betweens', + delegate: { + type: 'faker', + target: 'date.betweens', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: + 'Generates random dates between the given boundaries. The dates will be returned in an array sorted in chronological order.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '["2026-01-15T12:34:56.000Z","2026-02-01T09:00:00.000Z"]', + returnType: 'array', + args: [ + { + name: 'count', + type: 'number', + required: false, + description: 'The number of dates to generate.', + }, + { + name: 'from', + type: 'number', + required: false, + description: 'Start boundary as a Unix timestamp in milliseconds since epoch.', + }, + { + name: 'to', + type: 'number', + required: false, + description: 'End boundary as a Unix timestamp in milliseconds since epoch.', + }, + ], + }, + }, + { + keyword: 'date.birthdate', + delegate: { + type: 'faker', + target: 'date.birthdate', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: + 'Returns a random birthdate. By default, the birthdate is generated for an adult between 18 and 80 years old.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '"1966-09-18T08:47:31.333Z"', + returnType: 'date', + args: [ + { + name: 'refDate', + type: 'number', + required: false, + description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'The maximum age/year to generate a birthdate for/in.', + }, + { + name: 'min', + type: 'number', + required: false, + description: 'The minimum age/year to generate a birthdate for/in.', + }, + { + name: 'mode', + type: 'string', + required: false, + description: "Either 'age' or 'year' to generate a birthdate based on the age or year range.", + }, + ], + }, + }, + { + keyword: 'date.future', + delegate: { + type: 'faker', + target: 'date.future', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random date in the future.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '"2027-02-07T18:41:48.525Z"', + returnType: 'date', + args: [ + { + name: 'refDate', + type: 'number', + required: false, + description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', + }, + { + name: 'years', + type: 'number', + required: false, + description: 'The range of years the date may be in the future.', + }, + ], + }, + }, + { + keyword: 'date.month', + delegate: { + type: 'faker', + target: 'date.month', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random name of a month.', + docsUrl: 'https://fakerjs.dev/api/date', + example: 'February', + returnType: 'string', + args: [ + { + name: 'abbreviated', + type: 'boolean', + required: false, + description: 'Whether to return an abbreviation.', + }, + { + name: 'context', + type: 'boolean', + required: false, + description: + 'Whether to return the name of a month in the context of a date. In the currently supported locale this has no visible effect. This option is mainly relevant for future multi-locale support (for example, locale-specific grammar/capitalization differences).', + }, + ], + }, + }, + { + keyword: 'date.past', + delegate: { + type: 'faker', + target: 'date.past', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random date in the past.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '"2025-07-01T11:48:55.347Z"', + returnType: 'date', + args: [ + { + name: 'refDate', + type: 'number', + required: false, + description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', + }, + { + name: 'years', + type: 'number', + required: false, + description: 'The range of years the date may be in the past.', + }, + ], + }, + }, + { + keyword: 'date.recent', + delegate: { + type: 'faker', + target: 'date.recent', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random date in the recent past.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '"2026-04-27T23:46:16.707Z"', + returnType: 'date', + args: [ + { + name: 'days', + type: 'number', + required: false, + description: 'The range of days the date may be in the past.', + }, + { + name: 'refDate', + type: 'number', + required: false, + description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', + }, + ], + }, + }, + { + keyword: 'date.soon', + delegate: { + type: 'faker', + target: 'date.soon', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random date in the near future.', + docsUrl: 'https://fakerjs.dev/api/date', + example: '"2026-04-29T11:09:09.211Z"', + returnType: 'date', + args: [ + { + name: 'days', + type: 'number', + required: false, + description: 'The range of days the date may be in the future.', + }, + { + name: 'refDate', + type: 'number', + required: false, + description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', + }, + ], + }, + }, + { + keyword: 'date.timeZone', + delegate: { + type: 'faker', + target: 'date.timeZone', + }, + help: { + summary: 'Returns a random IANA time zone relevant to this locale.', + docsUrl: 'https://fakerjs.dev/api/date', + example: 'Europe/Stockholm', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'date.weekday', + delegate: { + type: 'faker', + target: 'date.weekday', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random day of the week.', + docsUrl: 'https://fakerjs.dev/api/date', + example: 'Tuesday', + returnType: 'string', + args: [ + { + name: 'abbreviated', + type: 'boolean', + required: false, + description: 'Whether to return an abbreviation.', + }, + { + name: 'context', + type: 'boolean', + required: false, + description: + 'Whether to return the day of the week in the context of a date. In the currently supported locale this has no visible effect. This option is mainly relevant for future multi-locale support (for example, locale-specific grammar/capitalization differences).', + }, + ], + }, + }, +]; + +export { DOMAIN_FAKER_DATE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-finance-keyword-definitions.js b/packages/core/js/domain/domain-faker-finance-keyword-definitions.js new file mode 100644 index 00000000..31e3dd35 --- /dev/null +++ b/packages/core/js/domain/domain-faker-finance-keyword-definitions.js @@ -0,0 +1,382 @@ +const DOMAIN_FAKER_FINANCE_KEYWORD_DEFINITIONS = [ + { + keyword: 'finance.accountName', + delegate: { + type: 'faker', + target: 'finance.accountName', + }, + help: { + summary: 'Generates a random account name.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'Investment Account', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.accountNumber', + delegate: { + type: 'faker', + target: 'finance.accountNumber', + }, + help: { + summary: 'Generates a random account number.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '43208795', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + ], + }, + }, + { + keyword: 'finance.amount', + delegate: { + type: 'faker', + target: 'finance.amount', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random amount between the given bounds (inclusive).', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '536.86', + returnType: 'number', + args: [ + { + name: 'autoFormat', + type: 'boolean', + required: false, + description: 'If true this method will use Number.toLocaleString(). Otherwise it will use Number.toFixed().', + }, + { + name: 'dec', + type: 'number', + required: false, + description: 'The number of decimal places for the amount.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'The upper bound for the amount.', + }, + { + name: 'min', + type: 'number', + required: false, + description: 'The lower bound for the amount.', + }, + { + name: 'symbol', + type: 'string', + required: false, + description: 'The symbol used to prefix the amount.', + }, + ], + }, + }, + { + keyword: 'finance.bic', + delegate: { + type: 'faker', + target: 'finance.bic', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random SWIFT/BIC code based on the ISO-9362 format.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'TXWRPYFT', + returnType: 'string', + args: [ + { + name: 'includeBranchCode', + type: 'boolean', + required: false, + description: 'Whether to include a three-digit branch code at the end of the generated code.', + }, + ], + }, + }, + { + keyword: 'finance.bitcoinAddress', + delegate: { + type: 'faker', + target: 'finance.bitcoinAddress', + }, + help: { + summary: 'Generates a random Bitcoin address.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '39fu5Nhnibj2xa8FPVxCbX7y4xZi5SWd', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.creditCardCVV', + delegate: { + type: 'faker', + target: 'finance.creditCardCVV', + }, + help: { + summary: 'Generates a random credit card CVV.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '839', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.creditCardIssuer', + delegate: { + type: 'faker', + target: 'finance.creditCardIssuer', + }, + help: { + summary: 'Returns a random credit card issuer.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'jcb', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.creditCardNumber', + delegate: { + type: 'faker', + target: 'finance.creditCardNumber', + }, + help: { + summary: 'Generates a random credit card number.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '6449-4462-4996-7580', + returnType: 'string', + args: [ + { + name: 'issuer', + type: 'string', + required: false, + description: 'Issuer or provider value used to constrain generated output.', + }, + ], + }, + }, + { + keyword: 'finance.currency', + delegate: { + type: 'faker', + target: 'finance.currency', + }, + help: { + summary: 'Returns a random currency object, containing `code`, `name`, `symbol`, and `numericCode` properties.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '{"name":"Rial Omani","code":"OMR","symbol":"﷼","numericCode":"512"}', + returnType: 'object', + args: [], + }, + }, + { + keyword: 'finance.currencyCode', + delegate: { + type: 'faker', + target: 'finance.currencyCode', + }, + help: { + summary: 'Returns a random currency code.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'ISK', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.currencyName', + delegate: { + type: 'faker', + target: 'finance.currencyName', + }, + help: { + summary: 'Returns a random currency name.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'South Sudanese pound', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.currencyNumericCode', + delegate: { + type: 'faker', + target: 'finance.currencyNumericCode', + }, + help: { + summary: 'Returns a random currency numeric code.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '270', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.currencySymbol', + delegate: { + type: 'faker', + target: 'finance.currencySymbol', + }, + help: { + summary: 'Returns a random currency symbol.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '₩', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.ethereumAddress', + delegate: { + type: 'faker', + target: 'finance.ethereumAddress', + }, + help: { + summary: 'Creates a random, non-checksum Ethereum address.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '0xf5d385aff27de9dee6eeeffd924ffd7dd2d252ca', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.iban', + delegate: { + type: 'faker', + target: 'finance.iban', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random IBAN.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'CH67001759079BP5WA811', + returnType: 'string', + args: [ + { + name: 'countryCode', + type: 'string', + required: false, + description: + 'The country code from which you want to generate an IBAN, if none is provided a random country will be used.', + }, + { + name: 'formatted', + type: 'boolean', + required: false, + description: 'Return a formatted version of the generated IBAN.', + }, + ], + }, + }, + { + keyword: 'finance.litecoinAddress', + delegate: { + type: 'faker', + target: 'finance.litecoinAddress', + }, + help: { + summary: 'Generates a random Litecoin address.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'M7nWopfUfSjA8cmGWvuENRLu6GU4C1iTK', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.maskedNumber', + delegate: { + type: 'faker', + target: 'finance.maskedNumber', + }, + help: { + summary: 'Generates a random masked number.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '(...0934)', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + ], + }, + }, + { + keyword: 'finance.pin', + delegate: { + type: 'faker', + target: 'finance.pin', + }, + help: { + summary: 'Generates a random PIN number.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '1107', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + ], + }, + }, + { + keyword: 'finance.routingNumber', + delegate: { + type: 'faker', + target: 'finance.routingNumber', + }, + help: { + summary: 'Generates a random routing number.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: '933657999', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.transactionDescription', + delegate: { + type: 'faker', + target: 'finance.transactionDescription', + }, + help: { + summary: 'Generates a random transaction description.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: + 'Transaction alert: deposit at Jones LLC using card ending ****4221 for an amount of GIP 94.88 on account ***3694.', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'finance.transactionType', + delegate: { + type: 'faker', + target: 'finance.transactionType', + }, + help: { + summary: 'Returns a random transaction type.', + docsUrl: 'https://fakerjs.dev/api/finance', + example: 'deposit', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_FINANCE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-food-keyword-definitions.js b/packages/core/js/domain/domain-faker-food-keyword-definitions.js new file mode 100644 index 00000000..a6ccc18a --- /dev/null +++ b/packages/core/js/domain/domain-faker-food-keyword-definitions.js @@ -0,0 +1,130 @@ +const DOMAIN_FAKER_FOOD_KEYWORD_DEFINITIONS = [ + { + keyword: 'food.adjective', + delegate: { + type: 'faker', + target: 'food.adjective', + }, + help: { + summary: 'Generates a random dish adjective.', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'salty', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.description', + delegate: { + type: 'faker', + target: 'food.description', + }, + help: { + summary: 'Generates a random dish description.', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'Fresh mixed greens tossed with pimento-rubbed pigeon, bean shoots, and a light dressing.', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.dish', + delegate: { + type: 'faker', + target: 'food.dish', + }, + help: { + summary: 'Generates a random dish name.', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'Chicken Fajitas', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.ethnicCategory', + delegate: { + type: 'faker', + target: 'food.ethnicCategory', + }, + help: { + summary: "Generates a random food's ethnic category.", + docsUrl: 'https://fakerjs.dev/api/food', + example: 'Lithuanian', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.fruit', + delegate: { + type: 'faker', + target: 'food.fruit', + }, + help: { + summary: 'Generates a random fruit name.', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'snowpea', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.ingredient', + delegate: { + type: 'faker', + target: 'food.ingredient', + }, + help: { + summary: 'Generates a random ingredient name.', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'spelt', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.meat', + delegate: { + type: 'faker', + target: 'food.meat', + }, + help: { + summary: 'Generates a random meat', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'goose', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.spice', + delegate: { + type: 'faker', + target: 'food.spice', + }, + help: { + summary: 'Generates a random spice name.', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'poudre de colombo', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'food.vegetable', + delegate: { + type: 'faker', + target: 'food.vegetable', + }, + help: { + summary: 'Generates a random vegetable name.', + docsUrl: 'https://fakerjs.dev/api/food', + example: 'snowpea sprouts', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_FOOD_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-git-keyword-definitions.js b/packages/core/js/domain/domain-faker-git-keyword-definitions.js new file mode 100644 index 00000000..92c1a2b4 --- /dev/null +++ b/packages/core/js/domain/domain-faker-git-keyword-definitions.js @@ -0,0 +1,74 @@ +const DOMAIN_FAKER_GIT_KEYWORD_DEFINITIONS = [ + { + keyword: 'git.branch', + delegate: { + type: 'faker', + target: 'git.branch', + }, + help: { + summary: 'Generates a random branch name.', + docsUrl: 'https://fakerjs.dev/api/git', + example: 'array-compress', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'git.commitDate', + delegate: { + type: 'faker', + target: 'git.commitDate', + }, + help: { + summary: 'Generates a date string for a git commit using the same format as `git log`.', + docsUrl: 'https://fakerjs.dev/api/git', + example: 'Tue Apr 28 04:28:58 2026 -0600', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'git.commitEntry', + delegate: { + type: 'faker', + target: 'git.commitEntry', + }, + help: { + summary: 'Generates a random commit entry as printed by `git log`.', + docsUrl: 'https://fakerjs.dev/api/git', + example: 'commit 4f9a2d1c Author: Alex Example Date: Tue May 19 2026', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'git.commitMessage', + delegate: { + type: 'faker', + target: 'git.commitMessage', + }, + help: { + summary: 'Generates a random commit message.', + docsUrl: 'https://fakerjs.dev/api/git', + example: 'reboot cross-platform system', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'git.commitSha', + delegate: { + type: 'faker', + target: 'git.commitSha', + }, + help: { + summary: 'Generates a random commit sha.', + docsUrl: 'https://fakerjs.dev/api/git', + example: '3418f0e64e8eae52ebd67b11d98e571fd6a81017', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_GIT_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-hacker-keyword-definitions.js b/packages/core/js/domain/domain-faker-hacker-keyword-definitions.js new file mode 100644 index 00000000..ec24f204 --- /dev/null +++ b/packages/core/js/domain/domain-faker-hacker-keyword-definitions.js @@ -0,0 +1,88 @@ +const DOMAIN_FAKER_HACKER_KEYWORD_DEFINITIONS = [ + { + keyword: 'hacker.abbreviation', + delegate: { + type: 'faker', + target: 'hacker.abbreviation', + }, + help: { + summary: 'Returns a random hacker/IT abbreviation.', + docsUrl: 'https://fakerjs.dev/api/hacker', + example: 'GB', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'hacker.adjective', + delegate: { + type: 'faker', + target: 'hacker.adjective', + }, + help: { + summary: 'Returns a random hacker/IT adjective.', + docsUrl: 'https://fakerjs.dev/api/hacker', + example: 'bluetooth', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'hacker.ingverb', + delegate: { + type: 'faker', + target: 'hacker.ingverb', + }, + help: { + summary: 'Returns a random hacker/IT verb for continuous actions (en: ing suffix; e.g. hacking).', + docsUrl: 'https://fakerjs.dev/api/hacker', + example: 'synthesizing', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'hacker.noun', + delegate: { + type: 'faker', + target: 'hacker.noun', + }, + help: { + summary: 'Returns a random hacker/IT noun.', + docsUrl: 'https://fakerjs.dev/api/hacker', + example: 'program', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'hacker.phrase', + delegate: { + type: 'faker', + target: 'hacker.phrase', + }, + help: { + summary: 'Generates a random hacker/IT phrase.', + docsUrl: 'https://fakerjs.dev/api/hacker', + example: "compressing the application won't do anything, we need to reboot the neural JSON hard drive!", + returnType: 'string', + args: [], + }, + }, + { + keyword: 'hacker.verb', + delegate: { + type: 'faker', + target: 'hacker.verb', + }, + help: { + summary: 'Returns a random hacker/IT verb.', + docsUrl: 'https://fakerjs.dev/api/hacker', + example: 'program', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_HACKER_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-image-keyword-definitions.js b/packages/core/js/domain/domain-faker-image-keyword-definitions.js new file mode 100644 index 00000000..12db9a62 --- /dev/null +++ b/packages/core/js/domain/domain-faker-image-keyword-definitions.js @@ -0,0 +1,145 @@ +const DOMAIN_FAKER_IMAGE_KEYWORD_DEFINITIONS = [ + { + keyword: 'image.avatar', + delegate: { + type: 'faker', + target: 'image.avatar', + }, + help: { + summary: 'Generates a random avatar image url.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://avatars.githubusercontent.com/u/2389220', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'image.avatarGitHub', + delegate: { + type: 'faker', + target: 'image.avatarGitHub', + }, + help: { + summary: 'Generates a random avatar from GitHub.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://avatars.githubusercontent.com/u/22969292', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'image.avatarLegacy', + delegate: { + type: 'faker', + target: 'image.avatarLegacy', + }, + help: { + summary: + 'Generates a random avatar from `https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar`.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1198.jpg', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'image.dataUri', + delegate: { + type: 'faker', + target: 'image.dataUri', + }, + help: { + summary: 'Generates a random data uri containing an URL-encoded SVG image or a Base64-encoded SVG image.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4=', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'image.personPortrait', + delegate: { + type: 'faker', + target: 'image.personPortrait', + }, + help: { + summary: 'Generates a random square portrait (avatar) of a person.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/99.jpg', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'image.url', + delegate: { + type: 'faker', + target: 'image.url', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random image url.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://loremflickr.com/3255/509?lock=5223276893828872', + returnType: 'string', + args: [ + { + name: 'height', + type: 'number', + required: false, + description: 'The height of the image.', + }, + { + name: 'width', + type: 'number', + required: false, + description: 'The width of the image.', + }, + ], + }, + }, + { + keyword: 'image.urlLoremFlickr', + delegate: { + type: 'faker', + target: 'image.urlLoremFlickr', + }, + help: { + summary: 'Generates a random image url provided via https://loremflickr.com.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://loremflickr.com/3966/3602?lock=6417693540486546', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'image.urlPicsumPhotos', + delegate: { + type: 'faker', + target: 'image.urlPicsumPhotos', + }, + help: { + summary: 'Generates a random image url provided via https://picsum.photos.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://picsum.photos/seed/UBLQun43/2068/162?blur=8', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'image.urlPlaceholder', + delegate: { + type: 'faker', + target: 'image.urlPlaceholder', + }, + help: { + summary: 'Generates a random image url provided via https://via.placeholder.com/.', + docsUrl: 'https://fakerjs.dev/api/image', + example: 'https://via.placeholder.com/2302x1759/a80adf/2de69f.gif?text=utrimque%20summa%20dolores', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_IMAGE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-internet-keyword-definitions.js b/packages/core/js/domain/domain-faker-internet-keyword-definitions.js new file mode 100644 index 00000000..7019a7b6 --- /dev/null +++ b/packages/core/js/domain/domain-faker-internet-keyword-definitions.js @@ -0,0 +1,458 @@ +const DOMAIN_FAKER_INTERNET_KEYWORD_DEFINITIONS = [ + { + keyword: 'internet.color', + delegate: { + type: 'faker', + target: 'internet.color', + }, + help: { + summary: 'Generates a random css hex color code in aesthetically pleasing color palette.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: '#290551', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.displayName', + delegate: { + type: 'faker', + target: 'internet.displayName', + }, + help: { + summary: "Generates a display name using the given person's name as base.", + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'Cordell0', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.domainName', + delegate: { + type: 'faker', + target: 'internet.domainName', + }, + help: { + summary: 'Generates a random domain name.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'beloved-peony.org', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.domainSuffix', + delegate: { + type: 'faker', + target: 'internet.domainSuffix', + }, + help: { + summary: 'Returns a random domain suffix.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'com', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.domainWord', + delegate: { + type: 'faker', + target: 'internet.domainWord', + }, + help: { + summary: 'Generates a random domain word.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'inexperienced-ravioli', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.email', + delegate: { + type: 'faker', + target: 'internet.email', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates data using faker internet email.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'Jana91@hotmail.com', + returnType: 'string', + args: [ + { + name: 'allowSpecialCharacters', + type: 'boolean', + required: false, + description: + "Whether special characters such as .!#$%&'*+-/=?^_`{|}~ should be included in the email address.", + }, + { + name: 'firstName', + type: 'string', + required: false, + description: 'The optional first name to use.', + }, + { + name: 'lastName', + type: 'string', + required: false, + description: 'The optional last name to use.', + }, + { + name: 'provider', + type: 'string', + required: false, + description: 'The mail provider domain to use. If not specified, a random free mail provider will be chosen.', + }, + ], + }, + }, + { + keyword: 'internet.emoji', + delegate: { + type: 'faker', + target: 'internet.emoji', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random emoji.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: '🤨', + returnType: 'string', + args: [ + { + name: 'types', + type: 'array', + required: false, + description: 'A list of the emoji types that should be used.', + }, + ], + }, + }, + { + keyword: 'internet.exampleEmail', + delegate: { + type: 'faker', + target: 'internet.exampleEmail', + }, + help: { + summary: 'Generates data using faker internet example email.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'Jeremie37@example.net', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.httpMethod', + delegate: { + type: 'faker', + target: 'internet.httpMethod', + }, + help: { + summary: 'Returns a random http method.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'PATCH', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.httpStatusCode', + delegate: { + type: 'faker', + target: 'internet.httpStatusCode', + }, + help: { + summary: 'Generates a random HTTP status code.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: '303', + returnType: 'number', + args: [], + }, + }, + { + keyword: 'internet.ip', + delegate: { + type: 'faker', + target: 'internet.ip', + }, + help: { + summary: 'Generates a random IPv4 or IPv6 address.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: '56.23.30.52', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.ipv4', + delegate: { + type: 'faker', + target: 'internet.ipv4', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random IPv4 address.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: '192.168.0.42', + returnType: 'string', + args: [ + { + name: 'cidrBlock', + type: 'string', + required: false, + description: 'The optional CIDR block to use. Must be in the format x.x.x.x/y.', + }, + { + name: 'network', + type: 'string', + required: false, + description: 'The optional network to use. This is intended as an alias for well-known cidrBlocks.', + }, + ], + }, + }, + { + keyword: 'internet.ipv6', + delegate: { + type: 'faker', + target: 'internet.ipv6', + }, + help: { + summary: 'Generates a random IPv6 address.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: '2001:0db8:85a3:0000:0000:8a2e:0370:7334', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.jwt', + delegate: { + type: 'faker', + target: 'internet.jwt', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random JWT (JSON Web Token).', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBY21lIn0.c2lnbmF0dXJl', + returnType: 'string', + args: [ + { + name: 'header', + type: 'object', + required: false, + description: 'The header to use for the token. If present, it will replace any default values.', + }, + { + name: 'payload', + type: 'object', + required: false, + description: 'The payload to use for the token. If present, it will replace any default values.', + }, + { + name: 'refDate', + type: 'number', + required: false, + description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', + }, + ], + }, + }, + { + keyword: 'internet.jwtAlgorithm', + delegate: { + type: 'faker', + target: 'internet.jwtAlgorithm', + }, + help: { + summary: 'Generates a random JWT (JSON Web Token) Algorithm.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'PS384', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.mac', + delegate: { + type: 'faker', + target: 'internet.mac', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random mac address.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'ae:a9:d7:ba:d2:bd', + returnType: 'string', + args: [ + { + name: 'separator', + type: 'string', + required: false, + description: "The optional separator to use. Can be either ':', '-' or ''.", + }, + ], + }, + }, + { + keyword: 'internet.password', + delegate: { + type: 'faker', + target: 'internet.password', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: + 'Generates a random password-like string. Do not use this method for generating actual passwords for users.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'og1ejoksrfwVbIF', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'The length of the password to generate.', + }, + { + name: 'memorable', + type: 'boolean', + required: false, + description: 'Whether the generated password should be memorable.', + }, + { + name: 'pattern', + type: 'string', + required: false, + description: 'The pattern that all chars should match. This option will be ignored, if memorable is true.', + }, + { + name: 'prefix', + type: 'string', + required: false, + description: 'The prefix to use.', + }, + ], + }, + }, + { + keyword: 'internet.port', + delegate: { + type: 'faker', + target: 'internet.port', + }, + help: { + summary: 'Generates a random port number.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: '24545', + returnType: 'number', + args: [], + }, + }, + { + keyword: 'internet.protocol', + delegate: { + type: 'faker', + target: 'internet.protocol', + }, + help: { + summary: 'Returns a random web protocol. Either `http` or `https`.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'http', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.url', + delegate: { + type: 'faker', + target: 'internet.url', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random http(s) url.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'https://brave-interior.biz/', + returnType: 'string', + args: [ + { + name: 'appendSlash', + type: 'boolean', + required: false, + description: 'Whether to append a slash to the end of the url (path).', + }, + { + name: 'protocol', + type: 'string', + required: false, + description: 'The protocol to use.', + }, + ], + }, + }, + { + keyword: 'internet.userAgent', + delegate: { + type: 'faker', + target: 'internet.userAgent', + }, + help: { + summary: 'Generates a random user agent string.', + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'internet.username', + delegate: { + type: 'faker', + target: 'internet.username', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: "Generates a username using the given person's name as base.", + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'Deanna51', + returnType: 'string', + args: [ + { + name: 'firstName', + type: 'string', + required: false, + description: 'The optional first name to use.', + }, + { + name: 'lastName', + type: 'string', + required: false, + description: 'The optional last name to use.', + }, + ], + }, + }, + { + keyword: 'internet.userName', + delegate: { + type: 'faker', + target: 'internet.userName', + }, + help: { + summary: "Generates a username using the given person's name as base.", + docsUrl: 'https://fakerjs.dev/api/internet', + example: 'Ana_Keebler', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_INTERNET_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-location-keyword-definitions.js b/packages/core/js/domain/domain-faker-location-keyword-definitions.js new file mode 100644 index 00000000..9f02b5b2 --- /dev/null +++ b/packages/core/js/domain/domain-faker-location-keyword-definitions.js @@ -0,0 +1,338 @@ +const DOMAIN_FAKER_LOCATION_KEYWORD_DEFINITIONS = [ + { + keyword: 'location.buildingNumber', + delegate: { + type: 'faker', + target: 'location.buildingNumber', + }, + help: { + summary: 'Generates a random building number.', + docsUrl: 'https://fakerjs.dev/api/location', + example: '5075', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.cardinalDirection', + delegate: { + type: 'faker', + target: 'location.cardinalDirection', + }, + help: { + summary: 'Returns a random cardinal direction (north, east, south, west).', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'East', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.city', + delegate: { + type: 'faker', + target: 'location.city', + }, + help: { + summary: 'Generates a random localized city name.', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Stellachester', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.continent', + delegate: { + type: 'faker', + target: 'location.continent', + }, + help: { + summary: 'Returns a random continent name.', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Asia', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.country', + delegate: { + type: 'faker', + target: 'location.country', + }, + help: { + summary: 'Returns a random country name.', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Svalbard & Jan Mayen Islands', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.countryCode', + delegate: { + type: 'faker', + target: 'location.countryCode', + }, + help: { + summary: 'Returns a random ISO_3166-1 country code.', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'MG', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.county', + delegate: { + type: 'faker', + target: 'location.county', + }, + help: { + summary: + "Returns a random localized county, or other equivalent second-level administrative entity for the locale's country such as a district or department.", + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Northamptonshire', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.direction', + delegate: { + type: 'faker', + target: 'location.direction', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random direction (cardinal and ordinal; northwest, east, etc).', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'North', + returnType: 'string', + args: [ + { + name: 'abbreviated', + type: 'boolean', + required: false, + description: + 'If true this will return abbreviated directions (NW, E, etc). Otherwise this will return the long name.', + }, + ], + }, + }, + { + keyword: 'location.language', + delegate: { + type: 'faker', + target: 'location.language', + }, + help: { + summary: 'Returns a random spoken language.', + docsUrl: 'https://fakerjs.dev/api/location', + example: '{"name":"Icelandic","alpha2":"is","alpha3":"isl"}', + returnType: 'object', + args: [], + }, + }, + { + keyword: 'location.latitude', + delegate: { + type: 'faker', + target: 'location.latitude', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random latitude.', + docsUrl: 'https://fakerjs.dev/api/location', + example: '51.5448', + returnType: 'number', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'The lower bound for the latitude to generate.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'The upper bound for the latitude to generate.', + }, + { + name: 'precision', + type: 'number', + required: false, + description: 'The number of decimal points of precision for the latitude.', + }, + ], + }, + }, + { + keyword: 'location.longitude', + delegate: { + type: 'faker', + target: 'location.longitude', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random longitude.', + docsUrl: 'https://fakerjs.dev/api/location', + example: '92.3892', + returnType: 'number', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'The lower bound for the longitude to generate.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'The upper bound for the longitude to generate.', + }, + { + name: 'precision', + type: 'number', + required: false, + description: 'The number of decimal points of precision for the longitude.', + }, + ], + }, + }, + { + keyword: 'location.nearbyGPSCoordinate', + delegate: { + type: 'faker', + target: 'location.nearbyGPSCoordinate', + }, + help: { + summary: 'Generates a random GPS coordinate within the specified radius from the given coordinate.', + docsUrl: 'https://fakerjs.dev/api/location', + example: '[58.313,9.9746]', + returnType: 'array', + args: [], + }, + }, + { + keyword: 'location.ordinalDirection', + delegate: { + type: 'faker', + target: 'location.ordinalDirection', + }, + help: { + summary: 'Returns a random ordinal direction (northwest, southeast, etc).', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Northeast', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.secondaryAddress', + delegate: { + type: 'faker', + target: 'location.secondaryAddress', + }, + help: { + summary: 'Generates a random localized secondary address. This refers to a specific location at a given address', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Suite 634', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.state', + delegate: { + type: 'faker', + target: 'location.state', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: + "Returns a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region.", + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Hawaii', + returnType: 'string', + args: [ + { + name: 'abbreviated', + type: 'boolean', + required: false, + description: + 'If true this will return abbreviated first-level administrative entity names. Otherwise this will return the long name.', + }, + ], + }, + }, + { + keyword: 'location.street', + delegate: { + type: 'faker', + target: 'location.street', + }, + help: { + summary: 'Generates a random localized street name.', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Viva Harbor', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.streetAddress', + delegate: { + type: 'faker', + target: 'location.streetAddress', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random localized street address.', + docsUrl: 'https://fakerjs.dev/api/location', + example: '12056 Vandervort Common', + returnType: 'string', + args: [ + { + name: 'useFullAddress', + type: 'boolean', + required: false, + description: 'Whether to expand to a full address including secondary address information.', + }, + ], + }, + }, + { + keyword: 'location.timeZone', + delegate: { + type: 'faker', + target: 'location.timeZone', + }, + help: { + summary: 'Returns a random IANA time zone name.', + docsUrl: 'https://fakerjs.dev/api/location', + example: 'Australia/Perth', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'location.zipCode', + delegate: { + type: 'faker', + target: 'location.zipCode', + }, + help: { + summary: 'Generates data using faker location zip code.', + docsUrl: 'https://fakerjs.dev/api/location', + example: '36791', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_LOCATION_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-lorem-keyword-definitions.js b/packages/core/js/domain/domain-faker-lorem-keyword-definitions.js new file mode 100644 index 00000000..d6e94fde --- /dev/null +++ b/packages/core/js/domain/domain-faker-lorem-keyword-definitions.js @@ -0,0 +1,386 @@ +const DOMAIN_FAKER_LOREM_KEYWORD_DEFINITIONS = [ + { + keyword: 'lorem.lines', + delegate: { + type: 'faker', + target: 'lorem.lines', + }, + help: { + summary: "Generates the given number lines of lorem separated by `'\\n'`.", + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'Illum qui ocer creptio. Antepono aro vergo voluptatem acervus compono apud.', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'lineCount', + type: 'number', + required: false, + description: 'Exact number of lines to generate.', + }, + { + name: 'lineCountMax', + type: 'number', + required: false, + description: 'The maximum number of lines to generate.', + }, + { + name: 'lineCountMin', + type: 'number', + required: false, + description: 'The minimum number of lines to generate.', + }, + ], + }, + }, + { + keyword: 'lorem.paragraph', + delegate: { + type: 'faker', + target: 'lorem.paragraph', + }, + help: { + summary: 'Generates a paragraph with the given number of sentences.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'Quisquam dolorum modi quae atque.', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'sentenceCount', + type: 'number', + required: false, + description: 'Number of sentences to generate.', + }, + { + name: 'sentenceCountMax', + type: 'number', + required: false, + description: 'The maximum number of sentences to generate.', + }, + { + name: 'sentenceCountMin', + type: 'number', + required: false, + description: 'The minimum number of sentences to generate.', + }, + ], + }, + }, + { + keyword: 'lorem.paragraphs', + delegate: { + type: 'faker', + target: 'lorem.paragraphs', + }, + help: { + summary: 'Generates the given number of paragraphs.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'Primus paragraphus.\n\nSecundus paragraphus.', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'paragraphCount', + type: 'number', + required: false, + description: 'Number of paragraphs to generate.', + }, + { + name: 'separator', + type: 'string', + required: false, + description: 'Separator inserted between generated items.', + }, + { + name: 'paragraphCountMax', + type: 'number', + required: false, + description: 'The maximum number of paragraphs to generate.', + }, + { + name: 'paragraphCountMin', + type: 'number', + required: false, + description: 'The minimum number of paragraphs to generate.', + }, + ], + }, + }, + { + keyword: 'lorem.sentence', + delegate: { + type: 'faker', + target: 'lorem.sentence', + }, + help: { + summary: 'Generates a space separated list of words beginning with a capital letter and ending with a period.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'Auctor cum deorsum attero cum tergo aut.', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'wordCount', + type: 'number', + required: false, + description: 'Number of words to generate.', + }, + { + name: 'wordCountMax', + type: 'number', + required: false, + description: 'The maximum number of words to generate.', + }, + { + name: 'wordCountMin', + type: 'number', + required: false, + description: 'The minimum number of words to generate.', + }, + ], + }, + }, + { + keyword: 'lorem.sentences', + delegate: { + type: 'faker', + target: 'lorem.sentences', + }, + help: { + summary: 'Generates the given number of sentences.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'Vicissitudo amet candidus. Urbanus magni carbo artificiose tenus at ambulo.', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'sentenceCount', + type: 'number', + required: false, + description: 'Number of sentences to generate.', + }, + { + name: 'separator', + type: 'string', + required: false, + description: 'Separator inserted between generated items.', + }, + { + name: 'sentenceCountMax', + type: 'number', + required: false, + description: 'The maximum number of sentences to generate.', + }, + { + name: 'sentenceCountMin', + type: 'number', + required: false, + description: 'The minimum number of sentences to generate.', + }, + ], + }, + }, + { + keyword: 'lorem.slug', + delegate: { + type: 'faker', + target: 'lorem.slug', + }, + help: { + summary: 'Generates a slugified text consisting of the given number of hyphen separated words.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'dolore-accusator-atqui', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'wordCount', + type: 'number', + required: false, + description: 'Number of words to generate.', + }, + { + name: 'wordCountMax', + type: 'number', + required: false, + description: 'The maximum number of words to generate.', + }, + { + name: 'wordCountMin', + type: 'number', + required: false, + description: 'The minimum number of words to generate.', + }, + ], + }, + }, + { + keyword: 'lorem.text', + delegate: { + type: 'faker', + target: 'lorem.text', + }, + help: { + summary: 'Generates a random text based on a random lorem method.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'A short sample text generated from lorem.', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'lorem.word', + delegate: { + type: 'faker', + target: 'lorem.word', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a word of a specified length.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'cumque', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum word length when generating a ranged length.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum word length when generating a ranged length.', + }, + { + name: 'length', + type: 'number', + required: false, + description: 'Exact word length to generate.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'lorem.words', + delegate: { + type: 'faker', + target: 'lorem.words', + }, + help: { + summary: 'Generates a space separated list of words.', + docsUrl: 'https://fakerjs.dev/api/lorem', + example: 'desidero conforto decimus', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'wordCount', + type: 'number', + required: false, + description: 'Number of words to generate.', + }, + { + name: 'wordCountMax', + type: 'number', + required: false, + description: 'The maximum number of words to generate.', + }, + { + name: 'wordCountMin', + type: 'number', + required: false, + description: 'The minimum number of words to generate.', + }, + ], + }, + }, +]; + +export { DOMAIN_FAKER_LOREM_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-music-keyword-definitions.js b/packages/core/js/domain/domain-faker-music-keyword-definitions.js new file mode 100644 index 00000000..1a1220f7 --- /dev/null +++ b/packages/core/js/domain/domain-faker-music-keyword-definitions.js @@ -0,0 +1,60 @@ +const DOMAIN_FAKER_MUSIC_KEYWORD_DEFINITIONS = [ + { + keyword: 'music.album', + delegate: { + type: 'faker', + target: 'music.album', + }, + help: { + summary: 'Returns a random album name.', + docsUrl: 'https://fakerjs.dev/api/music', + example: 'R&G (Rhythm & Gangsta): The Masterpiece', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'music.artist', + delegate: { + type: 'faker', + target: 'music.artist', + }, + help: { + summary: 'Returns a random artist name.', + docsUrl: 'https://fakerjs.dev/api/music', + example: 'Chuck Berry', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'music.genre', + delegate: { + type: 'faker', + target: 'music.genre', + }, + help: { + summary: 'Returns a random music genre.', + docsUrl: 'https://fakerjs.dev/api/music', + example: 'Mainstream Jazz', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'music.songName', + delegate: { + type: 'faker', + target: 'music.songName', + }, + help: { + summary: 'Returns a random song name.', + docsUrl: 'https://fakerjs.dev/api/music', + example: "I'm Sorry", + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_MUSIC_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-number-keyword-definitions.js b/packages/core/js/domain/domain-faker-number-keyword-definitions.js new file mode 100644 index 00000000..83b02acd --- /dev/null +++ b/packages/core/js/domain/domain-faker-number-keyword-definitions.js @@ -0,0 +1,216 @@ +const DOMAIN_FAKER_NUMBER_KEYWORD_DEFINITIONS = [ + { + keyword: 'number.bigInt', + delegate: { + type: 'faker', + target: 'number.bigInt', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a BigInt number.', + docsUrl: 'https://fakerjs.dev/api/number', + example: '347465151663036', + returnType: 'integer', + args: [ + { + name: 'value', + type: 'bigint|number|string|boolean', + required: false, + description: + 'Base value used for generation. Supports bigint, number, string, or boolean inputs. For range constraints use min, max, and multipleOf.', + }, + ], + }, + }, + { + keyword: 'number.binary', + delegate: { + type: 'faker', + target: 'number.binary', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a binary string.', + docsUrl: 'https://fakerjs.dev/api/number', + example: '0', + returnType: 'string', + args: [ + { + name: 'max', + type: 'number', + required: false, + description: 'Upper bound for generated number.', + }, + { + name: 'min', + type: 'number', + required: false, + description: 'Lower bound for generated number.', + }, + ], + }, + }, + { + keyword: 'number.float', + delegate: { + type: 'faker', + target: 'number.float', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: + 'Returns a single random floating-point number, by default between `0.0` and `1.0`. To change the range, pass a `min` and `max` value. To limit the number of decimal places, pass a `multipleOf` or `fractionDigits` parameter.', + docsUrl: 'https://fakerjs.dev/api/number', + example: '0.5433707701438405', + returnType: 'number', + args: [ + { + name: 'fractionDigits', + type: 'number', + required: false, + description: + 'The maximum number of digits to appear after the decimal point, for example 2 will round to 2 decimal points. Only one of multipleOf or fractionDigits should be passed.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Upper bound for generated number, exclusive, unless multipleOf or fractionDigits are passed.', + }, + { + name: 'min', + type: 'number', + required: false, + description: 'Lower bound for generated number, inclusive.', + }, + { + name: 'multipleOf', + type: 'number', + required: false, + description: + 'The generated number will be a multiple of this parameter. Only one of multipleOf or fractionDigits should be passed.', + }, + ], + }, + }, + { + keyword: 'number.hex', + delegate: { + type: 'faker', + target: 'number.hex', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a lowercase hexadecimal number.', + docsUrl: 'https://fakerjs.dev/api/number', + example: 'd', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + ], + }, + }, + { + keyword: 'number.int', + delegate: { + type: 'faker', + target: 'number.int', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a single random integer between zero and the given max value or the given range.', + docsUrl: 'https://fakerjs.dev/api/number', + example: '5190574431878510', + returnType: 'integer', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Optional minimum integer.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Optional maximum integer.', + }, + { + name: 'multipleOf', + type: 'number', + required: false, + description: 'Generated number will be a multiple of the given integer.', + }, + ], + }, + }, + { + keyword: 'number.octal', + delegate: { + type: 'faker', + target: 'number.octal', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns an octal string.', + docsUrl: 'https://fakerjs.dev/api/number', + example: '6', + returnType: 'string', + args: [ + { + name: 'max', + type: 'number', + required: false, + description: 'Upper bound for generated number.', + }, + { + name: 'min', + type: 'number', + required: false, + description: 'Lower bound for generated number.', + }, + ], + }, + }, + { + keyword: 'number.romanNumeral', + delegate: { + type: 'faker', + target: 'number.romanNumeral', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a roman numeral in String format.', + docsUrl: 'https://fakerjs.dev/api/number', + example: 'XXXV', + returnType: 'string', + args: [ + { + name: 'min', + type: 'number', + required: false, + description: 'Minimum bound used when generating a value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + ], + }, + }, +]; + +export { DOMAIN_FAKER_NUMBER_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-person-keyword-definitions.js b/packages/core/js/domain/domain-faker-person-keyword-definitions.js new file mode 100644 index 00000000..262ac555 --- /dev/null +++ b/packages/core/js/domain/domain-faker-person-keyword-definitions.js @@ -0,0 +1,242 @@ +const DOMAIN_FAKER_PERSON_KEYWORD_DEFINITIONS = [ + { + keyword: 'person.bio', + delegate: { + type: 'faker', + target: 'person.bio', + }, + help: { + summary: 'Returns a random short biography', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'musician', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.firstName', + delegate: { + type: 'faker', + target: 'person.firstName', + }, + help: { + summary: 'Returns a random first name.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'David', + returnType: 'string', + args: [ + { + name: 'sex', + type: 'string', + required: false, + description: 'Optional sex for first-name selection. Valid values: female or male.', + }, + ], + }, + }, + { + keyword: 'person.fullName', + delegate: { + type: 'faker', + target: 'person.fullName', + }, + help: { + summary: 'Generates a random full name.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Mrs. Sheryl Zemlak DVM', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.gender', + delegate: { + type: 'faker', + target: 'person.gender', + }, + help: { + summary: 'Returns a random gender.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Female to male', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.jobArea', + delegate: { + type: 'faker', + target: 'person.jobArea', + }, + help: { + summary: 'Generates a random job area.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Branding', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.jobDescriptor', + delegate: { + type: 'faker', + target: 'person.jobDescriptor', + }, + help: { + summary: 'Generates a random job descriptor.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Direct', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.jobTitle', + delegate: { + type: 'faker', + target: 'person.jobTitle', + }, + help: { + summary: 'Generates a random job title.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Senior Identity Technician', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.jobType', + delegate: { + type: 'faker', + target: 'person.jobType', + }, + help: { + summary: 'Generates a random job type.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Engineer', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.lastName', + delegate: { + type: 'faker', + target: 'person.lastName', + }, + help: { + summary: 'Returns a random last name.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Bernhard', + returnType: 'string', + args: [ + { + name: 'sex', + type: 'string', + required: false, + description: 'Optional sex for last-name selection. Valid values: female or male.', + }, + ], + }, + }, + { + keyword: 'person.middleName', + delegate: { + type: 'faker', + target: 'person.middleName', + }, + help: { + summary: 'Returns a random middle name.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Ryan', + returnType: 'string', + args: [ + { + name: 'sex', + type: 'string', + required: false, + description: 'Optional sex for middle-name selection. Valid values: female or male.', + }, + ], + }, + }, + { + keyword: 'person.prefix', + delegate: { + type: 'faker', + target: 'person.prefix', + }, + help: { + summary: 'Returns a random person prefix.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Mr.', + returnType: 'string', + args: [ + { + name: 'sex', + type: 'string', + required: false, + description: "The optional sex to use. Can be either 'female' or 'male'.", + }, + ], + }, + }, + { + keyword: 'person.sex', + delegate: { + type: 'faker', + target: 'person.sex', + }, + help: { + summary: 'Returns a random sex.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'male', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.sexType', + delegate: { + type: 'faker', + target: 'person.sexType', + }, + help: { + summary: 'Returns a random sex type. The `SexType` is intended to be used in parameters and conditions.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'male', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.suffix', + delegate: { + type: 'faker', + target: 'person.suffix', + }, + help: { + summary: 'Returns a random person suffix.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'IV', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'person.zodiacSign', + delegate: { + type: 'faker', + target: 'person.zodiacSign', + }, + help: { + summary: 'Returns a random zodiac sign.', + docsUrl: 'https://fakerjs.dev/api/person', + example: 'Cancer', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_PERSON_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-phone-keyword-definitions.js b/packages/core/js/domain/domain-faker-phone-keyword-definitions.js new file mode 100644 index 00000000..46c96cef --- /dev/null +++ b/packages/core/js/domain/domain-faker-phone-keyword-definitions.js @@ -0,0 +1,41 @@ +const DOMAIN_FAKER_PHONE_KEYWORD_DEFINITIONS = [ + { + keyword: 'phone.imei', + delegate: { + type: 'faker', + target: 'phone.imei', + }, + help: { + summary: 'Generates IMEI number.', + docsUrl: 'https://fakerjs.dev/api/phone', + example: '44-358223-971834-1', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'phone.number', + delegate: { + type: 'faker', + target: 'phone.number', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a random phone number.', + docsUrl: 'https://fakerjs.dev/api/phone', + example: '298.756.9044', + returnType: 'string', + args: [ + { + name: 'style', + type: 'string', + required: false, + description: + "Style of the generated phone number: 'human': (default) A human-input phone number, e.g. 555-770-7727 or 555.770.7727 x1234 'national': A phone number in a standardized national format, e.g. (555) 123-4567. 'international': A phone number in the E.123 international format, e.g. +15551234567", + }, + ], + }, + }, +]; + +export { DOMAIN_FAKER_PHONE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-science-keyword-definitions.js b/packages/core/js/domain/domain-faker-science-keyword-definitions.js new file mode 100644 index 00000000..38628c08 --- /dev/null +++ b/packages/core/js/domain/domain-faker-science-keyword-definitions.js @@ -0,0 +1,77 @@ +const DOMAIN_FAKER_SCIENCE_KEYWORD_DEFINITIONS = [ + { + keyword: 'science.chemicalElement', + delegate: { + type: 'faker', + target: 'science.chemicalElement', + }, + help: { + summary: 'Generate a value using faker science.chemicalElement.', + docsUrl: 'https://fakerjs.dev/api/science', + example: '{"name":"Oxygen","symbol":"O","atomicNumber":8}', + returnType: 'object', + args: [], + }, + }, + { + keyword: 'science.chemicalElement.atomicNumber', + delegate: { + type: 'faker', + target: 'science.chemicalElement', + resultPath: 'atomicNumber', + }, + help: { + summary: 'Generate a chemical element atomic number.', + docsUrl: 'https://fakerjs.dev/api/science', + example: '8', + returnType: 'integer', + args: [], + }, + }, + { + keyword: 'science.chemicalElement.name', + delegate: { + type: 'faker', + target: 'science.chemicalElement', + resultPath: 'name', + }, + help: { + summary: 'Generate a chemical element name.', + docsUrl: 'https://fakerjs.dev/api/science', + example: 'Oxygen', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'science.chemicalElement.symbol', + delegate: { + type: 'faker', + target: 'science.chemicalElement', + resultPath: 'symbol', + }, + help: { + summary: 'Generate a chemical element symbol.', + docsUrl: 'https://fakerjs.dev/api/science', + example: 'O', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'science.unit', + delegate: { + type: 'faker', + target: 'science.unit', + }, + help: { + summary: 'Returns a random scientific unit.', + docsUrl: 'https://fakerjs.dev/api/science', + example: '{"name":"farad","symbol":"F"}', + returnType: 'object', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_SCIENCE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-string-keyword-definitions.js b/packages/core/js/domain/domain-faker-string-keyword-definitions.js new file mode 100644 index 00000000..812f7623 --- /dev/null +++ b/packages/core/js/domain/domain-faker-string-keyword-definitions.js @@ -0,0 +1,328 @@ +const DOMAIN_FAKER_STRING_KEYWORD_DEFINITIONS = [ + { + keyword: 'string.alpha', + delegate: { + type: 'faker', + target: 'string.alpha', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generating a string consisting of letters in the English alphabet.', + docsUrl: 'https://fakerjs.dev/api/string', + example: 'R', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'casing', + type: 'string', + required: false, + description: 'The casing of the characters.', + }, + { + name: 'exclude', + type: 'array', + required: false, + description: 'An array with characters which should be excluded in the generated string.', + }, + ], + }, + }, + { + keyword: 'string.alphanumeric', + delegate: { + type: 'faker', + target: 'string.alphanumeric', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generating a string consisting of alpha characters and digits.', + docsUrl: 'https://fakerjs.dev/api/string', + example: 's', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'casing', + type: 'string', + required: false, + description: 'The casing of the characters.', + }, + { + name: 'exclude', + type: 'array', + required: false, + description: 'An array of characters and digits which should be excluded in the generated string.', + }, + ], + }, + }, + { + keyword: 'string.binary', + delegate: { + type: 'faker', + target: 'string.binary', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a binary string.', + docsUrl: 'https://fakerjs.dev/api/string', + example: '0b0', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: + 'The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.', + }, + { + name: 'prefix', + type: 'string', + required: false, + description: 'Prefix for the generated number.', + }, + ], + }, + }, + { + keyword: 'string.fromCharacters', + delegate: { + type: 'faker', + target: 'string.fromCharacters', + }, + help: { + summary: 'Generates a string from the given characters.', + docsUrl: 'https://fakerjs.dev/api/string', + example: 'A1B2', + examples: ['string.fromCharacters("ABC123", 6)', 'string.fromCharacters(characters=["A", "B", "C"], length=4)'], + exampleReturnValues: ['A1B2', 'CB2A'], + returnType: 'string', + args: [ + { + name: 'characters', + type: 'string|array', + required: true, + description: 'Character set (string or array) used when generating output.', + }, + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + ], + }, + }, + { + keyword: 'string.hexadecimal', + delegate: { + type: 'faker', + target: 'string.hexadecimal', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a hexadecimal string.', + docsUrl: 'https://fakerjs.dev/api/string', + example: '0x1', + returnType: 'string', + args: [ + { + name: 'casing', + type: 'string', + required: false, + description: 'Casing of the generated number.', + }, + { + name: 'length', + type: 'number', + required: false, + description: + 'The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.', + }, + { + name: 'prefix', + type: 'string', + required: false, + description: 'Prefix for the generated number.', + }, + ], + }, + }, + { + keyword: 'string.nanoid', + delegate: { + type: 'faker', + target: 'string.nanoid', + }, + help: { + summary: 'Generates a Nano ID.', + docsUrl: 'https://fakerjs.dev/api/string', + example: 'KLm49ferlh-eUmJpZdSIO', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Exact number of characters to generate.', + }, + ], + }, + }, + { + keyword: 'string.numeric', + delegate: { + type: 'faker', + target: 'string.numeric', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Generates a given length string of digits.', + docsUrl: 'https://fakerjs.dev/api/string', + example: '7', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'allowLeadingZeros', + type: 'boolean', + required: false, + description: 'Whether leading zeros are allowed or not.', + }, + { + name: 'exclude', + type: 'array', + required: false, + description: 'An array of digits which should be excluded in the generated string.', + }, + ], + }, + }, + { + keyword: 'string.octal', + delegate: { + type: 'faker', + target: 'string.octal', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns an octal string.', + docsUrl: 'https://fakerjs.dev/api/string', + example: '0o6', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: + 'The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.', + }, + { + name: 'prefix', + type: 'string', + required: false, + description: 'Prefix for the generated number.', + }, + ], + }, + }, + { + keyword: 'string.sample', + delegate: { + type: 'faker', + target: 'string.sample', + }, + help: { + summary: 'Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).', + docsUrl: 'https://fakerjs.dev/api/string', + example: '\\Fw;0e:G.H', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Exact number of characters to generate.', + }, + ], + }, + }, + { + keyword: 'string.symbol', + delegate: { + type: 'faker', + target: 'string.symbol', + }, + help: { + summary: 'Returns a string containing only special characters from the following list:', + docsUrl: 'https://fakerjs.dev/api/string', + example: '.', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Exact number of characters to generate.', + }, + ], + }, + }, + { + keyword: 'string.ulid', + delegate: { + type: 'faker', + target: 'string.ulid', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a ULID (Universally Unique Lexicographically Sortable Identifier).', + docsUrl: 'https://fakerjs.dev/api/string', + example: '01KQADM2A0728G4D2HKCPWKS6N', + returnType: 'string', + args: [ + { + name: 'refDate', + type: 'number', + required: false, + description: + 'The date to use as reference point for the newly generated ULID encoded timestamp. The encoded timestamp is represented by the first 10 characters of the result.', + }, + ], + }, + }, + { + keyword: 'string.uuid', + delegate: { + type: 'faker', + target: 'string.uuid', + }, + help: { + summary: 'Returns a UUID v4 (Universally Unique Identifier).', + docsUrl: 'https://fakerjs.dev/api/string', + example: '0628ae51-7b6c-4d33-9f24-dae19fb245df', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_STRING_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-system-keyword-definitions.js b/packages/core/js/domain/domain-faker-system-keyword-definitions.js new file mode 100644 index 00000000..6782abdb --- /dev/null +++ b/packages/core/js/domain/domain-faker-system-keyword-definitions.js @@ -0,0 +1,201 @@ +const DOMAIN_FAKER_SYSTEM_KEYWORD_DEFINITIONS = [ + { + keyword: 'system.commonFileExt', + delegate: { + type: 'faker', + target: 'system.commonFileExt', + }, + help: { + summary: 'Returns a commonly used file extension.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'pdf', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.commonFileName', + delegate: { + type: 'faker', + target: 'system.commonFileName', + }, + help: { + summary: 'Returns a random file name with a given extension or a commonly used extension.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'bleak.pdf', + returnType: 'string', + args: [ + { + name: 'extension', + type: 'string', + required: false, + description: 'File extension to include in the generated filename.', + }, + ], + }, + }, + { + keyword: 'system.commonFileType', + delegate: { + type: 'faker', + target: 'system.commonFileType', + }, + help: { + summary: 'Returns a commonly used file type.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'video', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.cron', + delegate: { + type: 'faker', + target: 'system.cron', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random cron expression.', + docsUrl: 'https://fakerjs.dev/api/system', + example: '* 15 * * SAT', + returnType: 'string', + args: [ + { + name: 'includeNonStandard', + type: 'boolean', + required: false, + description: 'Whether to include a @yearly, @monthly, @daily, etc text labels in the generated expression.', + }, + { + name: 'includeYear', + type: 'boolean', + required: false, + description: 'Whether to include a year in the generated expression.', + }, + ], + }, + }, + { + keyword: 'system.directoryPath', + delegate: { + type: 'faker', + target: 'system.directoryPath', + }, + help: { + summary: 'Returns a directory path.', + docsUrl: 'https://fakerjs.dev/api/system', + example: '/bin', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.fileExt', + delegate: { + type: 'faker', + target: 'system.fileExt', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a file extension.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'xsl', + returnType: 'string', + args: [ + { + name: 'mimeType', + type: 'string', + required: false, + description: 'MIME type used to constrain generated values.', + }, + ], + }, + }, + { + keyword: 'system.fileName', + delegate: { + type: 'faker', + target: 'system.fileName', + }, + help: { + summary: 'Returns a random file name with extension.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'unsightly.woff', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.filePath', + delegate: { + type: 'faker', + target: 'system.filePath', + }, + help: { + summary: 'Returns a file path.', + docsUrl: 'https://fakerjs.dev/api/system', + example: '/tmp/ouch.xlt', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.fileType', + delegate: { + type: 'faker', + target: 'system.fileType', + }, + help: { + summary: 'Returns a file type.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'font', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.mimeType', + delegate: { + type: 'faker', + target: 'system.mimeType', + }, + help: { + summary: 'Returns a mime-type.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'application/gzip', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.networkInterface', + delegate: { + type: 'faker', + target: 'system.networkInterface', + }, + help: { + summary: 'Returns a random network interface.', + docsUrl: 'https://fakerjs.dev/api/system', + example: 'wlx3fba717f9f9c', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'system.semver', + delegate: { + type: 'faker', + target: 'system.semver', + }, + help: { + summary: 'Returns a semantic version.', + docsUrl: 'https://fakerjs.dev/api/system', + example: '4.3.6', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_SYSTEM_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-vehicle-keyword-definitions.js b/packages/core/js/domain/domain-faker-vehicle-keyword-definitions.js new file mode 100644 index 00000000..8d451caf --- /dev/null +++ b/packages/core/js/domain/domain-faker-vehicle-keyword-definitions.js @@ -0,0 +1,130 @@ +const DOMAIN_FAKER_VEHICLE_KEYWORD_DEFINITIONS = [ + { + keyword: 'vehicle.bicycle', + delegate: { + type: 'faker', + target: 'vehicle.bicycle', + }, + help: { + summary: 'Returns a type of bicycle.', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'Touring Bicycle', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.color', + delegate: { + type: 'faker', + target: 'vehicle.color', + }, + help: { + summary: 'Returns a vehicle color.', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'sky blue', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.fuel', + delegate: { + type: 'faker', + target: 'vehicle.fuel', + }, + help: { + summary: 'Returns a fuel type.', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'Gasoline', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.manufacturer', + delegate: { + type: 'faker', + target: 'vehicle.manufacturer', + }, + help: { + summary: 'Returns a manufacturer name.', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'Hyundai', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.model', + delegate: { + type: 'faker', + target: 'vehicle.model', + }, + help: { + summary: 'Returns a vehicle model.', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'Aventador', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.type', + delegate: { + type: 'faker', + target: 'vehicle.type', + }, + help: { + summary: 'Returns a vehicle type.', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'Hatchback', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.vehicle', + delegate: { + type: 'faker', + target: 'vehicle.vehicle', + }, + help: { + summary: 'Returns a random vehicle.', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'Ford CTS', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.vin', + delegate: { + type: 'faker', + target: 'vehicle.vin', + }, + help: { + summary: 'Returns a vehicle identification number (VIN).', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: '7SJ9N0LM3LM265056', + returnType: 'string', + args: [], + }, + }, + { + keyword: 'vehicle.vrm', + delegate: { + type: 'faker', + target: 'vehicle.vrm', + }, + help: { + summary: 'Returns a vehicle registration number (Vehicle Registration Mark - VRM)', + docsUrl: 'https://fakerjs.dev/api/vehicle', + example: 'OD11RTZ', + returnType: 'string', + args: [], + }, + }, +]; + +export { DOMAIN_FAKER_VEHICLE_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-faker-word-keyword-definitions.js b/packages/core/js/domain/domain-faker-word-keyword-definitions.js new file mode 100644 index 00000000..7497af9a --- /dev/null +++ b/packages/core/js/domain/domain-faker-word-keyword-definitions.js @@ -0,0 +1,313 @@ +const DOMAIN_FAKER_WORD_KEYWORD_DEFINITIONS = [ + { + keyword: 'word.adjective', + delegate: { + type: 'faker', + target: 'word.adjective', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random adjective.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'heavenly', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.adverb', + delegate: { + type: 'faker', + target: 'word.adverb', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random adverb.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'selfishly', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.conjunction', + delegate: { + type: 'faker', + target: 'word.conjunction', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random conjunction.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'indeed', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.interjection', + delegate: { + type: 'faker', + target: 'word.interjection', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random interjection.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'er', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.noun', + delegate: { + type: 'faker', + target: 'word.noun', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random noun.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'cook', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.preposition', + delegate: { + type: 'faker', + target: 'word.preposition', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random preposition.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'beside', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.sample', + delegate: { + type: 'faker', + target: 'word.sample', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: + 'Returns a random word, that can be an adjective, adverb, conjunction, interjection, noun, preposition, or verb.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'snoopy', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.verb', + delegate: { + type: 'faker', + target: 'word.verb', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random verb.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'embalm', + returnType: 'string', + args: [ + { + name: 'length', + type: 'number', + required: false, + description: 'Desired length of the generated value.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + { + name: 'strategy', + type: 'string', + required: false, + description: + 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', + }, + ], + }, + }, + { + keyword: 'word.words', + delegate: { + type: 'faker', + target: 'word.words', + argTransform: 'optionsFromHelpArgs', + }, + help: { + summary: 'Returns a random string containing some words separated by spaces.', + docsUrl: 'https://fakerjs.dev/api/word', + example: 'geez', + returnType: 'string', + args: [ + { + name: 'count', + type: 'number', + required: false, + description: 'Number of items to generate.', + }, + { + name: 'max', + type: 'number', + required: false, + description: 'Maximum bound used when generating a value.', + }, + ], + }, + }, +]; + +export { DOMAIN_FAKER_WORD_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-keyword-definitions.js b/packages/core/js/domain/domain-keyword-definitions.js index 282a49c8..17eb5775 100644 --- a/packages/core/js/domain/domain-keyword-definitions.js +++ b/packages/core/js/domain/domain-keyword-definitions.js @@ -1,5062 +1,61 @@ +import { DOMAIN_FAKER_AIRLINE_KEYWORD_DEFINITIONS } from './domain-faker-airline-keyword-definitions.js'; +import { DOMAIN_FAKER_ANIMAL_KEYWORD_DEFINITIONS } from './domain-faker-animal-keyword-definitions.js'; +import { DOMAIN_FAKER_BOOK_KEYWORD_DEFINITIONS } from './domain-faker-book-keyword-definitions.js'; +import { DOMAIN_FAKER_COLOR_KEYWORD_DEFINITIONS } from './domain-faker-color-keyword-definitions.js'; +import { DOMAIN_FAKER_COMMERCE_KEYWORD_DEFINITIONS } from './domain-faker-commerce-keyword-definitions.js'; +import { DOMAIN_FAKER_COMPANY_KEYWORD_DEFINITIONS } from './domain-faker-company-keyword-definitions.js'; +import { DOMAIN_FAKER_DATABASE_KEYWORD_DEFINITIONS } from './domain-faker-database-keyword-definitions.js'; +import { DOMAIN_FAKER_DATATYPE_KEYWORD_DEFINITIONS } from './domain-faker-datatype-keyword-definitions.js'; +import { DOMAIN_FAKER_DATE_KEYWORD_DEFINITIONS } from './domain-faker-date-keyword-definitions.js'; +import { DOMAIN_FAKER_FINANCE_KEYWORD_DEFINITIONS } from './domain-faker-finance-keyword-definitions.js'; +import { DOMAIN_FAKER_FOOD_KEYWORD_DEFINITIONS } from './domain-faker-food-keyword-definitions.js'; +import { DOMAIN_FAKER_GIT_KEYWORD_DEFINITIONS } from './domain-faker-git-keyword-definitions.js'; +import { DOMAIN_FAKER_HACKER_KEYWORD_DEFINITIONS } from './domain-faker-hacker-keyword-definitions.js'; +import { DOMAIN_FAKER_IMAGE_KEYWORD_DEFINITIONS } from './domain-faker-image-keyword-definitions.js'; +import { DOMAIN_FAKER_INTERNET_KEYWORD_DEFINITIONS } from './domain-faker-internet-keyword-definitions.js'; +import { DOMAIN_CUSTOM_LITERAL_KEYWORD_DEFINITIONS } from './domain-custom-literal-keyword-definitions.js'; +import { DOMAIN_FAKER_LOCATION_KEYWORD_DEFINITIONS } from './domain-faker-location-keyword-definitions.js'; +import { DOMAIN_FAKER_LOREM_KEYWORD_DEFINITIONS } from './domain-faker-lorem-keyword-definitions.js'; +import { DOMAIN_FAKER_MUSIC_KEYWORD_DEFINITIONS } from './domain-faker-music-keyword-definitions.js'; +import { DOMAIN_FAKER_NUMBER_KEYWORD_DEFINITIONS } from './domain-faker-number-keyword-definitions.js'; +import { DOMAIN_FAKER_PERSON_KEYWORD_DEFINITIONS } from './domain-faker-person-keyword-definitions.js'; +import { DOMAIN_FAKER_PHONE_KEYWORD_DEFINITIONS } from './domain-faker-phone-keyword-definitions.js'; +import { DOMAIN_FAKER_SCIENCE_KEYWORD_DEFINITIONS } from './domain-faker-science-keyword-definitions.js'; +import { DOMAIN_FAKER_STRING_KEYWORD_DEFINITIONS } from './domain-faker-string-keyword-definitions.js'; +import { DOMAIN_CUSTOM_STRING_KEYWORD_DEFINITIONS } from './domain-custom-string-keyword-definitions.js'; +import { DOMAIN_FAKER_SYSTEM_KEYWORD_DEFINITIONS } from './domain-faker-system-keyword-definitions.js'; +import { DOMAIN_FAKER_VEHICLE_KEYWORD_DEFINITIONS } from './domain-faker-vehicle-keyword-definitions.js'; +import { DOMAIN_FAKER_WORD_KEYWORD_DEFINITIONS } from './domain-faker-word-keyword-definitions.js'; + const DOMAIN_KEYWORD_DEFINITIONS = [ - { - keyword: 'airline.aircraftType', - delegate: { - type: 'faker', - target: 'airline.aircraftType', - }, - help: { - summary: 'Returns a random aircraft type.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'regional', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.airline', - delegate: { - type: 'faker', - target: 'airline.airline', - }, - help: { - summary: 'Generate a value using faker airline.airline.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: '', - returnType: 'object', - args: [], - }, - }, - { - keyword: 'airline.airline.iataCode', - delegate: { - type: 'faker', - target: 'airline.airline', - resultPath: 'iataCode', - }, - help: { - summary: 'Generate an airline IATA code.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'AA', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.airline.name', - delegate: { - type: 'faker', - target: 'airline.airline', - resultPath: 'name', - }, - help: { - summary: 'Generate an airline name.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'Acme Air', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.airplane', - delegate: { - type: 'faker', - target: 'airline.airplane', - }, - help: { - summary: 'Generate a value using faker airline.airplane.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: '', - returnType: 'object', - args: [], - }, - }, - { - keyword: 'airline.airplane.iataTypeCode', - delegate: { - type: 'faker', - target: 'airline.airplane', - resultPath: 'iataTypeCode', - }, - help: { - summary: 'Generate an airplane IATA type code.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'A320', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.airplane.name', - delegate: { - type: 'faker', - target: 'airline.airplane', - resultPath: 'name', - }, - help: { - summary: 'Generate an airplane model name.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'Boeing 737', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.airport', - delegate: { - type: 'faker', - target: 'airline.airport', - }, - help: { - summary: 'Generate a value using faker airline.airport.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: '', - returnType: 'object', - args: [], - }, - }, - { - keyword: 'airline.airport.iataCode', - delegate: { - type: 'faker', - target: 'airline.airport', - resultPath: 'iataCode', - }, - help: { - summary: 'Generate an airport IATA code.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'LHR', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.airport.name', - delegate: { - type: 'faker', - target: 'airline.airport', - resultPath: 'name', - }, - help: { - summary: 'Generate an airport name.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'London Heathrow Airport', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.flightNumber', - delegate: { - type: 'faker', - target: 'airline.flightNumber', - }, - help: { - summary: 'Returns a random flight number. Flight numbers are always 1 to 4 digits long. Sometimes they are', - docsUrl: 'https://fakerjs.dev/api/airline', - example: '1', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.recordLocator', - delegate: { - type: 'faker', - target: 'airline.recordLocator', - }, - help: { - summary: 'Generates a random record locator. Record locators', - docsUrl: 'https://fakerjs.dev/api/airline', - example: 'TCSJCN', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'airline.seat', - delegate: { - type: 'faker', - target: 'airline.seat', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random seat.', - docsUrl: 'https://fakerjs.dev/api/airline', - example: '17F', - returnType: 'string', - args: [ - { - name: 'aircraftType', - type: 'string', - required: false, - description: 'The aircraft type. Can be one of narrowbody, regional, widebody.', - }, - ], - }, - }, - { - keyword: 'animal.bear', - delegate: { - type: 'faker', - target: 'animal.bear', - }, - help: { - summary: 'Returns a random bear species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Sloth bear', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.bird', - delegate: { - type: 'faker', - target: 'animal.bird', - }, - help: { - summary: 'Returns a random bird species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Orange-crowned Warbler', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.cat', - delegate: { - type: 'faker', - target: 'animal.cat', - }, - help: { - summary: 'Returns a random cat breed.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Russian Blue', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.cetacean', - delegate: { - type: 'faker', - target: 'animal.cetacean', - }, - help: { - summary: 'Returns a random cetacean species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Hector’s Dolphin', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.cow', - delegate: { - type: 'faker', - target: 'animal.cow', - }, - help: { - summary: 'Returns a random cow species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Aubrac', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.crocodilia', - delegate: { - type: 'faker', - target: 'animal.crocodilia', - }, - help: { - summary: 'Returns a random crocodilian species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Nile Crocodile', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.dog', - delegate: { - type: 'faker', - target: 'animal.dog', - }, - help: { - summary: 'Returns a random dog breed.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Jonangi', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.fish', - delegate: { - type: 'faker', - target: 'animal.fish', - }, - help: { - summary: 'Returns a random fish species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Short mackerel', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.horse', - delegate: { - type: 'faker', - target: 'animal.horse', - }, - help: { - summary: 'Returns a random horse breed.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Rottaler', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.insect', - delegate: { - type: 'faker', - target: 'animal.insect', - }, - help: { - summary: 'Returns a random insect species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Pigeon tremex', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.lion', - delegate: { - type: 'faker', - target: 'animal.lion', - }, - help: { - summary: 'Returns a random lion species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Masai Lion', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.petName', - delegate: { - type: 'faker', - target: 'animal.petName', - }, - help: { - summary: 'Returns a random pet name.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Stella', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.rabbit', - delegate: { - type: 'faker', - target: 'animal.rabbit', - }, - help: { - summary: 'Returns a random rabbit species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'Californian', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.rodent', - delegate: { - type: 'faker', - target: 'animal.rodent', - }, - help: { - summary: 'Returns a random rodent breed.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: "Natterer's tuco-tuco", - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.snake', - delegate: { - type: 'faker', - target: 'animal.snake', - }, - help: { - summary: 'Returns a random snake species.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'White-lipped python', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'animal.type', - delegate: { - type: 'faker', - target: 'animal.type', - }, - help: { - summary: 'Returns a random animal type.', - docsUrl: 'https://fakerjs.dev/api/animal', - example: 'bear', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'book.author', - delegate: { - type: 'faker', - target: 'book.author', - }, - help: { - summary: 'Returns a random author name.', - docsUrl: 'https://fakerjs.dev/api/book', - example: 'Jacqueline Crooks', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'book.format', - delegate: { - type: 'faker', - target: 'book.format', - }, - help: { - summary: 'Returns a random book format.', - docsUrl: 'https://fakerjs.dev/api/book', - example: 'Paperback', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'book.genre', - delegate: { - type: 'faker', - target: 'book.genre', - }, - help: { - summary: 'Returns a random genre.', - docsUrl: 'https://fakerjs.dev/api/book', - example: 'Science Fiction', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'book.publisher', - delegate: { - type: 'faker', - target: 'book.publisher', - }, - help: { - summary: 'Returns a random publisher.', - docsUrl: 'https://fakerjs.dev/api/book', - example: 'Butterworth-Heinemann', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'book.series', - delegate: { - type: 'faker', - target: 'book.series', - }, - help: { - summary: 'Returns a random series.', - docsUrl: 'https://fakerjs.dev/api/book', - example: 'The Inheritance Cycle', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'book.title', - delegate: { - type: 'faker', - target: 'book.title', - }, - help: { - summary: 'Returns a random title.', - docsUrl: 'https://fakerjs.dev/api/book', - example: 'Animal Farm', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'color.cmyk', - delegate: { - type: 'faker', - target: 'color.cmyk', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a CMYK color.', - docsUrl: 'https://fakerjs.dev/api/color', - example: '[0.95,0.17,0.23,1]', - returnType: 'string', - args: [ - { - name: 'format', - type: 'string', - required: false, - description: 'Format of generated CMYK color.', - }, - ], - }, - }, - { - keyword: 'color.colorByCSSColorSpace', - delegate: { - type: 'faker', - target: 'color.colorByCSSColorSpace', - }, - help: { - summary: 'Returns a random color based on CSS color space specified.', - docsUrl: 'https://fakerjs.dev/api/color', - example: '[0.5811,0.0479,0.1091]', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'color.cssSupportedFunction', - delegate: { - type: 'faker', - target: 'color.cssSupportedFunction', - }, - help: { - summary: 'Returns a random css supported color function name.', - docsUrl: 'https://fakerjs.dev/api/color', - example: 'hsla', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'color.cssSupportedSpace', - delegate: { - type: 'faker', - target: 'color.cssSupportedSpace', - }, - help: { - summary: 'Returns a random css supported color space name.', - docsUrl: 'https://fakerjs.dev/api/color', - example: 'sRGB', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'color.hsl', - delegate: { - type: 'faker', - target: 'color.hsl', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns an HSL color.', - docsUrl: 'https://fakerjs.dev/api/color', - example: '[212,0.78,0.54]', - returnType: 'string', - args: [ - { - name: 'format', - type: 'string', - required: false, - description: 'Format of generated HSL color.', - }, - { - name: 'includeAlpha', - type: 'boolean', - required: false, - description: 'Adds an alpha value to the color (RGBA).', - }, - ], - }, - }, - { - keyword: 'color.human', - delegate: { - type: 'faker', - target: 'color.human', - }, - help: { - summary: 'Returns a random human-readable color name.', - docsUrl: 'https://fakerjs.dev/api/color', - example: 'green', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'color.hwb', - delegate: { - type: 'faker', - target: 'color.hwb', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns an HWB color.', - docsUrl: 'https://fakerjs.dev/api/color', - example: '[328,0.27,0.33]', - returnType: 'string', - args: [ - { - name: 'format', - type: 'string', - required: false, - description: 'Format of generated RGB color.', - }, - ], - }, - }, - { - keyword: 'color.lab', - delegate: { - type: 'faker', - target: 'color.lab', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a LAB (CIELAB) color.', - docsUrl: 'https://fakerjs.dev/api/color', - example: '[0.071396,-55.6612,-66.7185]', - returnType: 'string', - args: [ - { - name: 'format', - type: 'string', - required: false, - description: 'Format of generated RGB color.', - }, - ], - }, - }, - { - keyword: 'color.lch', - delegate: { - type: 'faker', - target: 'color.lch', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns an LCH color. Even though upper bound of', - docsUrl: 'https://fakerjs.dev/api/color', - example: '[0.469557,212.9,204.9]', - returnType: 'string', - args: [ - { - name: 'format', - type: 'string', - required: false, - description: 'Format of generated RGB color.', - }, - ], - }, - }, - { - keyword: 'color.rgb', - delegate: { - type: 'faker', - target: 'color.rgb', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns an RGB color.', - docsUrl: 'https://fakerjs.dev/api/color', - example: '#ee8222', - returnType: 'string', - args: [ - { - name: 'casing', - type: 'string', - required: false, - description: "Letter type case of the generated hex color. Only applied when 'hex' format is used.", - }, - { - name: 'format', - type: 'string', - required: false, - description: 'Format of generated RGB color.', - }, - { - name: 'includeAlpha', - type: 'boolean', - required: false, - description: 'Adds an alpha value to the color (RGBA).', - }, - { - name: 'prefix', - type: 'string', - required: false, - description: "Prefix of the generated hex color. Only applied when 'hex' format is used.", - }, - ], - }, - }, - { - keyword: 'color.space', - delegate: { - type: 'faker', - target: 'color.space', - }, - help: { - summary: 'Returns a random color space name from the worldwide accepted color spaces.', - docsUrl: 'https://fakerjs.dev/api/color', - example: 'HSL', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'commerce.department', - delegate: { - type: 'faker', - target: 'commerce.department', - }, - help: { - summary: 'Returns a department inside a shop.', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: 'Tools', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'commerce.isbn', - delegate: { - type: 'faker', - target: 'commerce.isbn', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random ISBN identifier.', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: '978-1-996134-54-2', - returnType: 'string', - args: [ - { - name: 'separator', - type: 'string', - required: false, - description: 'Separator inserted between generated items.', - }, - { - name: 'variant', - type: 'string', - required: false, - description: - 'The variant of the identifier to return. Can be either 10 (10-digit format) or 13 (13-digit format).', - }, - ], - }, - }, - { - keyword: 'commerce.price', - delegate: { - type: 'faker', - target: 'commerce.price', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a price between min and max (inclusive).', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: '797.39', - returnType: 'number', - args: [ - { - name: 'dec', - type: 'number', - required: false, - description: 'The number of decimal places.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'The maximum price.', - }, - { - name: 'min', - type: 'number', - required: false, - description: 'The minimum price.', - }, - { - name: 'symbol', - type: 'string', - required: false, - description: 'The currency value to use.', - }, - ], - }, - }, - { - keyword: 'commerce.product', - delegate: { - type: 'faker', - target: 'commerce.product', - }, - help: { - summary: 'Returns a short product name.', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: 'Bike', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'commerce.productAdjective', - delegate: { - type: 'faker', - target: 'commerce.productAdjective', - }, - help: { - summary: 'Returns an adjective describing a product.', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: 'Luxurious', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'commerce.productDescription', - delegate: { - type: 'faker', - target: 'commerce.productDescription', - }, - help: { - summary: 'Returns a product description.', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: 'The green Hat combines Colombia aesthetics with Scandium-based durability', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'commerce.productMaterial', - delegate: { - type: 'faker', - target: 'commerce.productMaterial', - }, - help: { - summary: 'Returns a material of a product.', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: 'Steel', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'commerce.productName', - delegate: { - type: 'faker', - target: 'commerce.productName', - }, - help: { - summary: 'Generates a random descriptive product name.', - docsUrl: 'https://fakerjs.dev/api/commerce', - example: 'Soft Bronze Towels', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.buzzAdjective', - delegate: { - type: 'faker', - target: 'company.buzzAdjective', - }, - help: { - summary: 'Returns a random buzz adjective that can be used to demonstrate data being viewed by a manager.', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'out-of-the-box', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.buzzNoun', - delegate: { - type: 'faker', - target: 'company.buzzNoun', - }, - help: { - summary: 'Returns a random buzz noun that can be used to demonstrate data being viewed by a manager.', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'deliverables', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.buzzPhrase', - delegate: { - type: 'faker', - target: 'company.buzzPhrase', - }, - help: { - summary: 'Generates a random buzz phrase that can be used to demonstrate data being viewed by a manager.', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'streamline cutting-edge platforms', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.buzzVerb', - delegate: { - type: 'faker', - target: 'company.buzzVerb', - }, - help: { - summary: 'Returns a random buzz verb that can be used to demonstrate data being viewed by a manager.', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'disintermediate', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.catchPhrase', - delegate: { - type: 'faker', - target: 'company.catchPhrase', - }, - help: { - summary: 'Generates a random catch phrase that can be displayed to an end user.', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'Diverse AI-powered flexibility', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.catchPhraseAdjective', - delegate: { - type: 'faker', - target: 'company.catchPhraseAdjective', - }, - help: { - summary: 'Returns a random catch phrase adjective that can be displayed to an end user..', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'Distributed', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.catchPhraseDescriptor', - delegate: { - type: 'faker', - target: 'company.catchPhraseDescriptor', - }, - help: { - summary: 'Returns a random catch phrase descriptor that can be displayed to an end user..', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'encompassing', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.catchPhraseNoun', - delegate: { - type: 'faker', - target: 'company.catchPhraseNoun', - }, - help: { - summary: 'Returns a random catch phrase noun that can be displayed to an end user..', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'attitude', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'company.name', - delegate: { - type: 'faker', - target: 'company.name', - }, - help: { - summary: 'Generates a random company name.', - docsUrl: 'https://fakerjs.dev/api/company', - example: 'Lang - Little', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'database.collation', - delegate: { - type: 'faker', - target: 'database.collation', - }, - help: { - summary: 'Returns a random database collation.', - docsUrl: 'https://fakerjs.dev/api/database', - example: 'utf8_bin', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'database.column', - delegate: { - type: 'faker', - target: 'database.column', - }, - help: { - summary: 'Returns a random database column name.', - docsUrl: 'https://fakerjs.dev/api/database', - example: 'status', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'database.engine', - delegate: { - type: 'faker', - target: 'database.engine', - }, - help: { - summary: 'Returns a random database engine.', - docsUrl: 'https://fakerjs.dev/api/database', - example: 'ARCHIVE', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'database.mongodbObjectId', - delegate: { - type: 'faker', - target: 'database.mongodbObjectId', - }, - help: { - summary: 'Returns a MongoDB ObjectId string.', - docsUrl: 'https://fakerjs.dev/api/database', - example: 'e80bba2ae67c0c7dcc16bd57', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'database.type', - delegate: { - type: 'faker', - target: 'database.type', - }, - help: { - summary: 'Returns a random database column type.', - docsUrl: 'https://fakerjs.dev/api/database', - example: 'smallint', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'datatype.boolean', - delegate: { - type: 'faker', - target: 'datatype.boolean', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns the boolean value true or false.', - docsUrl: 'https://fakerjs.dev/api/datatype', - example: 'true', - returnType: 'boolean', - args: [ - { - name: 'probability', - type: 'number', - required: false, - description: 'Probability threshold for returning true (between 0 and 1).', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Numeric toggle for deterministic output: 0 returns false and 1 returns true.', - }, - ], - }, - }, - { - keyword: 'date.anytime', - delegate: { - type: 'faker', - target: 'date.anytime', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random date that can be either in the past or in the future.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '"2026-12-25T08:55:20.593Z"', - returnType: 'date', - args: [ - { - name: 'refDate', - type: 'number', - required: false, - description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', - }, - ], - }, - }, - { - keyword: 'date.between', - delegate: { - type: 'faker', - target: 'date.between', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random date between the given boundaries.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '', - returnType: 'date', - args: [ - { - name: 'from', - type: 'number', - required: false, - description: 'Start boundary as a Unix timestamp in milliseconds since epoch.', - }, - { - name: 'to', - type: 'number', - required: false, - description: 'End boundary as a Unix timestamp in milliseconds since epoch.', - }, - ], - }, - }, - { - keyword: 'date.betweens', - delegate: { - type: 'faker', - target: 'date.betweens', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: - 'Generates random dates between the given boundaries. The dates will be returned in an array sorted in chronological order.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '', - returnType: 'array', - args: [ - { - name: 'count', - type: 'number', - required: false, - description: 'The number of dates to generate.', - }, - { - name: 'from', - type: 'number', - required: false, - description: 'Start boundary as a Unix timestamp in milliseconds since epoch.', - }, - { - name: 'to', - type: 'number', - required: false, - description: 'End boundary as a Unix timestamp in milliseconds since epoch.', - }, - ], - }, - }, - { - keyword: 'date.birthdate', - delegate: { - type: 'faker', - target: 'date.birthdate', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: - 'Returns a random birthdate. By default, the birthdate is generated for an adult between 18 and 80 years old.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '"1966-09-18T08:47:31.333Z"', - returnType: 'date', - args: [ - { - name: 'refDate', - type: 'number', - required: false, - description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'The maximum age/year to generate a birthdate for/in.', - }, - { - name: 'min', - type: 'number', - required: false, - description: 'The minimum age/year to generate a birthdate for/in.', - }, - { - name: 'mode', - type: 'string', - required: false, - description: "Either 'age' or 'year' to generate a birthdate based on the age or year range.", - }, - ], - }, - }, - { - keyword: 'date.future', - delegate: { - type: 'faker', - target: 'date.future', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random date in the future.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '"2027-02-07T18:41:48.525Z"', - returnType: 'date', - args: [ - { - name: 'refDate', - type: 'number', - required: false, - description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', - }, - { - name: 'years', - type: 'number', - required: false, - description: 'The range of years the date may be in the future.', - }, - ], - }, - }, - { - keyword: 'date.month', - delegate: { - type: 'faker', - target: 'date.month', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random name of a month.', - docsUrl: 'https://fakerjs.dev/api/date', - example: 'February', - returnType: 'object', - args: [ - { - name: 'abbreviated', - type: 'boolean', - required: false, - description: 'Whether to return an abbreviation.', - }, - { - name: 'context', - type: 'boolean', - required: false, - description: - 'Whether to return the name of a month in the context of a date. In the currently supported locale this has no visible effect. This option is mainly relevant for future multi-locale support (for example, locale-specific grammar/capitalization differences).', - }, - ], - }, - }, - { - keyword: 'date.past', - delegate: { - type: 'faker', - target: 'date.past', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random date in the past.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '"2025-07-01T11:48:55.347Z"', - returnType: 'date', - args: [ - { - name: 'refDate', - type: 'number', - required: false, - description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', - }, - { - name: 'years', - type: 'number', - required: false, - description: 'The range of years the date may be in the past.', - }, - ], - }, - }, - { - keyword: 'date.recent', - delegate: { - type: 'faker', - target: 'date.recent', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random date in the recent past.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '"2026-04-27T23:46:16.707Z"', - returnType: 'date', - args: [ - { - name: 'days', - type: 'number', - required: false, - description: 'The range of days the date may be in the past.', - }, - { - name: 'refDate', - type: 'number', - required: false, - description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', - }, - ], - }, - }, - { - keyword: 'date.soon', - delegate: { - type: 'faker', - target: 'date.soon', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random date in the near future.', - docsUrl: 'https://fakerjs.dev/api/date', - example: '"2026-04-29T11:09:09.211Z"', - returnType: 'date', - args: [ - { - name: 'days', - type: 'number', - required: false, - description: 'The range of days the date may be in the future.', - }, - { - name: 'refDate', - type: 'number', - required: false, - description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', - }, - ], - }, - }, - { - keyword: 'date.timeZone', - delegate: { - type: 'faker', - target: 'date.timeZone', - }, - help: { - summary: 'Returns a random IANA time zone relevant to this locale.', - docsUrl: 'https://fakerjs.dev/api/date', - example: 'Europe/Stockholm', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'date.weekday', - delegate: { - type: 'faker', - target: 'date.weekday', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random day of the week.', - docsUrl: 'https://fakerjs.dev/api/date', - example: 'Tuesday', - returnType: 'object', - args: [ - { - name: 'abbreviated', - type: 'boolean', - required: false, - description: 'Whether to return an abbreviation.', - }, - { - name: 'context', - type: 'boolean', - required: false, - description: - 'Whether to return the day of the week in the context of a date. In the currently supported locale this has no visible effect. This option is mainly relevant for future multi-locale support (for example, locale-specific grammar/capitalization differences).', - }, - ], - }, - }, - { - keyword: 'finance.accountName', - delegate: { - type: 'faker', - target: 'finance.accountName', - }, - help: { - summary: 'Generates a random account name.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'Investment Account', - returnType: 'integer', - args: [], - }, - }, - { - keyword: 'finance.accountNumber', - delegate: { - type: 'faker', - target: 'finance.accountNumber', - }, - help: { - summary: 'Generates a random account number.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '43208795', - returnType: 'integer', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - ], - }, - }, - { - keyword: 'finance.amount', - delegate: { - type: 'faker', - target: 'finance.amount', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random amount between the given bounds (inclusive).', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '536.86', - returnType: 'number', - args: [ - { - name: 'autoFormat', - type: 'boolean', - required: false, - description: 'If true this method will use Number.toLocaleString(). Otherwise it will use Number.toFixed().', - }, - { - name: 'dec', - type: 'number', - required: false, - description: 'The number of decimal places for the amount.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'The upper bound for the amount.', - }, - { - name: 'min', - type: 'number', - required: false, - description: 'The lower bound for the amount.', - }, - { - name: 'symbol', - type: 'string', - required: false, - description: 'The symbol used to prefix the amount.', - }, - ], - }, - }, - { - keyword: 'finance.bic', - delegate: { - type: 'faker', - target: 'finance.bic', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random SWIFT/BIC code based on the ISO-9362 format.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'TXWRPYFT', - returnType: 'string', - args: [ - { - name: 'includeBranchCode', - type: 'boolean', - required: false, - description: 'Whether to include a three-digit branch code at the end of the generated code.', - }, - ], - }, - }, - { - keyword: 'finance.bitcoinAddress', - delegate: { - type: 'faker', - target: 'finance.bitcoinAddress', - }, - help: { - summary: 'Generates a random Bitcoin address.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '39fu5Nhnibj2xa8FPVxCbX7y4xZi5SWd', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.creditCardCVV', - delegate: { - type: 'faker', - target: 'finance.creditCardCVV', - }, - help: { - summary: 'Generates a random credit card CVV.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '839', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.creditCardIssuer', - delegate: { - type: 'faker', - target: 'finance.creditCardIssuer', - }, - help: { - summary: 'Returns a random credit card issuer.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'jcb', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.creditCardNumber', - delegate: { - type: 'faker', - target: 'finance.creditCardNumber', - }, - help: { - summary: 'Generates a random credit card number.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '6449-4462-4996-7580', - returnType: 'string', - args: [ - { - name: 'issuer', - type: 'string', - required: false, - description: 'Issuer or provider value used to constrain generated output.', - }, - ], - }, - }, - { - keyword: 'finance.currency', - delegate: { - type: 'faker', - target: 'finance.currency', - }, - help: { - summary: 'Returns a random currency object, containing `code`, `name`, `symbol`, and `numericCode` properties.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '{"name":"Rial Omani","code":"OMR","symbol":"﷼","numericCode":"512"}', - returnType: 'object', - args: [], - }, - }, - { - keyword: 'finance.currencyCode', - delegate: { - type: 'faker', - target: 'finance.currencyCode', - }, - help: { - summary: 'Returns a random currency code.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'ISK', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.currencyName', - delegate: { - type: 'faker', - target: 'finance.currencyName', - }, - help: { - summary: 'Returns a random currency name.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'South Sudanese pound', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.currencyNumericCode', - delegate: { - type: 'faker', - target: 'finance.currencyNumericCode', - }, - help: { - summary: 'Returns a random currency numeric code.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '270', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.currencySymbol', - delegate: { - type: 'faker', - target: 'finance.currencySymbol', - }, - help: { - summary: 'Returns a random currency symbol.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '₩', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.ethereumAddress', - delegate: { - type: 'faker', - target: 'finance.ethereumAddress', - }, - help: { - summary: 'Creates a random, non-checksum Ethereum address.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '0xf5d385aff27de9dee6eeeffd924ffd7dd2d252ca', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.iban', - delegate: { - type: 'faker', - target: 'finance.iban', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random IBAN.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'CH67001759079BP5WA811', - returnType: 'string', - args: [ - { - name: 'countryCode', - type: 'string', - required: false, - description: - 'The country code from which you want to generate an IBAN, if none is provided a random country will be used.', - }, - { - name: 'formatted', - type: 'boolean', - required: false, - description: 'Return a formatted version of the generated IBAN.', - }, - ], - }, - }, - { - keyword: 'finance.litecoinAddress', - delegate: { - type: 'faker', - target: 'finance.litecoinAddress', - }, - help: { - summary: 'Generates a random Litecoin address.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'M7nWopfUfSjA8cmGWvuENRLu6GU4C1iTK', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.maskedNumber', - delegate: { - type: 'faker', - target: 'finance.maskedNumber', - }, - help: { - summary: 'Generates a random masked number.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '(...0934)', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - ], - }, - }, - { - keyword: 'finance.pin', - delegate: { - type: 'faker', - target: 'finance.pin', - }, - help: { - summary: 'Generates a random PIN number.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '1107', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - ], - }, - }, - { - keyword: 'finance.routingNumber', - delegate: { - type: 'faker', - target: 'finance.routingNumber', - }, - help: { - summary: 'Generates a random routing number.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: '933657999', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.transactionDescription', - delegate: { - type: 'faker', - target: 'finance.transactionDescription', - }, - help: { - summary: 'Generates a random transaction description.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: - 'Transaction alert: deposit at Jones LLC using card ending ****4221 for an amount of GIP 94.88 on account ***3694.', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'finance.transactionType', - delegate: { - type: 'faker', - target: 'finance.transactionType', - }, - help: { - summary: 'Returns a random transaction type.', - docsUrl: 'https://fakerjs.dev/api/finance', - example: 'deposit', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.adjective', - delegate: { - type: 'faker', - target: 'food.adjective', - }, - help: { - summary: 'Generates a random dish adjective.', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'salty', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.description', - delegate: { - type: 'faker', - target: 'food.description', - }, - help: { - summary: 'Generates a random dish description.', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'Fresh mixed greens tossed with pimento-rubbed pigeon, bean shoots, and a light dressing.', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.dish', - delegate: { - type: 'faker', - target: 'food.dish', - }, - help: { - summary: 'Generates a random dish name.', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'Chicken Fajitas', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.ethnicCategory', - delegate: { - type: 'faker', - target: 'food.ethnicCategory', - }, - help: { - summary: "Generates a random food's ethnic category.", - docsUrl: 'https://fakerjs.dev/api/food', - example: 'Lithuanian', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.fruit', - delegate: { - type: 'faker', - target: 'food.fruit', - }, - help: { - summary: 'Generates a random fruit name.', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'snowpea', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.ingredient', - delegate: { - type: 'faker', - target: 'food.ingredient', - }, - help: { - summary: 'Generates a random ingredient name.', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'spelt', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.meat', - delegate: { - type: 'faker', - target: 'food.meat', - }, - help: { - summary: 'Generates a random meat', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'goose', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.spice', - delegate: { - type: 'faker', - target: 'food.spice', - }, - help: { - summary: 'Generates a random spice name.', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'poudre de colombo', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'food.vegetable', - delegate: { - type: 'faker', - target: 'food.vegetable', - }, - help: { - summary: 'Generates a random vegetable name.', - docsUrl: 'https://fakerjs.dev/api/food', - example: 'snowpea sprouts', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'git.branch', - delegate: { - type: 'faker', - target: 'git.branch', - }, - help: { - summary: 'Generates a random branch name.', - docsUrl: 'https://fakerjs.dev/api/git', - example: 'array-compress', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'git.commitDate', - delegate: { - type: 'faker', - target: 'git.commitDate', - }, - help: { - summary: 'Generates a date string for a git commit using the same format as `git log`.', - docsUrl: 'https://fakerjs.dev/api/git', - example: 'Tue Apr 28 04:28:58 2026 -0600', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'git.commitEntry', - delegate: { - type: 'faker', - target: 'git.commitEntry', - }, - help: { - summary: 'Generates a random commit entry as printed by `git log`.', - docsUrl: 'https://fakerjs.dev/api/git', - example: '', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'git.commitMessage', - delegate: { - type: 'faker', - target: 'git.commitMessage', - }, - help: { - summary: 'Generates a random commit message.', - docsUrl: 'https://fakerjs.dev/api/git', - example: 'reboot cross-platform system', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'git.commitSha', - delegate: { - type: 'faker', - target: 'git.commitSha', - }, - help: { - summary: 'Generates a random commit sha.', - docsUrl: 'https://fakerjs.dev/api/git', - example: '3418f0e64e8eae52ebd67b11d98e571fd6a81017', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'hacker.abbreviation', - delegate: { - type: 'faker', - target: 'hacker.abbreviation', - }, - help: { - summary: 'Returns a random hacker/IT abbreviation.', - docsUrl: 'https://fakerjs.dev/api/hacker', - example: 'GB', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'hacker.adjective', - delegate: { - type: 'faker', - target: 'hacker.adjective', - }, - help: { - summary: 'Returns a random hacker/IT adjective.', - docsUrl: 'https://fakerjs.dev/api/hacker', - example: 'bluetooth', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'hacker.ingverb', - delegate: { - type: 'faker', - target: 'hacker.ingverb', - }, - help: { - summary: 'Returns a random hacker/IT verb for continuous actions (en: ing suffix; e.g. hacking).', - docsUrl: 'https://fakerjs.dev/api/hacker', - example: 'synthesizing', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'hacker.noun', - delegate: { - type: 'faker', - target: 'hacker.noun', - }, - help: { - summary: 'Returns a random hacker/IT noun.', - docsUrl: 'https://fakerjs.dev/api/hacker', - example: 'program', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'hacker.phrase', - delegate: { - type: 'faker', - target: 'hacker.phrase', - }, - help: { - summary: 'Generates a random hacker/IT phrase.', - docsUrl: 'https://fakerjs.dev/api/hacker', - example: "compressing the application won't do anything, we need to reboot the neural JSON hard drive!", - returnType: 'string', - args: [], - }, - }, - { - keyword: 'hacker.verb', - delegate: { - type: 'faker', - target: 'hacker.verb', - }, - help: { - summary: 'Returns a random hacker/IT verb.', - docsUrl: 'https://fakerjs.dev/api/hacker', - example: 'program', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.avatar', - delegate: { - type: 'faker', - target: 'image.avatar', - }, - help: { - summary: 'Generates a random avatar image url.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://avatars.githubusercontent.com/u/2389220', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.avatarGitHub', - delegate: { - type: 'faker', - target: 'image.avatarGitHub', - }, - help: { - summary: 'Generates a random avatar from GitHub.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://avatars.githubusercontent.com/u/22969292', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.avatarLegacy', - delegate: { - type: 'faker', - target: 'image.avatarLegacy', - }, - help: { - summary: - 'Generates a random avatar from `https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar`.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1198.jpg', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.dataUri', - delegate: { - type: 'faker', - target: 'image.dataUri', - }, - help: { - summary: 'Generates a random data uri containing an URL-encoded SVG image or a Base64-encoded SVG image.', - docsUrl: 'https://fakerjs.dev/api/image', - example: '', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.personPortrait', - delegate: { - type: 'faker', - target: 'image.personPortrait', - }, - help: { - summary: 'Generates a random square portrait (avatar) of a person.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://cdn.jsdelivr.net/gh/faker-js/assets-person-portrait/female/512/99.jpg', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.url', - delegate: { - type: 'faker', - target: 'image.url', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random image url.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://loremflickr.com/3255/509?lock=5223276893828872', - returnType: 'string', - args: [ - { - name: 'height', - type: 'number', - required: false, - description: 'The height of the image.', - }, - { - name: 'width', - type: 'number', - required: false, - description: 'The width of the image.', - }, - ], - }, - }, - { - keyword: 'image.urlLoremFlickr', - delegate: { - type: 'faker', - target: 'image.urlLoremFlickr', - }, - help: { - summary: 'Generates a random image url provided via https://loremflickr.com.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://loremflickr.com/3966/3602?lock=6417693540486546', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.urlPicsumPhotos', - delegate: { - type: 'faker', - target: 'image.urlPicsumPhotos', - }, - help: { - summary: 'Generates a random image url provided via https://picsum.photos.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://picsum.photos/seed/UBLQun43/2068/162?blur=8', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'image.urlPlaceholder', - delegate: { - type: 'faker', - target: 'image.urlPlaceholder', - }, - help: { - summary: 'Generates a random image url provided via https://via.placeholder.com/.', - docsUrl: 'https://fakerjs.dev/api/image', - example: 'https://via.placeholder.com/2302x1759/a80adf/2de69f.gif?text=utrimque%20summa%20dolores', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.color', - delegate: { - type: 'faker', - target: 'internet.color', - }, - help: { - summary: 'Generates a random css hex color code in aesthetically pleasing color palette.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '#290551', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.displayName', - delegate: { - type: 'faker', - target: 'internet.displayName', - }, - help: { - summary: "Generates a display name using the given person's name as base.", - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'Cordell0', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.domainName', - delegate: { - type: 'faker', - target: 'internet.domainName', - }, - help: { - summary: 'Generates a random domain name.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'beloved-peony.org', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.domainSuffix', - delegate: { - type: 'faker', - target: 'internet.domainSuffix', - }, - help: { - summary: 'Returns a random domain suffix.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'com', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.domainWord', - delegate: { - type: 'faker', - target: 'internet.domainWord', - }, - help: { - summary: 'Generates a random domain word.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'inexperienced-ravioli', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.email', - delegate: { - type: 'faker', - target: 'internet.email', - }, - help: { - summary: 'Generates data using faker internet email.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'Jana91@hotmail.com', - returnType: 'string', - args: [ - { - name: 'allowSpecialCharacters', - type: 'boolean', - required: false, - description: - "Whether special characters such as .!#$%&'*+-/=?^_`{|}~ should be included in the email address.", - }, - { - name: 'firstName', - type: 'string', - required: false, - description: 'The optional first name to use.', - }, - { - name: 'lastName', - type: 'string', - required: false, - description: 'The optional last name to use.', - }, - { - name: 'provider', - type: 'string', - required: false, - description: 'The mail provider domain to use. If not specified, a random free mail provider will be chosen.', - }, - ], - }, - }, - { - keyword: 'internet.emoji', - delegate: { - type: 'faker', - target: 'internet.emoji', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random emoji.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '🤨', - returnType: 'string', - args: [ - { - name: 'types', - type: 'array', - required: false, - description: 'A list of the emoji types that should be used.', - }, - ], - }, - }, - { - keyword: 'internet.exampleEmail', - delegate: { - type: 'faker', - target: 'internet.exampleEmail', - }, - help: { - summary: 'Generates data using faker internet example email.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'Jeremie37@example.net', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.httpMethod', - delegate: { - type: 'faker', - target: 'internet.httpMethod', - }, - help: { - summary: 'Returns a random http method.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'PATCH', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.httpStatusCode', - delegate: { - type: 'faker', - target: 'internet.httpStatusCode', - }, - help: { - summary: 'Generates a random HTTP status code.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '303', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.ip', - delegate: { - type: 'faker', - target: 'internet.ip', - }, - help: { - summary: 'Generates a random IPv4 or IPv6 address.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '56.23.30.52', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.ipv4', - delegate: { - type: 'faker', - target: 'internet.ipv4', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random IPv4 address.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '', - returnType: 'string', - args: [ - { - name: 'cidrBlock', - type: 'string', - required: false, - description: 'The optional CIDR block to use. Must be in the format x.x.x.x/y.', - }, - { - name: 'network', - type: 'string', - required: false, - description: 'The optional network to use. This is intended as an alias for well-known cidrBlocks.', - }, - ], - }, - }, - { - keyword: 'internet.ipv6', - delegate: { - type: 'faker', - target: 'internet.ipv6', - }, - help: { - summary: 'Generates a random IPv6 address.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.jwt', - delegate: { - type: 'faker', - target: 'internet.jwt', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random JWT (JSON Web Token).', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '', - returnType: 'string', - args: [ - { - name: 'header', - type: 'array', - required: false, - description: 'The header to use for the token. If present, it will replace any default values.', - }, - { - name: 'payload', - type: 'array', - required: false, - description: 'The payload to use for the token. If present, it will replace any default values.', - }, - { - name: 'refDate', - type: 'number', - required: false, - description: 'Reference date as a Unix timestamp in milliseconds since epoch used as the generation anchor.', - }, - ], - }, - }, - { - keyword: 'internet.jwtAlgorithm', - delegate: { - type: 'faker', - target: 'internet.jwtAlgorithm', - }, - help: { - summary: 'Generates a random JWT (JSON Web Token) Algorithm.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'PS384', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.mac', - delegate: { - type: 'faker', - target: 'internet.mac', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random mac address.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'ae:a9:d7:ba:d2:bd', - returnType: 'string', - args: [ - { - name: 'separator', - type: 'string', - required: false, - description: "The optional separator to use. Can be either ':', '-' or ''.", - }, - ], - }, - }, - { - keyword: 'internet.password', - delegate: { - type: 'faker', - target: 'internet.password', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: - 'Generates a random password-like string. Do not use this method for generating actual passwords for users.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'og1ejoksrfwVbIF', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'The length of the password to generate.', - }, - { - name: 'memorable', - type: 'boolean', - required: false, - description: 'Whether the generated password should be memorable.', - }, - { - name: 'pattern', - type: 'string', - required: false, - description: 'The pattern that all chars should match. This option will be ignored, if memorable is true.', - }, - { - name: 'prefix', - type: 'string', - required: false, - description: 'The prefix to use.', - }, - ], - }, - }, - { - keyword: 'internet.port', - delegate: { - type: 'faker', - target: 'internet.port', - }, - help: { - summary: 'Generates a random port number.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '24545', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.protocol', - delegate: { - type: 'faker', - target: 'internet.protocol', - }, - help: { - summary: 'Returns a random web protocol. Either `http` or `https`.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'http', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.url', - delegate: { - type: 'faker', - target: 'internet.url', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random http(s) url.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'https://brave-interior.biz/', - returnType: 'string', - args: [ - { - name: 'appendSlash', - type: 'boolean', - required: false, - description: 'Whether to append a slash to the end of the url (path).', - }, - { - name: 'protocol', - type: 'string', - required: false, - description: 'The protocol to use.', - }, - ], - }, - }, - { - keyword: 'internet.userAgent', - delegate: { - type: 'faker', - target: 'internet.userAgent', - }, - help: { - summary: 'Generates a random user agent string.', - docsUrl: 'https://fakerjs.dev/api/internet', - example: '', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'internet.username', - delegate: { - type: 'faker', - target: 'internet.username', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: "Generates a username using the given person's name as base.", - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'Deanna51', - returnType: 'string', - args: [ - { - name: 'firstName', - type: 'string', - required: false, - description: 'The optional first name to use.', - }, - { - name: 'lastName', - type: 'string', - required: false, - description: 'The optional last name to use.', - }, - ], - }, - }, - { - keyword: 'internet.userName', - delegate: { - type: 'faker', - target: 'internet.userName', - }, - help: { - summary: "Generates a username using the given person's name as base.", - docsUrl: 'https://fakerjs.dev/api/internet', - example: 'Ana_Keebler', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'literal.value', - delegate: { - type: 'custom', - target: 'literal.value', - }, - help: { - summary: 'Return the literal value provided by the caller.', - docsUrl: 'https://anywaydata.com/docs/category/generating-data', - example: 'Pending', - returnType: 'string', - args: [ - { - name: 'value', - type: 'string|number|boolean', - required: true, - description: 'Literal value to return.', - }, - ], - }, - }, - { - keyword: 'location.buildingNumber', - delegate: { - type: 'faker', - target: 'location.buildingNumber', - }, - help: { - summary: 'Generates a random building number.', - docsUrl: 'https://fakerjs.dev/api/location', - example: '5075', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.cardinalDirection', - delegate: { - type: 'faker', - target: 'location.cardinalDirection', - }, - help: { - summary: 'Returns a random cardinal direction (north, east, south, west).', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'East', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.city', - delegate: { - type: 'faker', - target: 'location.city', - }, - help: { - summary: 'Generates a random localized city name.', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Stellachester', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.continent', - delegate: { - type: 'faker', - target: 'location.continent', - }, - help: { - summary: 'Returns a random continent name.', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Asia', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.country', - delegate: { - type: 'faker', - target: 'location.country', - }, - help: { - summary: 'Returns a random country name.', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Svalbard & Jan Mayen Islands', - returnType: 'integer', - args: [], - }, - }, - { - keyword: 'location.countryCode', - delegate: { - type: 'faker', - target: 'location.countryCode', - }, - help: { - summary: 'Returns a random ISO_3166-1 country code.', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'MG', - returnType: 'integer', - args: [], - }, - }, - { - keyword: 'location.county', - delegate: { - type: 'faker', - target: 'location.county', - }, - help: { - summary: - "Returns a random localized county, or other equivalent second-level administrative entity for the locale's country such as a district or department.", - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Northamptonshire', - returnType: 'integer', - args: [], - }, - }, - { - keyword: 'location.direction', - delegate: { - type: 'faker', - target: 'location.direction', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random direction (cardinal and ordinal; northwest, east, etc).', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'North', - returnType: 'string', - args: [ - { - name: 'abbreviated', - type: 'boolean', - required: false, - description: - 'If true this will return abbreviated directions (NW, E, etc). Otherwise this will return the long name.', - }, - ], - }, - }, - { - keyword: 'location.language', - delegate: { - type: 'faker', - target: 'location.language', - }, - help: { - summary: 'Returns a random spoken language.', - docsUrl: 'https://fakerjs.dev/api/location', - example: '{"name":"Icelandic","alpha2":"is","alpha3":"isl"}', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.latitude', - delegate: { - type: 'faker', - target: 'location.latitude', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random latitude.', - docsUrl: 'https://fakerjs.dev/api/location', - example: '51.5448', - returnType: 'number', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'The lower bound for the latitude to generate.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'The upper bound for the latitude to generate.', - }, - { - name: 'precision', - type: 'number', - required: false, - description: 'The number of decimal points of precision for the latitude.', - }, - ], - }, - }, - { - keyword: 'location.longitude', - delegate: { - type: 'faker', - target: 'location.longitude', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random longitude.', - docsUrl: 'https://fakerjs.dev/api/location', - example: '92.3892', - returnType: 'number', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'The lower bound for the longitude to generate.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'The upper bound for the longitude to generate.', - }, - { - name: 'precision', - type: 'number', - required: false, - description: 'The number of decimal points of precision for the longitude.', - }, - ], - }, - }, - { - keyword: 'location.nearbyGPSCoordinate', - delegate: { - type: 'faker', - target: 'location.nearbyGPSCoordinate', - }, - help: { - summary: 'Generates a random GPS coordinate within the specified radius from the given coordinate.', - docsUrl: 'https://fakerjs.dev/api/location', - example: '[58.313,9.9746]', - returnType: 'array', - args: [], - }, - }, - { - keyword: 'location.ordinalDirection', - delegate: { - type: 'faker', - target: 'location.ordinalDirection', - }, - help: { - summary: 'Returns a random ordinal direction (northwest, southeast, etc).', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Northeast', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.secondaryAddress', - delegate: { - type: 'faker', - target: 'location.secondaryAddress', - }, - help: { - summary: 'Generates a random localized secondary address. This refers to a specific location at a given address', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Suite 634', - returnType: 'integer', - args: [], - }, - }, - { - keyword: 'location.state', - delegate: { - type: 'faker', - target: 'location.state', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: - "Returns a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region.", - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Hawaii', - returnType: 'string', - args: [ - { - name: 'abbreviated', - type: 'boolean', - required: false, - description: - 'If true this will return abbreviated first-level administrative entity names. Otherwise this will return the long name.', - }, - ], - }, - }, - { - keyword: 'location.street', - delegate: { - type: 'faker', - target: 'location.street', - }, - help: { - summary: 'Generates a random localized street name.', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Viva Harbor', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.streetAddress', - delegate: { - type: 'faker', - target: 'location.streetAddress', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random localized street address.', - docsUrl: 'https://fakerjs.dev/api/location', - example: '12056 Vandervort Common', - returnType: 'string', - args: [ - { - name: 'useFullAddress', - type: 'boolean', - required: false, - description: 'Optional boolean argument for this command.', - }, - { - name: 'value', - type: 'boolean', - required: false, - description: - 'Legacy placeholder argument from Faker signatures; currently has no effect. Use the documented options instead.', - }, - ], - }, - }, - { - keyword: 'location.timeZone', - delegate: { - type: 'faker', - target: 'location.timeZone', - }, - help: { - summary: 'Returns a random IANA time zone name.', - docsUrl: 'https://fakerjs.dev/api/location', - example: 'Australia/Perth', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'location.zipCode', - delegate: { - type: 'faker', - target: 'location.zipCode', - }, - help: { - summary: 'Generates data using faker location zip code.', - docsUrl: 'https://fakerjs.dev/api/location', - example: '36791', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'lorem.lines', - delegate: { - type: 'faker', - target: 'lorem.lines', - }, - help: { - summary: "Generates the given number lines of lorem separated by `'\\n'`.", - docsUrl: 'https://fakerjs.dev/api/lorem', - example: 'Illum qui ocer creptio. Antepono aro vergo voluptatem acervus compono apud.', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'lineCount', - type: 'number', - required: false, - description: 'Optional number argument for this command.', - }, - { - name: 'lineCountMax', - type: 'number', - required: false, - description: 'The maximum number of lines to generate.', - }, - { - name: 'lineCountMin', - type: 'number', - required: false, - description: 'The minimum number of lines to generate.', - }, - ], - }, - }, - { - keyword: 'lorem.paragraph', - delegate: { - type: 'faker', - target: 'lorem.paragraph', - }, - help: { - summary: 'Generates a paragraph with the given number of sentences.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: '', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'sentenceCount', - type: 'number', - required: false, - description: 'Number of sentences to generate.', - }, - { - name: 'sentenceCountMax', - type: 'number', - required: false, - description: 'The maximum number of sentences to generate.', - }, - { - name: 'sentenceCountMin', - type: 'number', - required: false, - description: 'The minimum number of sentences to generate.', - }, - ], - }, - }, - { - keyword: 'lorem.paragraphs', - delegate: { - type: 'faker', - target: 'lorem.paragraphs', - }, - help: { - summary: 'Generates the given number of paragraphs.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: '', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'paragraphCount', - type: 'number', - required: false, - description: 'Number of paragraphs to generate.', - }, - { - name: 'separator', - type: 'string', - required: false, - description: 'Separator inserted between generated items.', - }, - { - name: 'paragraphCountMax', - type: 'number', - required: false, - description: 'The maximum number of paragraphs to generate.', - }, - { - name: 'paragraphCountMin', - type: 'number', - required: false, - description: 'The minimum number of paragraphs to generate.', - }, - ], - }, - }, - { - keyword: 'lorem.sentence', - delegate: { - type: 'faker', - target: 'lorem.sentence', - }, - help: { - summary: 'Generates a space separated list of words beginning with a capital letter and ending with a period.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: 'Auctor cum deorsum attero cum tergo aut.', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'wordCount', - type: 'number', - required: false, - description: 'Number of words to generate.', - }, - { - name: 'wordCountMax', - type: 'number', - required: false, - description: 'The maximum number of words to generate.', - }, - { - name: 'wordCountMin', - type: 'number', - required: false, - description: 'The minimum number of words to generate.', - }, - ], - }, - }, - { - keyword: 'lorem.sentences', - delegate: { - type: 'faker', - target: 'lorem.sentences', - }, - help: { - summary: 'Generates the given number of sentences.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: 'Vicissitudo amet candidus. Urbanus magni carbo artificiose tenus at ambulo.', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'sentenceCount', - type: 'number', - required: false, - description: 'Number of sentences to generate.', - }, - { - name: 'separator', - type: 'string', - required: false, - description: 'Separator inserted between generated items.', - }, - { - name: 'sentenceCountMax', - type: 'number', - required: false, - description: 'The maximum number of sentences to generate.', - }, - { - name: 'sentenceCountMin', - type: 'number', - required: false, - description: 'The minimum number of sentences to generate.', - }, - ], - }, - }, - { - keyword: 'lorem.slug', - delegate: { - type: 'faker', - target: 'lorem.slug', - }, - help: { - summary: 'Generates a slugified text consisting of the given number of hyphen separated words.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: 'dolore-accusator-atqui', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'wordCount', - type: 'number', - required: false, - description: 'Number of words to generate.', - }, - { - name: 'wordCountMax', - type: 'number', - required: false, - description: 'The maximum number of words to generate.', - }, - { - name: 'wordCountMin', - type: 'number', - required: false, - description: 'The minimum number of words to generate.', - }, - ], - }, - }, - { - keyword: 'lorem.text', - delegate: { - type: 'faker', - target: 'lorem.text', - }, - help: { - summary: 'Generates a random text based on a random lorem method.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: '', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'lorem.word', - delegate: { - type: 'faker', - target: 'lorem.word', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a word of a specified length.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: 'cumque', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum word length when generating a ranged length.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum word length when generating a ranged length.', - }, - { - name: 'length', - type: 'number', - required: false, - description: 'Exact word length to generate.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'lorem.words', - delegate: { - type: 'faker', - target: 'lorem.words', - }, - help: { - summary: 'Generates a space separated list of words.', - docsUrl: 'https://fakerjs.dev/api/lorem', - example: 'desidero conforto decimus', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'wordCount', - type: 'number', - required: false, - description: 'Number of words to generate.', - }, - { - name: 'wordCountMax', - type: 'number', - required: false, - description: 'The maximum number of words to generate.', - }, - { - name: 'wordCountMin', - type: 'number', - required: false, - description: 'The minimum number of words to generate.', - }, - ], - }, - }, - { - keyword: 'music.album', - delegate: { - type: 'faker', - target: 'music.album', - }, - help: { - summary: 'Returns a random album name.', - docsUrl: 'https://fakerjs.dev/api/music', - example: 'R&G (Rhythm & Gangsta): The Masterpiece', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'music.artist', - delegate: { - type: 'faker', - target: 'music.artist', - }, - help: { - summary: 'Returns a random artist name.', - docsUrl: 'https://fakerjs.dev/api/music', - example: 'Chuck Berry', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'music.genre', - delegate: { - type: 'faker', - target: 'music.genre', - }, - help: { - summary: 'Returns a random music genre.', - docsUrl: 'https://fakerjs.dev/api/music', - example: 'Mainstream Jazz', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'music.songName', - delegate: { - type: 'faker', - target: 'music.songName', - }, - help: { - summary: 'Returns a random song name.', - docsUrl: 'https://fakerjs.dev/api/music', - example: "I'm Sorry", - returnType: 'string', - args: [], - }, - }, - { - keyword: 'number.bigInt', - delegate: { - type: 'faker', - target: 'number.bigInt', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a BigInt number.', - docsUrl: 'https://fakerjs.dev/api/number', - example: '347465151663036', - returnType: 'integer', - args: [ - { - name: 'value', - type: 'bigint|number|string|boolean', - required: false, - description: - 'Base value used for generation. Supports bigint, number, string, or boolean inputs. For range constraints use min, max, and multipleOf.', - }, - ], - }, - }, - { - keyword: 'number.binary', - delegate: { - type: 'faker', - target: 'number.binary', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a binary string.', - docsUrl: 'https://fakerjs.dev/api/number', - example: '0', - returnType: 'string', - args: [ - { - name: 'max', - type: 'number', - required: false, - description: 'Upper bound for generated number.', - }, - { - name: 'min', - type: 'number', - required: false, - description: 'Lower bound for generated number.', - }, - ], - }, - }, - { - keyword: 'number.float', - delegate: { - type: 'faker', - target: 'number.float', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: - 'Returns a single random floating-point number, by default between `0.0` and `1.0`. To change the range, pass a `min` and `max` value. To limit the number of decimal places, pass a `multipleOf` or `fractionDigits` parameter.', - docsUrl: 'https://fakerjs.dev/api/number', - example: '0.5433707701438405', - returnType: 'number', - args: [ - { - name: 'value', - type: 'number', - required: false, - description: - 'Legacy placeholder argument from Faker signatures; currently has no effect. Use the documented options instead.', - }, - { - name: 'fractionDigits', - type: 'number', - required: false, - description: - 'The maximum number of digits to appear after the decimal point, for example 2 will round to 2 decimal points. Only one of multipleOf or fractionDigits should be passed.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Upper bound for generated number, exclusive, unless multipleOf or fractionDigits are passed.', - }, - { - name: 'min', - type: 'number', - required: false, - description: 'Lower bound for generated number, inclusive.', - }, - { - name: 'multipleOf', - type: 'number', - required: false, - description: - 'The generated number will be a multiple of this parameter. Only one of multipleOf or fractionDigits should be passed.', - }, - ], - }, - }, - { - keyword: 'number.hex', - delegate: { - type: 'faker', - target: 'number.hex', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a lowercase hexadecimal number.', - docsUrl: 'https://fakerjs.dev/api/number', - example: 'd', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: - 'Legacy placeholder argument from Faker signatures; currently has no effect. Use the documented options instead.', - }, - ], - }, - }, - { - keyword: 'number.int', - delegate: { - type: 'faker', - target: 'number.int', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a single random integer between zero and the given max value or the given range.', - docsUrl: 'https://fakerjs.dev/api/number', - example: '5190574431878510', - returnType: 'integer', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Optional minimum integer.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Optional maximum integer.', - }, - { - name: 'multipleOf', - type: 'number', - required: false, - description: 'Generated number will be a multiple of the given integer.', - }, - ], - }, - }, - { - keyword: 'number.octal', - delegate: { - type: 'faker', - target: 'number.octal', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns an octal string.', - docsUrl: 'https://fakerjs.dev/api/number', - example: '6', - returnType: 'string', - args: [ - { - name: 'max', - type: 'number', - required: false, - description: 'Upper bound for generated number.', - }, - { - name: 'min', - type: 'number', - required: false, - description: 'Lower bound for generated number.', - }, - ], - }, - }, - { - keyword: 'number.romanNumeral', - delegate: { - type: 'faker', - target: 'number.romanNumeral', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a roman numeral in String format.', - docsUrl: 'https://fakerjs.dev/api/number', - example: 'XXXV', - returnType: 'string', - args: [ - { - name: 'min', - type: 'number', - required: false, - description: 'Minimum bound used when generating a value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: - 'Legacy placeholder argument from Faker signatures; currently has no effect. Use the documented options instead.', - }, - ], - }, - }, - { - keyword: 'person.bio', - delegate: { - type: 'faker', - target: 'person.bio', - }, - help: { - summary: 'Returns a random short biography', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'musician', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.firstName', - delegate: { - type: 'faker', - target: 'person.firstName', - }, - help: { - summary: 'Returns a random first name.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Amelie', - returnType: 'string', - args: [ - { - name: 'sex', - type: 'string', - required: false, - description: 'Optional sex for first-name selection. Valid values: female or male.', - }, - ], - }, - }, - { - keyword: 'person.fullName', - delegate: { - type: 'faker', - target: 'person.fullName', - }, - help: { - summary: 'Generates a random full name.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Mrs. Sheryl Zemlak DVM', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.gender', - delegate: { - type: 'faker', - target: 'person.gender', - }, - help: { - summary: 'Returns a random gender.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Female to male', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.jobArea', - delegate: { - type: 'faker', - target: 'person.jobArea', - }, - help: { - summary: 'Generates a random job area.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Branding', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.jobDescriptor', - delegate: { - type: 'faker', - target: 'person.jobDescriptor', - }, - help: { - summary: 'Generates a random job descriptor.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Direct', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.jobTitle', - delegate: { - type: 'faker', - target: 'person.jobTitle', - }, - help: { - summary: 'Generates a random job title.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Senior Identity Technician', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.jobType', - delegate: { - type: 'faker', - target: 'person.jobType', - }, - help: { - summary: 'Generates a random job type.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Engineer', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.lastName', - delegate: { - type: 'faker', - target: 'person.lastName', - }, - help: { - summary: 'Returns a random last name.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Bernhard', - returnType: 'string', - args: [ - { - name: 'sex', - type: 'string', - required: false, - description: 'Optional sex for last-name selection. Valid values: female or male.', - }, - ], - }, - }, - { - keyword: 'person.middleName', - delegate: { - type: 'faker', - target: 'person.middleName', - }, - help: { - summary: 'Returns a random middle name.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Ryan', - returnType: 'string', - args: [ - { - name: 'sex', - type: 'string', - required: false, - description: 'Optional sex for middle-name selection. Valid values: female or male.', - }, - ], - }, - }, - { - keyword: 'person.prefix', - delegate: { - type: 'faker', - target: 'person.prefix', - }, - help: { - summary: 'Returns a random person prefix.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Miss', - returnType: 'string', - args: [ - { - name: 'sex', - type: 'string', - required: false, - description: "The optional sex to use. Can be either 'female' or 'male'.", - }, - ], - }, - }, - { - keyword: 'person.sex', - delegate: { - type: 'faker', - target: 'person.sex', - }, - help: { - summary: 'Returns a random sex.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'male', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.sexType', - delegate: { - type: 'faker', - target: 'person.sexType', - }, - help: { - summary: 'Returns a random sex type. The `SexType` is intended to be used in parameters and conditions.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'male', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.suffix', - delegate: { - type: 'faker', - target: 'person.suffix', - }, - help: { - summary: 'Returns a random person suffix.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'IV', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'person.zodiacSign', - delegate: { - type: 'faker', - target: 'person.zodiacSign', - }, - help: { - summary: 'Returns a random zodiac sign.', - docsUrl: 'https://fakerjs.dev/api/person', - example: 'Cancer', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'phone.imei', - delegate: { - type: 'faker', - target: 'phone.imei', - }, - help: { - summary: 'Generates IMEI number.', - docsUrl: 'https://fakerjs.dev/api/phone', - example: '44-358223-971834-1', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'phone.number', - delegate: { - type: 'faker', - target: 'phone.number', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a random phone number.', - docsUrl: 'https://fakerjs.dev/api/phone', - example: '298.756.9044', - returnType: 'string', - args: [ - { - name: 'style', - type: 'string', - required: false, - description: - "Style of the generated phone number: 'human': (default) A human-input phone number, e.g. 555-770-7727 or 555.770.7727 x1234 'national': A phone number in a standardized national format, e.g. (555) 123-4567. 'international': A phone number in the E.123 international format, e.g. +15551234567", - }, - ], - }, - }, - { - keyword: 'science.chemicalElement', - delegate: { - type: 'faker', - target: 'science.chemicalElement', - }, - help: { - summary: 'Generate a value using faker science.chemicalElement.', - docsUrl: 'https://fakerjs.dev/api/science', - example: '', - returnType: 'object', - args: [], - }, - }, - { - keyword: 'science.chemicalElement.atomicNumber', - delegate: { - type: 'faker', - target: 'science.chemicalElement', - resultPath: 'atomicNumber', - }, - help: { - summary: 'Generate a chemical element atomic number.', - docsUrl: 'https://fakerjs.dev/api/science', - example: '8', - returnType: 'integer', - args: [], - }, - }, - { - keyword: 'science.chemicalElement.name', - delegate: { - type: 'faker', - target: 'science.chemicalElement', - resultPath: 'name', - }, - help: { - summary: 'Generate a chemical element name.', - docsUrl: 'https://fakerjs.dev/api/science', - example: 'Oxygen', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'science.chemicalElement.symbol', - delegate: { - type: 'faker', - target: 'science.chemicalElement', - resultPath: 'symbol', - }, - help: { - summary: 'Generate a chemical element symbol.', - docsUrl: 'https://fakerjs.dev/api/science', - example: 'O', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'science.unit', - delegate: { - type: 'faker', - target: 'science.unit', - }, - help: { - summary: 'Returns a random scientific unit.', - docsUrl: 'https://fakerjs.dev/api/science', - example: '{"name":"farad","symbol":"F"}', - returnType: 'object', - args: [], - }, - }, - { - keyword: 'string.alpha', - delegate: { - type: 'faker', - target: 'string.alpha', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generating a string consisting of letters in the English alphabet.', - docsUrl: 'https://fakerjs.dev/api/string', - example: 'R', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'casing', - type: 'string', - required: false, - description: 'The casing of the characters.', - }, - { - name: 'exclude', - type: 'array', - required: false, - description: 'An array with characters which should be excluded in the generated string.', - }, - ], - }, - }, - { - keyword: 'string.alphanumeric', - delegate: { - type: 'faker', - target: 'string.alphanumeric', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generating a string consisting of alpha characters and digits.', - docsUrl: 'https://fakerjs.dev/api/string', - example: 's', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'casing', - type: 'string', - required: false, - description: 'The casing of the characters.', - }, - { - name: 'exclude', - type: 'array', - required: false, - description: 'An array of characters and digits which should be excluded in the generated string.', - }, - ], - }, - }, - { - keyword: 'string.binary', - delegate: { - type: 'faker', - target: 'string.binary', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a binary string.', - docsUrl: 'https://fakerjs.dev/api/string', - example: '0b0', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: - 'The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.', - }, - { - name: 'prefix', - type: 'string', - required: false, - description: 'Prefix for the generated number.', - }, - ], - }, - }, - { - keyword: 'string.fromCharacters', - delegate: { - type: 'faker', - target: 'string.fromCharacters', - }, - help: { - summary: 'Generates a string from the given characters.', - docsUrl: 'https://fakerjs.dev/api/string', - example: '', - returnType: 'string', - args: [ - { - name: 'characters', - type: 'string|array', - required: true, - description: 'Character set (string or array) used when generating output.', - }, - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - ], - }, - }, - { - keyword: 'string.hexadecimal', - delegate: { - type: 'faker', - target: 'string.hexadecimal', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a hexadecimal string.', - docsUrl: 'https://fakerjs.dev/api/string', - example: '0x1', - returnType: 'string', - args: [ - { - name: 'casing', - type: 'string', - required: false, - description: 'Casing of the generated number.', - }, - { - name: 'length', - type: 'number', - required: false, - description: - 'The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.', - }, - { - name: 'prefix', - type: 'string', - required: false, - description: 'Prefix for the generated number.', - }, - ], - }, - }, - { - keyword: 'string.nanoid', - delegate: { - type: 'faker', - target: 'string.nanoid', - }, - help: { - summary: 'Generates a Nano ID.', - docsUrl: 'https://fakerjs.dev/api/string', - example: 'KLm49ferlh-eUmJpZdSIO', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Exact number of characters to generate.', - }, - ], - }, - }, - { - keyword: 'string.numeric', - delegate: { - type: 'faker', - target: 'string.numeric', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Generates a given length string of digits.', - docsUrl: 'https://fakerjs.dev/api/string', - example: '7', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'allowLeadingZeros', - type: 'boolean', - required: false, - description: 'Whether leading zeros are allowed or not.', - }, - { - name: 'exclude', - type: 'array', - required: false, - description: 'An array of digits which should be excluded in the generated string.', - }, - ], - }, - }, - { - keyword: 'string.octal', - delegate: { - type: 'faker', - target: 'string.octal', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns an octal string.', - docsUrl: 'https://fakerjs.dev/api/string', - example: '0o6', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: - 'The length of the string (excluding the prefix) to generate either as a fixed length or as a length range.', - }, - { - name: 'prefix', - type: 'string', - required: false, - description: 'Prefix for the generated number.', - }, - ], - }, - }, - { - keyword: 'string.sample', - delegate: { - type: 'faker', - target: 'string.sample', - }, - help: { - summary: 'Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`).', - docsUrl: 'https://fakerjs.dev/api/string', - example: '\\Fw;0e:G.H', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Exact number of characters to generate.', - }, - ], - }, - }, - { - keyword: 'string.symbol', - delegate: { - type: 'faker', - target: 'string.symbol', - }, - help: { - summary: 'Returns a string containing only special characters from the following list:', - docsUrl: 'https://fakerjs.dev/api/string', - example: '.', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Exact number of characters to generate.', - }, - ], - }, - }, - { - keyword: 'string.ulid', - delegate: { - type: 'faker', - target: 'string.ulid', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a ULID (Universally Unique Lexicographically Sortable Identifier).', - docsUrl: 'https://fakerjs.dev/api/string', - example: '01KQADM2A0728G4D2HKCPWKS6N', - returnType: 'string', - args: [ - { - name: 'refDate', - type: 'number', - required: false, - description: - 'The date to use as reference point for the newly generated ULID encoded timestamp. The encoded timestamp is represented by the first 10 characters of the result.', - }, - ], - }, - }, - { - keyword: 'string.uuid', - delegate: { - type: 'faker', - target: 'string.uuid', - }, - help: { - summary: 'Returns a UUID v4 (Universally Unique Identifier).', - docsUrl: 'https://fakerjs.dev/api/string', - example: '0628ae51-7b6c-4d33-9f24-dae19fb245df', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.commonFileExt', - delegate: { - type: 'faker', - target: 'system.commonFileExt', - }, - help: { - summary: 'Returns a commonly used file extension.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'pdf', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.commonFileName', - delegate: { - type: 'faker', - target: 'system.commonFileName', - }, - help: { - summary: 'Returns a random file name with a given extension or a commonly used extension.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'bleak.pdf', - returnType: 'string', - args: [ - { - name: 'extension', - type: 'string', - required: false, - description: 'File extension to include in the generated filename.', - }, - ], - }, - }, - { - keyword: 'system.commonFileType', - delegate: { - type: 'faker', - target: 'system.commonFileType', - }, - help: { - summary: 'Returns a commonly used file type.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'video', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.cron', - delegate: { - type: 'faker', - target: 'system.cron', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random cron expression.', - docsUrl: 'https://fakerjs.dev/api/system', - example: '* 15 * * SAT', - returnType: 'string', - args: [ - { - name: 'includeNonStandard', - type: 'boolean', - required: false, - description: 'Whether to include a @yearly, @monthly, @daily, etc text labels in the generated expression.', - }, - { - name: 'includeYear', - type: 'boolean', - required: false, - description: 'Whether to include a year in the generated expression.', - }, - ], - }, - }, - { - keyword: 'system.directoryPath', - delegate: { - type: 'faker', - target: 'system.directoryPath', - }, - help: { - summary: 'Returns a directory path.', - docsUrl: 'https://fakerjs.dev/api/system', - example: '/bin', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.fileExt', - delegate: { - type: 'faker', - target: 'system.fileExt', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a file extension.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'xsl', - returnType: 'string', - args: [ - { - name: 'mimeType', - type: 'string', - required: false, - description: 'MIME type used to constrain generated values.', - }, - ], - }, - }, - { - keyword: 'system.fileName', - delegate: { - type: 'faker', - target: 'system.fileName', - }, - help: { - summary: 'Returns a random file name with extension.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'unsightly.woff', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.filePath', - delegate: { - type: 'faker', - target: 'system.filePath', - }, - help: { - summary: 'Returns a file path.', - docsUrl: 'https://fakerjs.dev/api/system', - example: '/tmp/ouch.xlt', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.fileType', - delegate: { - type: 'faker', - target: 'system.fileType', - }, - help: { - summary: 'Returns a file type.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'font', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.mimeType', - delegate: { - type: 'faker', - target: 'system.mimeType', - }, - help: { - summary: 'Returns a mime-type.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'application/gzip', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.networkInterface', - delegate: { - type: 'faker', - target: 'system.networkInterface', - }, - help: { - summary: 'Returns a random network interface.', - docsUrl: 'https://fakerjs.dev/api/system', - example: 'wlx3fba717f9f9c', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'system.semver', - delegate: { - type: 'faker', - target: 'system.semver', - }, - help: { - summary: 'Returns a semantic version.', - docsUrl: 'https://fakerjs.dev/api/system', - example: '4.3.6', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.bicycle', - delegate: { - type: 'faker', - target: 'vehicle.bicycle', - }, - help: { - summary: 'Returns a type of bicycle.', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'Touring Bicycle', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.color', - delegate: { - type: 'faker', - target: 'vehicle.color', - }, - help: { - summary: 'Returns a vehicle color.', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'sky blue', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.fuel', - delegate: { - type: 'faker', - target: 'vehicle.fuel', - }, - help: { - summary: 'Returns a fuel type.', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'Gasoline', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.manufacturer', - delegate: { - type: 'faker', - target: 'vehicle.manufacturer', - }, - help: { - summary: 'Returns a manufacturer name.', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'Hyundai', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.model', - delegate: { - type: 'faker', - target: 'vehicle.model', - }, - help: { - summary: 'Returns a vehicle model.', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'Aventador', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.type', - delegate: { - type: 'faker', - target: 'vehicle.type', - }, - help: { - summary: 'Returns a vehicle type.', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'Hatchback', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.vehicle', - delegate: { - type: 'faker', - target: 'vehicle.vehicle', - }, - help: { - summary: 'Returns a random vehicle.', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'Ford CTS', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.vin', - delegate: { - type: 'faker', - target: 'vehicle.vin', - }, - help: { - summary: 'Returns a vehicle identification number (VIN).', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: '7SJ9N0LM3LM265056', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'vehicle.vrm', - delegate: { - type: 'faker', - target: 'vehicle.vrm', - }, - help: { - summary: 'Returns a vehicle registration number (Vehicle Registration Mark - VRM)', - docsUrl: 'https://fakerjs.dev/api/vehicle', - example: 'OD11RTZ', - returnType: 'string', - args: [], - }, - }, - { - keyword: 'word.adjective', - delegate: { - type: 'faker', - target: 'word.adjective', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random adjective.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'heavenly', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.adverb', - delegate: { - type: 'faker', - target: 'word.adverb', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random adverb.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'selfishly', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.conjunction', - delegate: { - type: 'faker', - target: 'word.conjunction', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random conjunction.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'indeed', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.interjection', - delegate: { - type: 'faker', - target: 'word.interjection', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random interjection.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'er', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.noun', - delegate: { - type: 'faker', - target: 'word.noun', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random noun.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'cook', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.preposition', - delegate: { - type: 'faker', - target: 'word.preposition', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random preposition.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'beside', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.sample', - delegate: { - type: 'faker', - target: 'word.sample', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: - 'Returns a random word, that can be an adjective, adverb, conjunction, interjection, noun, preposition, or verb.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'snoopy', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.verb', - delegate: { - type: 'faker', - target: 'word.verb', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random verb.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'embalm', - returnType: 'string', - args: [ - { - name: 'length', - type: 'number', - required: false, - description: 'Desired length of the generated value.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for target word length. Prefer the length option.', - }, - { - name: 'strategy', - type: 'string', - required: false, - description: - 'The strategy to apply when no words with a matching length are found. Available error handling strategies: fail: Throws an error if no words with the given length are found. shortest: Returns any of the shortest words. closest: Returns any of the words closest to the given length. longest: Returns any of the longest words. any-length: Returns a word with any length.', - }, - ], - }, - }, - { - keyword: 'word.words', - delegate: { - type: 'faker', - target: 'word.words', - argTransform: 'optionsFromHelpArgs', - }, - help: { - summary: 'Returns a random string containing some words separated by spaces.', - docsUrl: 'https://fakerjs.dev/api/word', - example: 'geez', - returnType: 'string', - args: [ - { - name: 'count', - type: 'number', - required: false, - description: 'Number of items to generate.', - }, - { - name: 'max', - type: 'number', - required: false, - description: 'Maximum bound used when generating a value.', - }, - { - name: 'value', - type: 'number', - required: false, - description: 'Legacy shorthand for number of words to generate. Prefer the count option.', - }, - ], - }, - }, + ...DOMAIN_FAKER_AIRLINE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_ANIMAL_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_BOOK_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_COLOR_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_COMMERCE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_COMPANY_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_DATABASE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_DATATYPE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_DATE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_FINANCE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_FOOD_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_GIT_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_HACKER_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_IMAGE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_INTERNET_KEYWORD_DEFINITIONS, + ...DOMAIN_CUSTOM_LITERAL_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_LOCATION_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_LOREM_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_MUSIC_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_NUMBER_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_PERSON_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_PHONE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_SCIENCE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_STRING_KEYWORD_DEFINITIONS, + ...DOMAIN_CUSTOM_STRING_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_SYSTEM_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_VEHICLE_KEYWORD_DEFINITIONS, + ...DOMAIN_FAKER_WORD_KEYWORD_DEFINITIONS, ]; export { DOMAIN_KEYWORD_DEFINITIONS }; diff --git a/packages/core/js/domain/domain-keywords.js b/packages/core/js/domain/domain-keywords.js index 3727f802..fa92f18c 100644 --- a/packages/core/js/domain/domain-keywords.js +++ b/packages/core/js/domain/domain-keywords.js @@ -1,4 +1,5 @@ import { DOMAIN_KEYWORD_DEFINITIONS } from './domain-keyword-definitions.js'; +import { executeCustomCounterString } from './counterstring.js'; const DOMAIN_ROOT_PREFIX = 'awd.domain.'; const DOMAIN_PREFIX = 'domain.'; @@ -56,6 +57,12 @@ function buildDomainKeywordCatalog(definitions = DOMAIN_KEYWORD_DEFINITIONS) { summary: String(definition?.help?.summary || '').trim(), docsUrl: String(definition?.help?.docsUrl || '').trim(), example: String(definition?.help?.example || '').trim(), + examples: Array.isArray(definition?.help?.examples) + ? definition.help.examples.map((example) => String(example || '').trim()).filter(Boolean) + : [], + exampleReturnValues: Array.isArray(definition?.help?.exampleReturnValues) + ? definition.help.exampleReturnValues.map((value) => String(value || '').trim()).filter(Boolean) + : [], returnType: String(definition?.help?.returnType || '').trim(), args: Array.isArray(definition?.help?.args) ? definition.help.args.map((arg) => ({ @@ -167,6 +174,7 @@ function isTypeMatch(value, typeName) { if (item === 'number' && typeof value === 'number' && Number.isFinite(value)) return true; if (item === 'boolean' && typeof value === 'boolean') return true; if (item === 'array' && Array.isArray(value)) return true; + if (item === 'object' && value !== null && typeof value === 'object' && !Array.isArray(value)) return true; } return false; } @@ -198,6 +206,14 @@ function applyFakerArgTransform(keyword, args = []) { return args; } +const BUILT_IN_CUSTOM_DELEGATES = { + 'literal.value': (executionContext = {}) => { + const args = Array.isArray(executionContext.args) ? executionContext.args : []; + return typeof args[0] === 'undefined' ? '' : args[0]; + }, + 'string.counterString': executeCustomCounterString, +}; + function validateDomainKeywordArgs(keyword, args = []) { const argumentList = Array.isArray(args) ? args : []; const schema = Array.isArray(keyword?.help?.args) ? keyword.help.args : []; @@ -252,7 +268,10 @@ function executeDomainKeyword(aliasOrCanonical, executionContext = {}, index = D } if (keyword.delegate.type === DELEGATE_TYPE_CUSTOM) { - const customDelegates = executionContext.customDelegates || {}; + const customDelegates = { + ...BUILT_IN_CUSTOM_DELEGATES, + ...(executionContext.customDelegates || {}), + }; const customFn = customDelegates[keyword.delegate.target]; if (typeof customFn !== 'function') { throw new Error(`Unknown custom delegate target: ${keyword.delegate.target}`); diff --git a/packages/core/js/domain/parser/DomainKeywordInvocationParser.js b/packages/core/js/domain/parser/DomainKeywordInvocationParser.js index 18072948..b9ad2a74 100644 --- a/packages/core/js/domain/parser/DomainKeywordInvocationParser.js +++ b/packages/core/js/domain/parser/DomainKeywordInvocationParser.js @@ -126,6 +126,9 @@ class DomainKeywordInvocationParser { if (token.type === 'LBRACKET') { return this.parseArray(stream); } + if (token.type === 'LBRACE') { + return this.parseObject(stream); + } if (token.type === 'RPAREN' || token.type === 'COMMA' || token.type === 'EOF' || token.type === 'RBRACKET') { return { ok: false, error: 'Invalid keyword arguments: unbalanced expression' }; @@ -170,6 +173,51 @@ class DomainKeywordInvocationParser { } } + parseObject(stream) { + if (!stream.match('LBRACE')) { + return { ok: false, error: 'Invalid keyword arguments: unbalanced expression' }; + } + + const value = Object.create(null); + + if (stream.match('RBRACE')) { + return { ok: true, value }; + } + + while (true) { + const keyToken = stream.peek(); + if (keyToken.type !== 'STRING' && keyToken.type !== 'IDENT') { + return { ok: false, error: 'Invalid keyword arguments: unbalanced expression' }; + } + const key = String(stream.consume().value); + if (key === '__proto__' || key === 'constructor' || key === 'prototype') { + return { ok: false, error: `Invalid keyword arguments: unsafe object key "${key}" is not allowed` }; + } + + if (!stream.match('COLON')) { + return { ok: false, error: 'Invalid keyword arguments: unbalanced expression' }; + } + + const parsedValue = this.parseValue(stream); + if (!parsedValue.ok) { + return parsedValue; + } + value[key] = parsedValue.value; + + if (stream.match('RBRACE')) { + return { ok: true, value }; + } + + if (!stream.match('COMMA')) { + return { ok: false, error: 'Invalid keyword arguments: unbalanced expression' }; + } + + if (stream.peek().type === 'RBRACE' || stream.peek().type === 'EOF') { + return { ok: false, error: 'Invalid keyword arguments: missing argument after comma' }; + } + } + } + hasToken(stream, type) { let offset = 0; while (stream.peek(offset).type !== 'EOF') { diff --git a/packages/core/js/domain/parser/DomainKeywordLexer.js b/packages/core/js/domain/parser/DomainKeywordLexer.js index b7ac5e45..4eef444f 100644 --- a/packages/core/js/domain/parser/DomainKeywordLexer.js +++ b/packages/core/js/domain/parser/DomainKeywordLexer.js @@ -27,16 +27,31 @@ class DomainKeywordLexer { index += 1; continue; } + if (ch === '{') { + tokens.push(this.token('LBRACE', ch, index, index + 1)); + index += 1; + continue; + } if (ch === ']') { tokens.push(this.token('RBRACKET', ch, index, index + 1)); index += 1; continue; } + if (ch === '}') { + tokens.push(this.token('RBRACE', ch, index, index + 1)); + index += 1; + continue; + } if (ch === ',') { tokens.push(this.token('COMMA', ch, index, index + 1)); index += 1; continue; } + if (ch === ':') { + tokens.push(this.token('COLON', ch, index, index + 1)); + index += 1; + continue; + } if (ch === '=') { tokens.push(this.token('EQUALS', ch, index, index + 1)); index += 1; @@ -161,7 +176,18 @@ class DomainKeywordLexer { } isDelimiter(ch) { - return this.isWhitespace(ch) || ch === '(' || ch === ')' || ch === '[' || ch === ']' || ch === ',' || ch === '='; + return ( + this.isWhitespace(ch) || + ch === '(' || + ch === ')' || + ch === '[' || + ch === ']' || + ch === '{' || + ch === '}' || + ch === ',' || + ch === ':' || + ch === '=' + ); } isEndOrDelimiter(ch) { diff --git a/packages/core/js/domain/parser/DomainKeywordParser.js b/packages/core/js/domain/parser/DomainKeywordParser.js index 6416f508..4922453f 100644 --- a/packages/core/js/domain/parser/DomainKeywordParser.js +++ b/packages/core/js/domain/parser/DomainKeywordParser.js @@ -37,6 +37,7 @@ class DomainKeywordParser { mapParsedArguments(argumentsList, keywordMetadata) { const schema = Array.isArray(keywordMetadata?.help?.args) ? keywordMetadata.help.args : []; + const usesOptionsFromHelpArgs = keywordMetadata?.delegate?.argTransform === 'optionsFromHelpArgs'; const positional = []; const named = {}; let seenNamed = false; @@ -61,6 +62,29 @@ class DomainKeywordParser { positional.push(item.value); } + if ( + keywordMetadata && + usesOptionsFromHelpArgs && + positional.length === 1 && + Object.keys(named).length === 0 && + positional[0] && + typeof positional[0] === 'object' && + !Array.isArray(positional[0]) + ) { + const providedObject = positional[0]; + const schemaByName = new Map(schema.map((entry, index) => [entry.name, index])); + const resolved = new Array(schema.length); + + for (const [name, value] of Object.entries(providedObject)) { + if (!schemaByName.has(name)) { + return { ok: false, error: `Invalid keyword arguments: unknown named argument "${name}"` }; + } + resolved[schemaByName.get(name)] = value; + } + + return { ok: true, args: resolved }; + } + if (keywordMetadata && positional.length > schema.length) { return { ok: false, diff --git a/packages/core/src/tests/data_generation/enum-compiler-integration.test.js b/packages/core/src/tests/data_generation/enum-compiler-integration.test.js index f1825696..f1e3b166 100644 --- a/packages/core/src/tests/data_generation/enum-compiler-integration.test.js +++ b/packages/core/src/tests/data_generation/enum-compiler-integration.test.js @@ -84,53 +84,4 @@ describe('TestDataRulesCompiler with Enum Support', () => { expect(compiler.isValid()).toBe(true); }); }); - - describe('mixed rule types', () => { - test('correctly identifies different types in one compilation', () => { - const rules = [ - new TestDataRule('Enum', 'Red,Blue,Green'), - new TestDataRule('Faker', 'person.firstName'), - new TestDataRule('Regex', '[A-Z]{3}'), - new TestDataRule('LiteralValue', 'FixedValue'), - new TestDataRule('AwdEnum', 'enum("A", "B")'), - ]; - - compiler.compile(rules); - - expect(rules[0].type).toBe('enum'); - expect(rules[1].type).toBe('domain'); - expect(rules[2].type).toBe('regex'); - expect(rules[3].type).toBe('regex'); // Simple text is valid regex - expect(rules[4].type).toBe('enum'); - }); - }); - - describe('literal pattern detection', () => { - test('detects explicit literal formats', () => { - expect(compiler.isLiteralPattern('literal(.)')).toBe(true); - expect(compiler.isLiteralPattern('datatype.literal(1,2,3)')).toBe(true); - expect(compiler.isLiteralPattern('awd.datatype.literal(value)')).toBe(true); - }); - - test('explicit literal compiles to literal type and unwraps value', () => { - const rules = [new TestDataRule('DotLiteral', 'literal(.)')]; - compiler.compile(rules); - expect(rules[0].type).toBe('literal'); - expect(rules[0].ruleSpec).toBe('.'); - }); - - test('explicit empty literal compiles to literal empty string', () => { - const rules = [new TestDataRule('EmptyLiteral', 'literal()')]; - compiler.compile(rules); - expect(rules[0].type).toBe('literal'); - expect(rules[0].ruleSpec).toBe(''); - }); - - test('explicit whitespace literal compiles to literal whitespace', () => { - const rules = [new TestDataRule('SpaceLiteral', 'literal( )')]; - compiler.compile(rules); - expect(rules[0].type).toBe('literal'); - expect(rules[0].ruleSpec).toBe(' '); - }); - }); }); diff --git a/packages/core/src/tests/data_generation/literal-compiler-integration.test.js b/packages/core/src/tests/data_generation/literal-compiler-integration.test.js new file mode 100644 index 00000000..21ab5c3c --- /dev/null +++ b/packages/core/src/tests/data_generation/literal-compiler-integration.test.js @@ -0,0 +1,39 @@ +import { TestDataRulesCompiler } from '../../../js/data_generation/testDataRulesCompiler.js'; +import { TestDataRule } from '../../../js/data_generation/testDataRule.js'; +import { faker } from '@faker-js/faker'; +import RandExp from 'randexp'; + +describe('TestDataRulesCompiler literal pattern detection', () => { + let compiler; + + beforeEach(() => { + compiler = new TestDataRulesCompiler(faker, RandExp); + }); + + test('detects explicit literal formats', () => { + expect(compiler.isLiteralPattern('literal(.)')).toBe(true); + expect(compiler.isLiteralPattern('datatype.literal(1,2,3)')).toBe(true); + expect(compiler.isLiteralPattern('awd.datatype.literal(value)')).toBe(true); + }); + + test('explicit literal compiles to literal type and unwraps value', () => { + const rules = [new TestDataRule('DotLiteral', 'literal(.)')]; + compiler.compile(rules); + expect(rules[0].type).toBe('literal'); + expect(rules[0].ruleSpec).toBe('.'); + }); + + test('explicit empty literal compiles to literal empty string', () => { + const rules = [new TestDataRule('EmptyLiteral', 'literal("")')]; + compiler.compile(rules); + expect(rules[0].type).toBe('literal'); + expect(rules[0].ruleSpec).toBe(''); + }); + + test('explicit whitespace literal compiles to literal whitespace', () => { + const rules = [new TestDataRule('SpaceLiteral', 'literal( )')]; + compiler.compile(rules); + expect(rules[0].type).toBe('literal'); + expect(rules[0].ruleSpec).toBe(' '); + }); +}); diff --git a/packages/core/src/tests/data_generation/mixed-compiler-integration.test.js b/packages/core/src/tests/data_generation/mixed-compiler-integration.test.js new file mode 100644 index 00000000..db500750 --- /dev/null +++ b/packages/core/src/tests/data_generation/mixed-compiler-integration.test.js @@ -0,0 +1,25 @@ +import { TestDataRulesCompiler } from '../../../js/data_generation/testDataRulesCompiler.js'; +import { TestDataRule } from '../../../js/data_generation/testDataRule.js'; +import { faker } from '@faker-js/faker'; +import RandExp from 'randexp'; + +describe('TestDataRulesCompiler mixed rule types', () => { + test('correctly identifies different types in one compilation', () => { + const compiler = new TestDataRulesCompiler(faker, RandExp); + const rules = [ + new TestDataRule('Enum', 'Red,Blue,Green'), + new TestDataRule('Faker', 'person.firstName'), + new TestDataRule('Regex', '[A-Z]{3}'), + new TestDataRule('LiteralValue', 'FixedValue'), + new TestDataRule('AwdEnum', 'enum("A", "B")'), + ]; + + compiler.compile(rules); + + expect(rules[0].type).toBe('enum'); + expect(rules[1].type).toBe('domain'); + expect(rules[2].type).toBe('regex'); + expect(rules[3].type).toBe('regex'); + expect(rules[4].type).toBe('enum'); + }); +}); diff --git a/packages/core/src/tests/data_generation/regex-compiler-integration.test.js b/packages/core/src/tests/data_generation/regex-compiler-integration.test.js new file mode 100644 index 00000000..7860854a --- /dev/null +++ b/packages/core/src/tests/data_generation/regex-compiler-integration.test.js @@ -0,0 +1,25 @@ +import { TestDataRulesCompiler } from '../../../js/data_generation/testDataRulesCompiler.js'; +import { TestDataRule } from '../../../js/data_generation/testDataRule.js'; +import { faker } from '@faker-js/faker'; +import RandExp from 'randexp'; + +describe('TestDataRulesCompiler regex pattern detection', () => { + let compiler; + + beforeEach(() => { + compiler = new TestDataRulesCompiler(faker, RandExp); + }); + + test('detects explicit regex formats', () => { + expect(compiler.isRegexPattern('regex([A-Z]{3})')).toBe(true); + expect(compiler.isRegexPattern('datatype.regex(\\d{2})')).toBe(true); + expect(compiler.isRegexPattern('awd.datatype.regex(value)')).toBe(true); + }); + + test('explicit empty regex compiles to regex empty string', () => { + const rules = [new TestDataRule('EmptyRegex', 'regex("")')]; + compiler.compile(rules); + expect(rules[0].type).toBe('regex'); + expect(rules[0].ruleSpec).toBe(''); + }); +}); diff --git a/packages/core/src/tests/data_generation/schema-rules-adapter.test.js b/packages/core/src/tests/data_generation/schema-rules-adapter.test.js index de466504..1c36f7e9 100644 --- a/packages/core/src/tests/data_generation/schema-rules-adapter.test.js +++ b/packages/core/src/tests/data_generation/schema-rules-adapter.test.js @@ -31,7 +31,7 @@ describe('schema rules adapter', () => { expect(result.errors).toHaveLength(1); expect(result.errors[0].code).toBe('missing_rule_definition'); expect(result.errors[0].column).toBe('t1'); - expect(result.errors[0].message).toBe("column t1 requires a data definition, use 'literal()' for blank data"); + expect(result.errors[0].message).toBe('column t1 requires a data definition, use \'literal("")\' for blank data'); }); test('returns invalid schema pairing for comment-only schema text', () => { @@ -52,13 +52,13 @@ describe('schema rules adapter', () => { test('renders data rules to schema text preserving blank literal wrapper', () => { const rendered = dataRulesToSchemaText({ dataRules: [ - { name: 't1', ruleSpec: 'literal()', comments: '' }, + { name: 't1', ruleSpec: 'literal("")', comments: '' }, { name: 't2', ruleSpec: 'literal( 123)', comments: '' }, ], }); expect(rendered.errors).toEqual([]); - expect(rendered.text).toBe('t1\nliteral()\nt2\nliteral( 123)'); + expect(rendered.text).toBe('t1\nliteral("")\nt2\nliteral( 123)'); }); test('prefers schema tokens when rendering so blank lines are preserved', () => { @@ -148,12 +148,21 @@ describe('schema rules adapter', () => { expect(result.dataRules).toEqual([{ name: 'A', ruleSpec: 'number.int(1,10)', comments: '', type: 'domain' }]); }); - test('converts empty literal schema row value to literal()', () => { + test('converts empty literal schema row value to literal("")', () => { const result = schemaRowsToDataRules({ schemaRows: [{ name: 'A', sourceType: 'literal', value: ' ' }], }); expect(result.errors).toEqual([]); - expect(result.dataRules).toEqual([{ name: 'A', ruleSpec: 'literal()', comments: '', type: 'literal' }]); + expect(result.dataRules).toEqual([{ name: 'A', ruleSpec: 'literal("")', comments: '', type: 'literal' }]); + }); + + test('converts empty regex schema row value to regex("")', () => { + const result = schemaRowsToDataRules({ + schemaRows: [{ name: 'A', sourceType: 'regex', value: ' ' }], + }); + + expect(result.errors).toEqual([]); + expect(result.dataRules).toEqual([{ name: 'A', ruleSpec: 'regex("")', comments: '', type: 'regex' }]); }); }); diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-datatype-exec.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-datatype-exec.test.js index 3ad58ba3..11538580 100644 --- a/packages/core/src/tests/data_generation/unit/domain/domain-datatype-exec.test.js +++ b/packages/core/src/tests/data_generation/unit/domain/domain-datatype-exec.test.js @@ -1,5 +1,6 @@ import { Faker, en } from '@faker-js/faker'; import { executeDomainKeyword } from '../../../../../js/domain/domain-keywords.js'; +import { parseKeywordInvocation } from '../../../../../js/domain/domain-keyword-parser.js'; describe('datatype domain keyword execution', () => { let faker; @@ -27,4 +28,22 @@ describe('datatype domain keyword execution', () => { expect(seen.has(true)).toBe(true); expect(seen.has(false)).toBe(true); }); + + test('executes datatype.boolean with named probability=1 and returns true', () => { + const parsed = parseKeywordInvocation('datatype.boolean(probability=1)'); + expect(parsed.errors).toEqual([]); + + const result = executeDomainKeyword(parsed.keyword, { faker, args: parsed.args }); + expect(result).toBe(true); + expect(typeof result).toBe('boolean'); + }); + + test('executes datatype.boolean with named probability=0 and returns false', () => { + const parsed = parseKeywordInvocation('datatype.boolean(probability=0)'); + expect(parsed.errors).toEqual([]); + + const result = executeDomainKeyword(parsed.keyword, { faker, args: parsed.args }); + expect(result).toBe(false); + expect(typeof result).toBe('boolean'); + }); }); diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-doc-generator-output.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-doc-generator-output.test.js new file mode 100644 index 00000000..e77fd838 --- /dev/null +++ b/packages/core/src/tests/data_generation/unit/domain/domain-doc-generator-output.test.js @@ -0,0 +1,26 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { execSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; + +const testDir = path.dirname(fileURLToPath(import.meta.url)); +const repoRoot = path.resolve(testDir, '../../../../../../..'); + +describe('domain docs generator output', () => { + test('renders JSON example return values as literal inline code (no HTML brace entities)', () => { + execSync('node scripts/generate-domain-docs.mjs', { + cwd: repoRoot, + stdio: 'pipe', + encoding: 'utf8', + }); + + const docsDir = path.resolve(repoRoot, 'docs-src/docs/040-test-data/domain'); + const locationDocName = fs.readdirSync(docsDir).find((name) => /-location\.md$/.test(name)); + expect(locationDocName).toBeDefined(); + + const locationDoc = fs.readFileSync(path.join(docsDir, locationDocName), 'utf8'); + + expect(locationDoc).toContain('- `{"name":"Icelandic","alpha2":"is","alpha3":"isl"}`'); + expect(locationDoc).not.toContain('{"name":"Icelandic","alpha2":"is","alpha3":"isl"}'); + }); +}); diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-doc-inline-code-format.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-doc-inline-code-format.test.js new file mode 100644 index 00000000..6825ab65 --- /dev/null +++ b/packages/core/src/tests/data_generation/unit/domain/domain-doc-inline-code-format.test.js @@ -0,0 +1,16 @@ +import { toInlineCode } from '../../../../../js/domain/domain-doc-markdown.js'; + +describe('domain docs inline return value formatting', () => { + test('escapes return values containing backticks with a longer code fence', () => { + expect(toInlineCode('value with `tick` and ``double``')).toBe('```value with `tick` and ``double`````'); + }); + + test('escapes newline and CRLF characters in inline code values', () => { + expect(toInlineCode('line1\nline2')).toBe('`line1\\nline2`'); + expect(toInlineCode('line1\r\nline2\rline3')).toBe('`line1\\nline2\\nline3`'); + }); + + test('handles mixed backticks and newlines safely', () => { + expect(toInlineCode('start`\nmid``\r\nend')).toBe('```start`\\nmid``\\nend```'); + }); +}); diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-internet-exec.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-internet-exec.test.js index 818e5916..d3c164c3 100644 --- a/packages/core/src/tests/data_generation/unit/domain/domain-internet-exec.test.js +++ b/packages/core/src/tests/data_generation/unit/domain/domain-internet-exec.test.js @@ -1,7 +1,14 @@ import { faker } from '@faker-js/faker'; import { executeDomainKeyword } from '../../../../../js/domain/domain-keywords.js'; +import { parseKeywordInvocation } from '../../../../../js/domain/domain-keyword-parser.js'; import { expectMeaningfulString } from './domain-assertions.test-helper.js'; +function decodeJwtPart(part) { + const normalized = part.replace(/-/g, '+').replace(/_/g, '/'); + const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4); + return JSON.parse(Buffer.from(padded, 'base64').toString('utf8')); +} + describe('internet domain keyword execution', () => { test('executes internet.color', () => { const result = executeDomainKeyword('internet.color', { faker, args: [] }); @@ -87,6 +94,40 @@ describe('internet domain keyword execution', () => { const result = executeDomainKeyword('internet.jwt', { faker, args: [] }); console.log('internet.jwt', result); expectMeaningfulString(result); + expect(result.split('.')).toHaveLength(3); + }); + + test('internet.jwt accepts positional header/payload/refDate object args', () => { + const header = { alg: 'HS256', typ: 'JWT' }; + const payload = { iss: 'Acme', sub: 'user-123' }; + const refDate = 1; + const result = executeDomainKeyword('internet.jwt', { faker, args: [header, payload, refDate] }); + + const [encodedHeader, encodedPayload] = result.split('.'); + const decodedHeader = decodeJwtPart(encodedHeader); + const decodedPayload = decodeJwtPart(encodedPayload); + + expect(decodedHeader.alg).toBe('HS256'); + expect(decodedHeader.typ).toBe('JWT'); + expect(decodedPayload.iss).toBe('Acme'); + expect(decodedPayload.sub).toBe('user-123'); + }); + + test('internet.jwt accepts named header/payload/refDate object args', () => { + const parsed = parseKeywordInvocation( + 'internet.jwt(header={"alg":"HS256","typ":"JWT"}, payload={"iss":"Acme","sub":"user-123"}, refDate=1)' + ); + expect(parsed.errors).toEqual([]); + + const result = executeDomainKeyword(parsed.keyword, { faker, args: parsed.args }); + const [encodedHeader, encodedPayload] = result.split('.'); + const decodedHeader = decodeJwtPart(encodedHeader); + const decodedPayload = decodeJwtPart(encodedPayload); + + expect(decodedHeader.alg).toBe('HS256'); + expect(decodedHeader.typ).toBe('JWT'); + expect(decodedPayload.iss).toBe('Acme'); + expect(decodedPayload.sub).toBe('user-123'); }); test('executes internet.jwtAlgorithm', () => { diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js index a35dcc20..bfa959b1 100644 --- a/packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js +++ b/packages/core/src/tests/data_generation/unit/domain/domain-keyword-params-usage.test.js @@ -49,6 +49,9 @@ function sampleValueForType(type) { if (allowed.includes('array')) { return ['a', 'b']; } + if (allowed.includes('object')) { + return { key: 'value' }; + } return 'sample'; } @@ -79,6 +82,8 @@ function sampleValueForKeywordArg(keywordName, argName, typeName) { if (key === 'airline.seat.aircraftType') return 'narrowbody'; if (key === 'internet.emoji.types') return ['smiley']; + if (key === 'internet.jwt.header') return { alg: 'HS256', typ: 'JWT' }; + if (key === 'internet.jwt.payload') return { iss: 'Acme' }; if (key === 'internet.ipv4.cidrBlock') return '192.168.0.0/24'; if (key === 'internet.ipv4.network') return 'private'; if (key === 'internet.password.pattern') return '[A-Za-z0-9]'; diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js index cb6554f6..65212dac 100644 --- a/packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js +++ b/packages/core/src/tests/data_generation/unit/domain/domain-keyword-parser.test.js @@ -105,6 +105,13 @@ describe('domain keyword parser', () => { expect(parsedKeyword.errors).toEqual([]); }); + test('parses single object arg as named options for options-based domain keywords', () => { + const parsedKeyword = parseKeywordInvocation('number.int({"min":18,"max":65})'); + expect(parsedKeyword.keyword).toBe('number.int'); + expect(parsedKeyword.args).toEqual([18, 65, undefined]); + expect(parsedKeyword.errors).toEqual([]); + }); + test('returns error when positional arg appears after named arg', () => { const parsedKeyword = parseKeywordInvocation('number.int(min=1,2)'); expect(parsedKeyword.errors).toEqual([ @@ -135,4 +142,19 @@ describe('domain keyword parser', () => { const parsedKeyword = parseKeywordInvocation('example.fn(min=1)'); expect(parsedKeyword.errors).toEqual(['Unknown keyword: example.fn']); }); + + test('returns error for unsafe object key "__proto__"', () => { + const parsedKeyword = parseKeywordInvocation('number.int({"__proto__":{"polluted":true}})'); + expect(parsedKeyword.errors).toEqual(['Invalid keyword arguments: unsafe object key "__proto__" is not allowed']); + }); + + test('returns error for unsafe object key "constructor"', () => { + const parsedKeyword = parseKeywordInvocation('number.int({"constructor":{"prototype":{"polluted":true}}})'); + expect(parsedKeyword.errors).toEqual(['Invalid keyword arguments: unsafe object key "constructor" is not allowed']); + }); + + test('returns error for unsafe object key "prototype"', () => { + const parsedKeyword = parseKeywordInvocation('number.int({prototype:1})'); + expect(parsedKeyword.errors).toEqual(['Invalid keyword arguments: unsafe object key "prototype" is not allowed']); + }); }); diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-literal-exec.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-literal-exec.test.js index c89c6b88..21450822 100644 --- a/packages/core/src/tests/data_generation/unit/domain/domain-literal-exec.test.js +++ b/packages/core/src/tests/data_generation/unit/domain/domain-literal-exec.test.js @@ -1,13 +1,41 @@ import { executeDomainKeyword } from '../../../../../js/domain/domain-keywords.js'; +import { parseKeywordInvocation } from '../../../../../js/domain/domain-keyword-parser.js'; describe('literal domain keyword execution', () => { - test('executes literal.value', () => { - const result = executeDomainKeyword('literal.value', { - args: [1], - customDelegates: { - 'literal.value': ({ args: runtimeArgs }) => runtimeArgs[0], - }, - }); + test('executes literal.value with provided value', () => { + const result = executeDomainKeyword('literal.value', { args: [1] }); expect(result).toBe(1); }); + + test('defaults literal.value to empty string when value is omitted', () => { + const result = executeDomainKeyword('literal.value', { args: [] }); + expect(result).toBe(''); + }); + + test('executes literal.value with named string argument and preserves string type', () => { + const parsed = parseKeywordInvocation('literal.value(value="Pending")'); + expect(parsed.errors).toEqual([]); + + const result = executeDomainKeyword(parsed.keyword, { args: parsed.args }); + expect(result).toBe('Pending'); + expect(typeof result).toBe('string'); + }); + + test('executes literal.value with named boolean argument and preserves boolean type', () => { + const parsed = parseKeywordInvocation('literal.value(value=true)'); + expect(parsed.errors).toEqual([]); + + const result = executeDomainKeyword(parsed.keyword, { args: parsed.args }); + expect(result).toBe(true); + expect(typeof result).toBe('boolean'); + }); + + test('executes literal.value with named number argument and preserves number type', () => { + const parsed = parseKeywordInvocation('literal.value(value=42)'); + expect(parsed.errors).toEqual([]); + + const result = executeDomainKeyword(parsed.keyword, { args: parsed.args }); + expect(result).toBe(42); + expect(typeof result).toBe('number'); + }); }); diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js b/packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js index cfb432b3..978d29ad 100644 --- a/packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js +++ b/packages/core/src/tests/data_generation/unit/domain/domain-param-invocation-coverage.test-helper.js @@ -30,6 +30,9 @@ function sampleValueForType(typeName) { if (types.includes('array')) { return ['x', 'y']; } + if (types.includes('object')) { + return { key: 'value' }; + } return 'sample'; } @@ -51,6 +54,8 @@ function sampleValueForKeywordArg(keywordName, argName, typeName) { if (argName === 'network') return 'private'; if (argName === 'cidrBlock') return '192.168.0.0/24'; if (argName === 'types') return ['smiley']; + if (argName === 'header') return { alg: 'HS256', typ: 'JWT' }; + if (argName === 'payload') return { iss: 'Acme' }; if (argName === 'pattern') return 'a'; if (argName === 'mode') return 'age'; if (argName === 'strategy') return 'any-length'; @@ -70,6 +75,9 @@ function valueToInvocationLiteral(value) { if (Array.isArray(value)) { return JSON.stringify(value); } + if (value && typeof value === 'object') { + return JSON.stringify(value); + } throw new Error(`Unsupported literal type for invocation: ${typeof value}`); } diff --git a/packages/core/src/tests/data_generation/unit/domain/domain-string-counterstring-exec.test.js b/packages/core/src/tests/data_generation/unit/domain/domain-string-counterstring-exec.test.js new file mode 100644 index 00000000..4069c682 --- /dev/null +++ b/packages/core/src/tests/data_generation/unit/domain/domain-string-counterstring-exec.test.js @@ -0,0 +1,78 @@ +import { faker } from '@faker-js/faker'; +import { executeDomainKeyword } from '../../../../../js/domain/domain-keywords.js'; +import { parseKeywordInvocation } from '../../../../../js/domain/domain-keyword-parser.js'; + +function runWithSeed(seed, keyword, args) { + faker.seed(seed); + return executeDomainKeyword(keyword, { faker, args }); +} + +describe('string.counterString domain keyword execution', () => { + test('executes string.counterString with defaults when no args are provided', () => { + const result = runWithSeed(999, 'string.counterString', []); + expect(result.length).toBeGreaterThanOrEqual(1); + expect(result.length).toBeLessThanOrEqual(25); + expect(result).toContain('*'); + }); + + test('executes string.counterString', () => { + const result = runWithSeed(1000, 'string.counterString', [15]); + expect(result).toBe('*3*5*7*9*12*15*'); + }); + + test('string.counterString supports min/max range', () => { + const ranged = runWithSeed(1005, 'string.counterString', [5, 9]); + expect(ranged.length).toBeGreaterThanOrEqual(5); + expect(ranged.length).toBeLessThanOrEqual(9); + expect(ranged).toContain('*'); + }); + + test('string.counterString clamps minimum length to 1', () => { + const clamped = runWithSeed(1006, 'string.counterString', [0, 3]); + expect(clamped.length).toBeGreaterThanOrEqual(1); + expect(clamped.length).toBeLessThanOrEqual(3); + }); + + test('string.counterString accepts reversed min/max arguments', () => { + const reordered = runWithSeed(1007, 'string.counterString', [9, 5]); + expect(reordered.length).toBeGreaterThanOrEqual(5); + expect(reordered.length).toBeLessThanOrEqual(9); + }); + + test('string.counterString supports custom delimiter', () => { + const delimiter = runWithSeed(1008, 'string.counterString', [12, 12, '#']); + expect(delimiter).toBe('#3#5#7#9#12#'); + }); + + test('string.counterString uses first character when delimiter has length > 1', () => { + const result = runWithSeed(1009, 'string.counterString', [12, 12, 'XYZ']); + expect(result).toBe('X3X5X7X9X12X'); + }); + + test('string.counterString supports named min and max parameters', () => { + faker.seed(1010); + const parsed = parseKeywordInvocation('string.counterString(min=5, max=9)'); + const result = executeDomainKeyword(parsed.keyword, { faker, args: parsed.args }); + expect(result.length).toBeGreaterThanOrEqual(5); + expect(result.length).toBeLessThanOrEqual(9); + }); + + test('string.counterString supports named delimiter parameter', () => { + faker.seed(1011); + const parsed = parseKeywordInvocation('string.counterString(min=12, max=12, delimiter="#")'); + const result = executeDomainKeyword(parsed.keyword, { faker, args: parsed.args }); + expect(result).toBe('#3#5#7#9#12#'); + }); + + test('string.counterString rejects non-integer min argument', () => { + expect(() => runWithSeed(1014, 'string.counterString', [1.2, 3])).toThrow( + 'Invalid argument for min: expected an integer.' + ); + }); + + test('string.counterString rejects non-integer max argument', () => { + expect(() => runWithSeed(1015, 'string.counterString', [2, 3.4])).toThrow( + 'Invalid argument for max: expected an integer.' + ); + }); +}); diff --git a/packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js b/packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js index d1b6c70d..df485962 100644 --- a/packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js +++ b/packages/core/src/tests/data_generation/unit/domain/domainKeywords.test.js @@ -102,6 +102,29 @@ describe('domain keyword catalog', () => { }); }); + test('standalone domain definitions include at least one help example', () => { + const missingExamples = DOMAIN_KEYWORD_DEFINITIONS.filter( + (definition) => typeof definition?.help?.example !== 'string' || definition.help.example.trim().length === 0 + ).map((definition) => definition.keyword); + + expect(missingExamples).toEqual([]); + }); + + test('standalone domain definitions do not contain legacy placeholder argument docs', () => { + const legacyPlaceholderArgs = []; + DOMAIN_KEYWORD_DEFINITIONS.forEach((definition) => { + const args = Array.isArray(definition?.help?.args) ? definition.help.args : []; + args.forEach((arg) => { + const description = String(arg?.description || ''); + if (description.includes('Legacy placeholder argument from Faker signatures')) { + legacyPlaceholderArgs.push(`${definition.keyword}.${arg.name}`); + } + }); + }); + + expect(legacyPlaceholderArgs).toEqual([]); + }); + test('supports creating catalogs from injected definitions', () => { const catalog = buildDomainKeywordCatalog([ { @@ -118,6 +141,64 @@ describe('domain keyword catalog', () => { expect(DOMAIN_KEYWORDS.some((entry) => entry.keyword.startsWith('helpers.'))).toBe(false); expect(DOMAIN_KEYWORD_DEFINITIONS.some((entry) => String(entry.keyword || '').startsWith('helpers.'))).toBe(false); }); + + test('keeps critical keyword metadata contracts for documented return types and transforms', () => { + const byKeyword = new Map(DOMAIN_KEYWORDS.map((entry) => [entry.keyword, entry])); + + expect(byKeyword.get('literal.value')?.help?.returnType).toBe('string|number|boolean'); + expect(byKeyword.get('datatype.boolean')?.help?.args.map((arg) => arg.name)).toEqual(['probability']); + expect(byKeyword.get('finance.accountName')?.help?.returnType).toBe('string'); + expect(byKeyword.get('finance.accountNumber')?.help?.returnType).toBe('string'); + expect(byKeyword.get('date.month')?.help?.returnType).toBe('string'); + expect(byKeyword.get('date.weekday')?.help?.returnType).toBe('string'); + expect(byKeyword.get('internet.email')?.delegate?.argTransform).toBe('optionsFromHelpArgs'); + expect(byKeyword.get('internet.httpStatusCode')?.help?.returnType).toBe('number'); + expect(byKeyword.get('internet.port')?.help?.returnType).toBe('number'); + expect(byKeyword.get('location.country')?.help?.returnType).toBe('string'); + expect(byKeyword.get('location.countryCode')?.help?.returnType).toBe('string'); + expect(byKeyword.get('location.county')?.help?.returnType).toBe('string'); + expect(byKeyword.get('location.direction')?.help?.returnType).toBe('string'); + expect(byKeyword.get('location.secondaryAddress')?.help?.returnType).toBe('string'); + expect(byKeyword.get('location.language')?.help?.returnType).toBe('object'); + }); + + test('example literals are consistent with declared returnType metadata', () => { + const failures = []; + + for (const entry of DOMAIN_KEYWORDS) { + const declaredType = String(entry?.help?.returnType || ''); + const example = String(entry?.help?.example || ''); + const inferred = inferTypeFromExampleLiteral(example); + const inferredType = inferred.type; + const confidence = inferred.confidence; + + const allowedTypes = declaredType + .split('|') + .map((part) => part.trim()) + .filter((part) => part.length > 0); + + if (allowedTypes.includes('object') && !exampleLooksLikeObjectLiteral(example)) { + failures.push({ + keyword: entry.keyword, + returnType: declaredType, + example, + reason: 'declared object returnType requires object-like example literal', + }); + continue; + } + + if (confidence === 'high' && !allowedTypes.includes(inferredType)) { + failures.push({ + keyword: entry.keyword, + returnType: declaredType, + example, + inferredType, + }); + } + } + + expect(failures).toEqual([]); + }); }); describe('domain keyword alias mapping', () => { @@ -204,15 +285,14 @@ describe('domain keyword delegation', () => { expect(result).toBe('Pending'); }); - test('blocks execution when args do not match help arg schema', () => { - expect(() => - executeDomainKeyword('literal.value', { - customDelegates: { - 'literal.value': () => 'should-not-run', - }, - args: [undefined], - }) - ).toThrow('Missing required argument'); + test('allows custom literal delegate to override built-in behavior', () => { + const result = executeDomainKeyword('literal.value', { + customDelegates: { + 'literal.value': () => 'should-run', + }, + args: [undefined], + }); + expect(result).toBe('should-run'); }); }); @@ -254,6 +334,7 @@ function sampleValueForType(type) { if (allowed.includes('number')) return 7; if (allowed.includes('boolean')) return true; if (allowed.includes('array')) return ['x', 'y']; + if (allowed.includes('object')) return { key: 'value' }; return 'sample'; } @@ -267,9 +348,33 @@ function valueToInvocationLiteral(value) { if (Array.isArray(value)) { return JSON.stringify(value); } + if (value && typeof value === 'object') { + return JSON.stringify(value); + } throw new Error(`Unsupported invocation literal value: ${String(value)}`); } +function inferTypeFromExampleLiteral(example) { + const value = String(example || '').trim(); + if (value.length === 0) return { type: 'unknown', confidence: 'low' }; + + if (value === 'true' || value === 'false') return { type: 'boolean', confidence: 'high' }; + if (value.startsWith('[') && value.endsWith(']')) return { type: 'array', confidence: 'high' }; + if (value.startsWith('{') && value.endsWith('}')) return { type: 'object', confidence: 'high' }; + if (/^"?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z"?$/.test(value)) { + return { type: 'date', confidence: 'high' }; + } + if (/[^0-9.+-]/.test(value)) return { type: 'string', confidence: 'high' }; + if (/^[+-]?\d+(\.\d+)?$/.test(value)) return { type: 'number', confidence: 'low' }; + + return { type: 'string', confidence: 'low' }; +} + +function exampleLooksLikeObjectLiteral(example) { + const value = String(example || '').trim(); + return value.startsWith('{') && value.endsWith('}'); +} + describe('faker keyword invocation styles', () => { const fakerKeywordsWithArgs = DOMAIN_KEYWORDS.filter( (keyword) => keyword.delegate?.type === 'faker' && Array.isArray(keyword.help?.args) && keyword.help.args.length > 0 diff --git a/scripts/generate-domain-docs.mjs b/scripts/generate-domain-docs.mjs index 71a0aabf..0c1c5b93 100644 --- a/scripts/generate-domain-docs.mjs +++ b/scripts/generate-domain-docs.mjs @@ -3,6 +3,7 @@ import path from 'node:path'; import { DOMAIN_KEYWORDS } from '../packages/core/js/domain/domain-keywords.js'; import { faker } from '@faker-js/faker'; import { executeDomainKeyword } from '../packages/core/js/domain/domain-keywords.js'; +import { toInlineCode } from '../packages/core/js/domain/domain-doc-markdown.js'; const outDir = path.resolve('docs-src/docs/040-test-data/domain'); fs.mkdirSync(outDir, { recursive: true }); @@ -109,6 +110,9 @@ const invocationOverrides = { 'date.betweens': { invocation: 'date.betweens(2, 0, 2000000000000)', args: [2, 0, 2000000000000] }, }; const nonDeterministicExamples = new Set(['helpers.maybe']); +const domainIntroOverrides = { + literal: 'The `literal` domain returns caller-provided values directly and does not invoke faker.', +}; function escapeMdxText(value) { return String(value ?? '') @@ -116,13 +120,18 @@ function escapeMdxText(value) { .replaceAll('}', '}'); } +function escapeMarkdownTableCell(value) { + const normalized = String(value ?? '').replaceAll('\r\n', '\n').replaceAll('\r', '\n'); + return escapeMdxText(normalized.replaceAll('\n', '
')).replaceAll('|', '\\|'); +} + function canExecuteInvocation(keyword, args) { try { executeDomainKeyword(keyword, { faker, args, customDelegates: { - 'literal.value': (context) => context.args?.[0], + 'literal.value': (context) => context.args?.[0] ?? '', }, }); return true; @@ -131,23 +140,13 @@ function canExecuteInvocation(keyword, args) { } } -function getExampleReturnValues(keyword, args, count = 2) { - const values = []; - for (let index = 0; index < count; index += 1) { - try { - const value = executeDomainKeyword(keyword, { - faker, - args, - customDelegates: { - 'literal.value': (context) => context.args?.[0], - }, - }); - values.push(JSON.stringify(value)); - } catch { - break; - } +function getDefinitionReturnValues(entry) { + const explicit = Array.isArray(entry?.help?.exampleReturnValues) ? entry.help.exampleReturnValues : []; + if (explicit.length > 0) { + return explicit; } - return values; + const single = String(entry?.help?.example || '').trim(); + return single ? [single] : []; } function toNamedInvocation(keyword, argSpecs, typedArgs) { @@ -163,7 +162,11 @@ function toNamedInvocation(keyword, argSpecs, typedArgs) { } const value = typedArgs[index]; const rendered = - typeof value === 'string' ? `"${value}"` : Array.isArray(value) ? JSON.stringify(value) : String(value); + typeof value === 'string' + ? `"${value}"` + : Array.isArray(value) || (value && typeof value === 'object') + ? JSON.stringify(value) + : String(value); pairs.push(`${name}=${rendered}`); } return `${keyword}(${pairs.join(', ')})`; @@ -180,6 +183,9 @@ function renderInvocation(keyword, typedArgs) { if (Array.isArray(value)) { return JSON.stringify(value); } + if (value && typeof value === 'object') { + return JSON.stringify(value); + } return String(value); }); return `${keyword}(${renderedArgs.join(', ')})`; @@ -188,26 +194,36 @@ function renderInvocation(keyword, typedArgs) { function sampleValueForArg(argSpec) { const name = String(argSpec?.name || '').trim(); const typeName = String(argSpec?.type || '').trim(); + if (name === 'firstName') return 'Alex'; + if (name === 'lastName') return 'Taylor'; + if (name === 'provider') return 'example.com'; if (name === 'aircraftType') return 'narrowbody'; if (name === 'countryCode') return 'GB'; if (name === 'cidrBlock') return '192.168.0.0/24'; if (name === 'network') return 'private-a'; + if (name === 'protocol') return 'https'; if (name === 'format') return 'hex'; if (name === 'casing') return 'lower'; if (name === 'prefix') return '#'; if (name === 'separator') return '-'; + if (name === 'characters') return 'ABC123'; if (name === 'variant') return '13'; + if (name === 'pattern') return '[A-Za-z0-9]'; if (name === 'strategy') return 'any-length'; if (name === 'version') return 'v4'; if (name === 'mode') return 'age'; + if (name === 'sex') return 'male'; if (name === 'mimeType') return 'image/png'; if (name === 'extension') return 'txt'; if (name === 'symbol') return '$'; if (name === 'types') return ['food', 'nature']; if (name === 'list') return ['alpha', 'beta', 'gamma']; + if (name === 'header') return { alg: 'HS256', typ: 'JWT' }; + if (name === 'payload') return { iss: 'Acme' }; if (name === 'style') return 'human'; if (name === 'context') return false; if (name === 'abbreviated') return false; + if (name === 'memorable') return false; const first = typeName @@ -216,8 +232,9 @@ function sampleValueForArg(argSpec) { .find(Boolean) || 'string'; if (first === 'number') return 1; if (first === 'boolean') return true; - if (first === 'array') return ['sample']; - return 'sample'; + if (first === 'array') return ['item']; + if (first === 'object') return { key: 'value' }; + return 'value'; } let pageIndex = 20; @@ -232,11 +249,18 @@ for (const domain of domains) { '', `# ${domain} Domain`, '', - `The \`${domain}\` domain maps domain keywords to underlying faker implementations.`, + domainIntroOverrides[domain] || + `The \`${domain}\` domain maps domain keywords to underlying faker implementations.`, '', ]; - const docsByDomain = [...new Set(keywords.map((k) => k.help.docsUrl).filter(Boolean))]; + const docsByDomain = [ + ...new Set( + keywords + .map((k) => String(k.help.docsUrl || '').trim()) + .filter((url) => url.length > 0 && url.includes('fakerjs.dev/api/')) + ), + ]; if (docsByDomain.length > 0) { lines.push('## Faker Documentation', ''); for (const url of docsByDomain) lines.push(`- [${url}](${url})`); @@ -250,15 +274,7 @@ for (const domain of domains) { const override = invocationOverrides[entry.keyword]; const requiredArgSpecs = args.filter((a) => a.required); const typedRequiredArgs = requiredArgSpecs.map((a) => { - const first = - String(a.type || '') - .split('|') - .map((s) => s.trim()) - .find(Boolean) || 'string'; - if (first === 'number') return 1; - if (first === 'boolean') return true; - if (first === 'array') return ['sample']; - return 'sample'; + return sampleValueForArg(a); }); const sampledArgs = args.map((arg) => sampleValueForArg(arg)); let executableExampleArgs = override ? override.args : typedRequiredArgs; @@ -282,7 +298,10 @@ for (const domain of domains) { lines.push(`### \`${entry.keyword}\``, ''); lines.push(escapeMdxText(entry.help.summary || 'No summary provided.'), ''); lines.push(`- Canonical: \`${entry.canonical}\``); - if (entry.help.docsUrl) lines.push(`- Faker docs: [${entry.help.docsUrl}](${entry.help.docsUrl})`); + if (entry.help.docsUrl) { + const docsLabel = String(entry?.delegate?.type || '') === 'faker' ? 'Faker docs' : 'Docs'; + lines.push(`- ${docsLabel}: [${entry.help.docsUrl}](${entry.help.docsUrl})`); + } lines.push(''); if (args.length > 0) { @@ -290,7 +309,7 @@ for (const domain of domains) { lines.push('| --- | --- | --- | --- |'); for (const arg of args) { lines.push( - `| \`${escapeMdxText(arg.name)}\` | \`${escapeMdxText(arg.type)}\` | ${arg.required ? 'yes' : 'no'} | ${escapeMdxText(arg.description || 'No description provided.')} |` + `| \`${escapeMarkdownTableCell(arg.name)}\` | \`${escapeMarkdownTableCell(arg.type)}\` | ${arg.required ? 'yes' : 'no'} | ${escapeMarkdownTableCell(arg.description || 'No description provided.')} |` ); } lines.push(''); @@ -299,6 +318,7 @@ for (const domain of domains) { } if (hasExecutableExample) { + const definitionExamples = Array.isArray(entry.help.examples) ? entry.help.examples.filter(Boolean) : []; let namedInvocation = ''; const allArgsValues = sampledArgs; if (args.length > 0 && canExecuteInvocation(entry.keyword, allArgsValues)) { @@ -311,13 +331,15 @@ for (const domain of domains) { ); } const invocation = override ? override.invocation : renderInvocation(entry.keyword, executableExampleArgs); - lines.push('Examples:', '', '```txt', invocation, '```'); - if (namedInvocation) { - lines.push('', '```txt', namedInvocation, '```'); + const primaryExamples = + definitionExamples.length > 0 ? definitionExamples : [invocation, namedInvocation].filter(Boolean); + lines.push('Examples:'); + for (const example of primaryExamples) { + lines.push('', '```txt', example, '```'); } - if (args.length > 0) { + if (args.length > 0 && definitionExamples.length === 0) { const typeInExamples = []; - const seenExamples = new Set([invocation, namedInvocation].filter(Boolean)); + const seenExamples = new Set(primaryExamples); for (let index = 0; index < args.length; index += 1) { const arg = args[index]; const value = sampleValueForArg(arg); @@ -357,11 +379,11 @@ for (const domain of domains) { } } } - const returnValues = getExampleReturnValues(entry.keyword, executableExampleArgs); + const returnValues = getDefinitionReturnValues(entry); if (returnValues.length > 0) { lines.push('', 'Example return values:'); for (const value of returnValues) { - lines.push(`- \`${escapeMdxText(value)}\``); + lines.push(`- ${toInlineCode(value)}`); } } lines.push('');