-
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
- 🎉 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
- 🎉 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
-
🔄
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.animal.animalType
->modules.animal.type
- 🔄
modules.image.animateAvatar
->modules.image.animatedAvatar
- 🔄
modules.id.mongodbID
->modules.id.mongodbId
- 🎉 Add
pick
field to choose unique elements from an array
- 🎉 Data creation times have been reduced by 20%
- 🎉 The bundle size has been reduced by 50%
- 🗑️
Video
schema was deleted - 🗑️ The
constants
inImage
schema were removed
- Fix problems with zip exportation in
python
andpostgresql
formats - Fix
Internet.password
schema
- Add export configurations to all formats (
java
|csv
|typescript
|json
|javascript
|yaml
|postgresql
|python
)
- Fix some problems with
sequence
fields configuration - Upgrade error messages
-
Add conditional value function to
possibleNull
configurationconst schema = chaca.schema({ age: schemas.dataType.int({ min: 18, max: 90 }), actual_school_year: { type: schemas.dataType.int({ min: 10, max: 15 }), possibleNull: ({ currentFields, store }) => { if (currentFields.age > 25) { return 90; // If the age is greater than 25 years, there will be a 90% probability that the field will be null } else { return 15; // Will be a 15% probability that the field will be null; } }, }, });
-
Add
probability
field as alternative toenum
field// Simple definition const schema = chaca.schema({ prob: chaca.probability([ { chance: 0.9, value: 10 }, // There is a 90% chance of choosing the value 10 { chance: 0.5, value: 5 }, // There is a 50% chance of choosing the value 5 { chance: 0.1, value: 1 }, // There is a 10% chance of choosing the value 1 ]), }); // Conditional definition const schema = chaca.schema({ test: schemas.dataType.int({ min: 0, max: 10 }), prob: chaca.probability([ { chance: ({ currentFields, store }) => { if (currentFields.test > 5) { return 0.9; } else { return 0.2; } }, value: 10, }, { chance: 0.5, value: 5 }, { chance: 0.1, value: 1 }, ]), });
-
Add export configurations for
json
,java
andcsv
extensionschaca.export(data, { filename: "Data", localtion: "./data", format: { ext: "json", zip: false, separate: true }, });
-
Add more information of fields routes in exceptions
-
Add new exception
NotExistFieldError
const dataset1 = chaca.schema({ id: chaca.key(schemas.id.uuid()), }); const dataset2 = chaca.schema({ id: chaca.ref("Dataset1.customId"), // not exist that field }); const data = chaca.multiGenerate([ { name: "Dataset1", documents: 30, schema: dataset1 }, { name: "Dataset2", documents: 30, schema: dataset2 }, ]); // throw a NotExistFieldError because 'customId' not exist
- Change
internet.userName
tointernet.username
- Fix
intener.username
andinternet.email
values generator
- Add
browser
,oauthProvider
,locale
,emailProvider
options ininternet
schema - Add more values for the
protocol
option ininternet
schema - Add
transaction
,subscriptionPlan
options infinance
schema - Add more values for
manufacturer
andmodel
options invehicle
schema - Add
language
option inperson
schema
- Allow
possibleNull
config for sequence and sequential fields - Add more results for
internet.userName
-
Add CLI commands for export dataset from schemas configuration file
-
🐍 Add Python code generator
-
Add
loop
configuration inchaca.sequential
field
// Before
const schema = chaca.schema({
favoriteNumber: chaca.sequential([1, 2, 3]),
});
schema.generate(5); // Throws an error because there are only 3 values for 5 documents to create
// Now
const schema = chaca.schema({
favoriteNumbers: chaca.sequential([1, 2, 3], { loop: true }),
});
schema.generate(5);
/*
[
{ favoriteNumber: 1 },
{ favoriteNumber: 2 },
{ favoriteNumber: 3 },
{ favoriteNumber: 1 },
{ favoriteNumber: 2 },
];
*/
- Remove names from
schema field
declaration
// Before
const customField = chaca.module("customField", (args) => {
// return value
});
// Now
const customField = chaca.module((args) => {
// return value
});
- Allow 0 as a possible value for the
isArray
parameter - Interfaces referring to
isArray
andpossibleNull
configurations are now accessible - Change
posibleNull
topossibleNull
in schema configuration - The limit of documents to be generated by schema was eliminated
- Fix problems with CSV code generator
- Fix problems with Typescript code generator
- Fix extra blank space in
PersonSchema.fullName
string generation
- Add
sequence field
- Add
sequential field
- Add
ref field
- Add
key field
- Add
enum field
- Add
ColorSchema
- Delete
numberRow
fromIdSchema
- Add
utils.sumDateRange
to change dates by range
- Add
PostgreSQL
code generator - Add
chaca.multiGenerate
to generate relational schemas data - Add
chaca.exportFromSchemas
to export and generate relational schemas data - Add
schema.object
to generate single object of data schema
- Now you can export any type of data in all extensions
- Fix
utils.camelCase
- Add YAML code generator
- Fix
Internet.email
schema error - Fix
Person.fullName
schema error - Remove
chaca.exportAll
method
- Initial release