🎉 chaca@2.0.0
🌚 Features
Core
-
The
Datasetclass was created to export various schemas in a relational way -
You can now define the
isArrayparameter 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
WrongPossibleNullDefinitionErrorfor errors in the definition of the parameterpossibleNull -
Added exception
WrongArrayDefinitionErrorfor errors in the definition of the parameterisArray -
Added exception
WrongProbabilityFieldDefinitionErrorfor errors in the definition ofprobabilityfields -
🗑️
chaca.multiGeneratewas removed -
🎉 The number of items to select in the
pickfield 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
nullOnEmptyparameter to avoidNotEnoughValuesForRefErrorexception -
The
reffields can reference the schema they are located in without causing a circular dependency. -
🎉 Added
Dataset.transform,Schema.transformandChaca.transformmethods to serialize data to a specific file format without having to export it -
🎉 Added new CLI commands
jsonpythonjavajsjsonpostgresqltsyaml
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
prefixargument was added to thedatatype.alphaNumericmodule
Utils
- 🎉 Added
utils.pickto select elements from an array without being chosen more than once - 🎉 Added
utils.multipleTo create an array of values from a generator - 🎉 Added
bannedandsymbolsoptions 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
schemasconcept was changed tomodulesfor predefined functions -
🗑️ The
SchemaFieldclass 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
possibleNullparam 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
exportCLI command
Modules
- 🔄
modules.animal.animalType->modules.animal.type - 🔄
modules.image.animateAvatar->modules.image.animatedAvatar - 🔄
modules.id.mongodbID->modules.id.mongodbId