🌚 Features
Core
-
The
Dataset
class was created to export various schemas in a relational way -
You can now define the
isArray
parameter as a function that is executed when each document is created.const schema = chaca.schema({ image: { type: () => modules.image.people(), isArray: ({ currentFields, store }) => { return 5; // or return { min: 2, max: 10, }; }, }, });
-
Added exception
WrongPossibleNullDefinitionError
for errors in the definition of the parameterpossibleNull
-
Added exception
WrongArrayDefinitionError
for errors in the definition of the parameterisArray
-
Added exception
WrongProbabilityFieldDefinitionError
for errors in the definition ofprobability
fields -
🗑️
chaca.multiGenerate
was removed -
🎉 The number of items to select in the
pick
field can be defined as a range of values or a function that returns the number of values to choose from.// range chaca.pick({ values: [1, 2, 3, 4, 5], count: { min: 1, max: 3, }, }); // function chaca.pick({ values: [1, 2, 3, 4, 5], count: ({ store, currentFields }) => { return 2; // or return { min: 1, max: 3, }; }, });
-
Added
nullOnEmpty
parameter to avoidNotEnoughValuesForRefError
exception -
The
ref
fields can reference the schema they are located in without causing a circular dependency. -
🎉 Added
Dataset.transform
,Schema.transform
andChaca.transform
methods to serialize data to a specific file format without having to export it -
🎉 Added new CLI commands
json
python
java
js
json
postgresql
ts
yaml
Modules
- 🎉 Added
datatype.octal
- 🎉 Added
datatype.numeric
- 🎉 Added
datatype.bigint
- 🎉 Added
datatype.character
- 🎉 Added
id.nanoid
- 🎉 Added
id.ulid
- 🎉 Added
id.cuid
- 🎉 Added
image.category
- 🎉 Added
color.human
- 🎉 Added
date.anytime
- 🎉 Added
finance.litecoinAddress
- 🎉 Added
internet.ip
- 🎉 Added
address.ordinalDirection
- 🎉 Added
lorem.word
- 🎉 Added
lorem.sentence
- 🎉 Added
lorem.paragraph
- 🎉 Added
person.zodiacSign
- 🎉 Added
system.cron
- 🎉 Added
address.longitude
- 🎉 Added
address.latitude
- The
prefix
argument was added to thedatatype.alphaNumeric
module
Utils
- 🎉 Added
utils.pick
to select elements from an array without being chosen more than once - 🎉 Added
utils.multiple
To create an array of values from a generator - 🎉 Added
banned
andsymbols
options onutils.replaceSymbols
- 🗑️ Deleted
utils.capitalCamelCase
- 🗑️ Deleted
utils.capitalize
- 🗑️ Deleted
utils.capitalizeWord
- 🎉 Added
utils.snakeCase
- 🎉 Added
utils.dotCase
- 🎉 Added
utils.sentenceCase
- 🎉 Added
utils.capitalCase
- 🎉 Added
utils.pascalCase
🪛 Fix
Core
-
🔄
DatasetStore.getValue
->DatasetStore.get
-
🔄 The
schemas
concept was changed tomodules
for predefined functions -
🗑️ The
SchemaField
class and thechaca.schemaField()
method are removed. The way to use the modules from now on is as follows// get a value modules.id.uuid(); // use on schemas const schema = chaca.schema({ id: () => modules.id.uuid(), });
-
Probability values for the
possibleNull
param must be in the range 0 to 1 now -
🔄
Schema.generate
->Schema.array
-
🔄
Schema.generateObject
->Schema.object
-
🔄
FileConfig.fileName
->FileConfig.filename
-
🔄
DatasetStore.getSchemaDocuments
->DatasetStore.currentDocuments
-
🔄
NotExistFieldError
->NotExistRefFieldError
-
🗑️ Removed
export
CLI command
Modules
- 🔄
modules.animal.animalType
->modules.animal.type
- 🔄
modules.image.animateAvatar
->modules.image.animatedAvatar
- 🔄
modules.id.mongodbID
->modules.id.mongodbId