Socket
Socket
Sign inDemoInstall

@entity-factory/typeorm

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entity-factory/typeorm

TypeORM Adapter for entity-factory


Version published
Maintainers
1
Created
Source

Entity Factory Typeorm Adapter

Entity Factory is a library used for quickly creating fixture data from plain objects or classes using faker. Inspired by laravel's factories for generating test data.

The TypeormAdapter is used for creating mock data and automatically inserting persisting it to a database.

Documentation

Features

  • Generate plain javascript objects on demand
  • Generate objects with nested relations
  • Typeorm Support - Generate Entities and Persist Entities and nested relations

TypeORM Adapter

Installation

npm install --save @entity-factory/core @entity-factory/typeorm

TypeormAdapter

import { EntityFactory } from '@entity-factory/core';
import { TypeormAdapter } from '@entity-factory/typeorm';
import { Widget } from './entities/widget';

// use default connection from ormconfig.json
const typeormAdapter = new TypeormAdapter();

// or use any valid typeorm connection options
const typeormAdapter = new TypeormAdapter({
    type: 'sqlite',
    database: ':memory:',
    synchronize: true,
    entities: [Widget],
});

const factory = new EntityFactory({
    adapter: typeormAdapter,
});
  • opts: optional, any valid Typeorm Connection Options. If opts is omitted then the adapter will attempt to use the connection configured in ormconfig.json

Typeorm Blueprint

Available Options None

import { TypeormBlueprint } from '@entity-factory/typeorm';
import { Widget } from './entities/widget';

export class WidgetBlueprint extends TypeormBlueprint<Widget> {
    constructor() {
        super();

        this.type(Widget);

        this.define(async ({ faker, factory }) => {
            /* ... */
        });
    }
}

FAQs

Package last updated on 20 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc