MCPcopy Index your code
hub / github.com/antonversal/typeorm-factory

github.com/antonversal/typeorm-factory @0.0.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.0.9 ↗ · + Follow
49 symbols 80 edges 11 files 10 documented · 20% updated 2y ago★ 615 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

typeorm-factory

typeorm-factory is a factory library for typeorm. It supports all databases that uses typeorm's Repository, so it doesn't support MongoDB, a pull request are welcome.

Installation

Node.js:

npm install --save-dev typeorm-factory
# or
yarn add --dev typeorm-factory

Usage

# be sure a typeorm connection is opened before create a factory
import { Factory } from "../../src/Factory";

const CommentFactory = new Factory(Comment)
  .sequence("text", (i) => `text ${i}`)
  .attr("authorName", "John Doe");

const AuthorFactory = new Factory(Author)
  .sequence("firstName", (i) => `John ${i}`)
  .sequence("lastName", (i) => `Doe ${i}`);

const PostFactory = new Factory(Post)
  .sequence("title", (i) => `title ${i}`)
  .sequence("text", (i) => `text ${i}`)
  .attr("likesCount", 10)
  .assocMany("comments", CommentFactory, 2)
  .assocOne("author", AuthorFactory);

const build = async () => {
  console.log(await PostFactory.build())
  console.log(await PostFactory.build({ text: 'Foo' }))
  console.log(await PostFactory.buildList(10))

  console.log(await PostFactory.create({ author: AuthorFactory.create() }))
  console.log(await PostFactory.createList(1))
}

build()

Extension points exported contracts — how you extend this code

IConstructable (Interface)
(no doc)
src/Factory.ts

Core symbols most depended-on inside this repo

build
called by 14
src/Factory.ts
sequence
called by 5
src/Factory.ts
create
called by 5
src/Factory.ts
attr
called by 4
src/Factory.ts
clone
called by 3
src/Factory.ts
value
called by 2
src/Sequence.ts
buildList
called by 2
src/Factory.ts
createList
called by 2
src/Factory.ts

Shape

Method 29
Class 16
Function 2
Enum 1
Interface 1

Languages

TypeScript100%

Modules by API surface

src/Factory.ts16 symbols
src/Sequence.ts6 symbols
src/FactoryAttribute.ts6 symbols
src/AssocOneAttribute.ts6 symbols
src/AssocManyAttribute.ts6 symbols
__tests__/fixtures/entity/Post.ts3 symbols
__tests__/support/cleaner.ts2 symbols
__tests__/fixtures/entity/Comment.ts2 symbols
__tests__/fixtures/entity/Author.ts2 symbols

For agents

$ claude mcp add typeorm-factory \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact