Skip to content

Conversation

@simplenotezy
Copy link

Description

This PR introduces a new feature in the FactoryValueGenerator class to include the current index in its operations. This enhancement allows for greater flexibility, e.g. the creation of consistent UUIDs across different seeds, which is particularly useful during development.

Key Benefits

  • Consistent UUID Generation: By incorporating the current index, the generated UUIDs can remain consistent across reseeds.
  • Improved Developer Productivity: Developers can then refire the same API requests without needing to reconfigure IDs, streamlining the development process.

Implementation Details

  • The FactoryValueGenerator has been updated to include the current index in its UUID generation logic.
  • No breaking changes are introduced; existing functionalities remain intact. I had to add ts-ignore though, which I am not particularly proud of, but seems to be the most sensible solution to maintain backwards compatability

Example

@Factory((_, __, index) => uuidv5(index.toString(), this.name))
id: string;

Checklist

  • Code has been tested locally
  • Documentation has been updated
  • All tests pass N/A

Please review the changes and provide feedback. Thanks!

@simplenotezy
Copy link
Author

Closed in favour of #43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant