Suchjs add changelog since v1.0.0.
- Support export in
vite.
- Add the export of TS enum variables
AssignTypefor esmodule, for theassignmethod's parameter added in version3.1.0.
- Now
:dictand:cascadertype in nodejs environment also support thedataconfig to set a data like it in browser, now you can use oneof the file data path or the 'data' config as a data entry.
:datetype add config optionnowto allowed you to change the base date of the relative date.- Add
dynamicsconfig options forsuch instance, now you can change the fields's config dynamic by other depend field's value, it help you to fake the data more exactly as you want. - Add
AssignTypefor such instance'sassignmethod, so you can assign a variable with different types for different use cases.
- [break change] Change the
Suchinstance'sstorefrom a property to a method, now you should use this new method to get the data instore, and a new methodclearStoreis added to allow you clear the store's data.
- Add the
paramsconfig forinstanceOptions, it allowed you to override the mockit's$configand$lengthparameter, so you can generate the data more exactly.
-
[break change] Now config not support a regexp literal
/xxx/xx, but support expression without whitespacesa*1+2. -
[break change] The
configfield inoptionsof the generate methods's first parameter has renamed tokeyto make the meaning more clear.
-
Add the
clearmethod forstoreobject, it's necessary for reloading the such config. -
Add more types for server's config. see the
such-cliREADME.
- Fix the data files such as
jsonanddictfiles, use a cache missing the namespace. Now it will search the file from it's own namespace also the global namespace.
-
[break change] in the template literal string you need use
//${0}instead of/${0}, with two slashs as a path to reference the data type appeared in template. -
[break change] now in the mockit's
generatemethod, thetemplatefield inoptionsnow is removed and mounted in theoptions'smockerfield. -
Now you can reference the data type out of the template like this
/template/${0}. -
Fix the
getPathInfoget a wrong path when the path begin with./in deprecated versionv3.0.0
-
Fix the
cascaderanddicttype in node is defined afterloadConf, so you can't define a new type base on them, now fixed it. -
Fix when check the data attribute if is enable only check the
allowAttrsof current type, that may cause an unexpected error because the current type may inherit from another type. Now fix it by also check from the inherited base type.
- Change the method
loadExtendof such class ignore repeatedextendsitems thoes have resolved by the global Such instance.
- Added the server config types for such-cli command
such serve.
-
Fix the type use a function by
@fn(data)lost the assigneddata's parameter. -
Fix some date formats in
:datetype lostthiswhat need reference theDateobject. -
Fix the user defined type base on template type may also cause an error because can't find the
$templatebecause it's not initialized.
- Change
loadDataload the config file by checking theprocess.env.SUCH_ROOTenv variable firstly. It's useful for the library's tests in node environment and insuch-clicommand line tool.
- More tests for uncover codes, remove unnecessary codes.
- Fix the
Such.ascall the extended types multiple times may lost theinstanceproperty because theinstancewas created ininitmethod, but theinitmethod only call once.
- Fix the extend
:numerictype's wrong$sizeconfig.
- Now
:cascadertype in browser, the top level field just need thedataconfig, therootconfig is not required anymore.
- Fix wrong building deprecated version
v2.1.4.
- Add support for nodejs load config file in
type: "module"package.
- Add support for nodejs
esmmodule.
- Add generic type for
.instance()and.as()methods, so if you build an instance like this.instance<string>(),const result = instance.a()then result is astringtype, the same for theasmethod, e.g.as<string>().
- In nodejs environment, if you used a
.jsonfile as the mock template, please useascmethod instead ofasmethod, so keep theasmethod no need to make a special logic to treat that.ascas from file code, also meansasync.
- Fix the ts file import path error.
-
Add more recommend url types:
domain、tld、protocol、ipv4、ipv6、ip -
Add more recommend character types:
alpha、numeric、alphaNumeric -
Now
typesin config file supportenumandtemplatetypes.
-
Fix
configparser#[]doesn't support keys with number characters, and fix the key-value like#[a=""]got a empty string value instead of a wrong boolean value. -
Fix the
typonamed capture group nameltd->tldinurlandemailtype, this is a breakchange. -
Fix the
regexptype'snamedGroupConfdoesn't make sence because the upgrade changes of the dependecy packagereregexp. -
Upgrade the eslint packages in project.
Hit the npm incident: report, this version is not updated correctly, update to version v2.0.2.
Fix the "process.env" is not defined in browser when import the package by "npm install".
-
Export a new method named
createNsSuch(namespace: string), so you can use it to get a such instance with namespace, then the store data such as defined types, alias names, assigned variables and functions are all in it's own namespace, instances with different namespaces can't access to visit each other's data unless they export the data to global by using methods such assetExportType,setExportVar,setExportFn, etc. -
Now the
definemethod allow define type base ontemplateliteral string and enum data. -
Allowed set keys config of
indexfor enum types.
- Breaking Change: Now the
Suchobject is an instance by callingcreateNsSuchwith root namespace, the methods such asdefine,alias,templateand other methods that used to be static methods ofSuchnow become to be methods of aSuchinstance.
-
Fix the default handle of the data attribute
$config,$funcdo not trigger correctly. -
Fix the
definemethod's parameter ofbaseTypenot cover the alias names.
- Add
indexconfig for the keys of the instance options, so you can use a enum values and get an exactly value by set it.
- Change the
checkKeys()method also returnoneOf,alwaysArrayconfig of the field.
- Add the
checkKeys()method, so every time you called thea()method with an instance options with keys will trigger acheck, all the keys config will be strictly checked one by one.
- Add the
existto the path value in the instaceOptions keys, so you need useexistif the field is optional and also has a count.
- Add
keys()method for such instance, so you can get the path of keys which has anoptionalor countminandmaxconfig.
- Check the instanceOptions parameter more strictly in the method
a(instanceOptions), wrongminandmaxvalue will cause an error.
- Add the keys config options for the such instance's method
a(instanceOptions: IAInstanceOptions), so you can across the options to control thoes fields are optional appear or not, and narrow thoes array fields has a range length to a small range length or a specified length.
- Remove the
browser.tsfrom the.npmignore, now in browser you can install the package and import fromsuchjs/lib/browserto get suchjs as a module.
- Add syntax like
<name>:data-typein template literal, so the:reftype can use&/${name}to reference the named data type's value.
- Fix the
template literaltype can't use:reftype correctly.
-
Change the
pathparser, now allow special characters such as,,:,/etc. use a translate slash to escape the path name. -
The
:refdata type's pathdata attributewill cause an error if the path is not exists in currently.
- The
:refdata type intemplate literaltype now can use/${0}(format like/${number}) to reference the inner data type's generated value.
-
Add
Such.templatestatic method for generatingtemplate literalstring. -
Add
ToTempletemockit, so you can useSuch.as(":::abc")to call theSuch.templatemethod for generating.