Skip to content

Releases: hgomezrobaina/chaca

🎉 chaca@2.1.0

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 11 Oct 19:08
9eb92d8

🌚 Features

  • All dataset, schema and dataset store operations are now async functions

  • You can define the number of documents to generate as a function that depends on the current state of the dataset.

    chaca.dataset([
      {
        name: "User",
        schema: userSchema,
        documents: 50,
      },
      {
        name: "Writer",
        schema: writerSchema,
        documents: async ({ store }) => {
          const users = await store.get("User");
    
          return users.filter((u) => u.role === "writer");
        },
      },
    ]);

🪛 Fix

  • Issues with date.birthdate generation problems were fixed

🎉 chaca@2.0.0

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 09 Nov 16:16
c00fcbb

🌚 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 parameter possibleNull

  • Added exception WrongArrayDefinitionError for errors in the definition of the parameter isArray

  • Added exception WrongProbabilityFieldDefinitionError for errors in the definition of probability 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 avoid NotEnoughValuesForRefError exception

  • The ref fields can reference the schema they are located in without causing a circular dependency.

  • 🎉 Added Dataset.transform, Schema.transform and Chaca.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 the datatype.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 and symbols options on utils.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 to modules for predefined functions

  • 🗑️ The SchemaField class and the chaca.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

🎉 chaca@1.9.0

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 25 Apr 05:02
a0c9d00

🌚 Features

  • 🎉 Add pick field to choose unique elements from an array

🪛 Fix

  • 🎉 Data creation times have been reduced by 20%

🎉 chaca@1.8.0

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 09 Feb 02:46
37e2b99

🌚 Features

  • 🎉 The bundle size has been reduced by 50%
  • 🗑️ Video schema was deleted
  • 🗑️ The constants in Image schema were removed

chaca@1.7.1

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 30 Dec 22:44

🌚 Features

  • Add export configurations for all formats (java | csv | typescript | json | javascript | yaml | postgresql | python)

🎉 chaca@1.7.0

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 24 Dec 04:31

🪛 Fix

  • Fix some problems with sequence fields configuration
  • Upgrade error messages

🌚 Features

  • Add conditional value function to possibleNull configuration
  • Add probability field as alternative to enum field
  • Add export configurations for json, java and csv extensions

v.1.6.3

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 26 Sep 21:44

chaca@1.6.3

🪛 Fix

  • Add more information of fields routes in exceptions
  • Add new exception NotExistFieldError

v.1.6.2

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 21 Sep 01:42

chaca@1.6.2

🪛 Fix

  • Change internet.userName to internet.username
  • Fix intener.username and internet.email values generator

v1.6.1

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 20 Sep 18:29

chaca@1.6.1

🌚 Features

  • Add browser, oauthProvider, locale, emailProvider options in internet schema
  • Add more values for the protocol option in internet schema
  • Add transaction, subscriptionPlan options in finance schema
  • Add more values for manufacturer and model options in vehicle schema
  • Add language option in person schema

🪛 Fix

  • Allow possibleNull config for sequence and sequential fields
  • Add more results for internet.userName

v1.6.0

Choose a tag to compare

@hgomezrobaina hgomezrobaina released this 17 Aug 03:39

🌚 Features

  • Add CLI commands for export dataset from schemas configuration file
  • 🐍 Add Python code generator
  • Add loop configuration in chaca.sequential field
  • Remove names from schema field declaration

🪛 Fix

  • Allow 0 as a possible value for the isArray parameter
  • Interfaces referring to isArray and possibleNull configurations are now accessible
  • Change posibleNull to possibleNull 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