The Winible Typescript Models or @winible/winible-typed
npm package is a project that holds all of Winible's sequelize database model declarations, sequelize client instantiation, as well as type declarations for unifying type sharing between all of our projects.
This package serves as the central source of truth for Winible's database models and TypeScript types. It's used across multiple projects including:
- Main backend
- Lambda functions
- Other Winible services
npm install @winible/winible-typed
├── src/ # Source code
│ ├── types.ts # Index types (NOT IN USE)
│ ├── index.ts # Main entry point
│ └── recurlyInstance.ts # Recurly integration
├── migrations/ # Database migrations (NOT IN USE)
├── typed-model/ # Typed model definitions
├── support/ # Support utilities (NOT IN USE)
└── webhooks/ # Webhook handlers (NOT IN USE)
- Sequelize model declarations
- TypeScript type definitions
- Database migrations (Not in use)
- Shared database client instance
- Clone the repository:
git clone https://github.com/winible-betting/winible-typescript-models.git
- Install dependencies:
npm install
- Build the project:
npm run build
While this package includes migration files in the migrations/
directory, these migrations are currently not in use and should not be used. The migration system has been deprecated in favor of other database management approaches.
We use npm and semantic versioning for making changes to the models and sharing. We need to be extremely careful when making major changes because almost all of winible's project use the npm package and are reliant on its typescript or model declarations, some of them use the sequelize instance to make database calls, like the main backend or some of our lambda functions.
- Make the changes to the models needed
- PR your changes into main
- Get approvals
- Merge into main
- Release a new version:
-
npm version minor|major|patch
← please refer to the semantic versioning section for explanation- Most changes fall into a MINOR version category change (eg. updates to a existing data model, adding a new data model)
- Run
npm run publish
. Note: you will get an error but that's normal, you can ignore it.
-
- Push new version change to main
- Update the Database manually
- Update the package version on all needed repositories by:
- Manually changing the version on
package.json
- Using
npm run winible
- This will install the latest version of the package that being major, minor or patch
- Manually changing the version on
For more complex feature development that will require testing or major overhauls, we can use npm tag releases. Please follow the guide below:
After all testing is done and it's ready to release, make a regular release with all the changes.
Given a version number MAJOR.MINOR.PATCH, we increment the:
- MAJOR version when you make incompatible API changes (1.x.x)
- MINOR version when you add functionality in a backward compatible manner (x.1.x)
- PATCH version when you make backward compatible bug fixes (x.x.1)