# flowize

> Generate FlowJs Types from Sequelize model definitions

Latest version **0.0.3** (published 2021-01-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install flowize
pnpm add flowize
yarn add flowize
bun add flowize
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-01-19 |
| First published | 2021-01-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kadir Goktas |
| Maintainers | kadirgoktas |
| Keywords | FlowJs, Flow, Sequelize, Types |

## Links

- npm: https://www.npmjs.com/package/flowize
- Repository: https://github.com/ridakk/flowize
- Homepage: https://github.com/ridakk/flowize#readme
- Issues: https://github.com/ridakk/flowize/issues
- npm.io page: https://npm.io/package/flowize

## Dependencies (2)

- [dot](https://npm.io/package/dot.md) ^1.1.3
- [prettier](https://npm.io/package/prettier.md) 2.2.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2021-01-19
- 0.0.2 — 2021-01-18
- 0.0.1 — 2021-01-18

## README

# flowize

Generate FlowJs Types from Sequelize model definitions

## Usage

```js
const flowize = require('flowize');
const sequelize = require('sequelize');

(async () => {
  // make sure sequelize models are initialized and associated

  await flowize(sequelize, {
    outputPath: `${__dirname}/flow-typed`,
    typePrefix: 'Type',
    excludedModelNames: ['audit'],
    typePerField: true,
  });

  process.exit();
})();
```

For below sequelize models;

```js
class Task extends Model {}
Task.init({ 
  title: Sequelize.STRING,
},
{ sequelize, modelName: 'task' });

class User extends Model {}
User.init({
  username: Sequelize.STRING
},
{ sequelize, modelName: 'user' });

User.hasMany(Task);
Task.belongsTo(User);
```

below FlowJs definitions will be created under `outputPath` option with in `<typePrefix><model name>.js` format.

TypeTitle.js

```js
declare type TypeTaskId = number;
declare type TypeTaskTitle = string;

type Title = {|
  id: TypeTaskId,
  title: TypeTaskTitle,
  userId: TypeUserId,
  user: TypeUser,
|};

declare type TypeTitle = $Shape<Title>;
```

TypeUser.js

```js
declare type TypeUserId = number;

type User = {|
  id: TypeUserId,
  tasks: TypeTitle[],
|};

declare type TypeUser = $Shape<User>;
```

---
_Source: https://npm.io/package/flowize · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
