Skip to content

Commit

Permalink
Barebones api introduction
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Bogart committed Feb 9, 2021
1 parent fc26337 commit 0bb6691
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 5 deletions.
6 changes: 4 additions & 2 deletions docs/.vuepress/config.ts
Expand Up @@ -6,9 +6,11 @@ const config = {

themeConfig: {
repo: "Batterii/fixture-riveter",

docsDir: "docs",
editLinkPattern: ":repo/edit/:branch/:path",

editLink: false,
lastUpdated: false,
contributors: false,

navbar: [
{
Expand Down
37 changes: 35 additions & 2 deletions docs/api/README.md
@@ -1,3 +1,36 @@
# API
---
sidebar: auto
title: API
---

This will discuss every inch of the internal API.
# Exports

`fixture-riveter` exposes a number of classes and an instance of the primary class `FixtureRiveter` for easy consumption. Each of these exports is discussed below.

```typescript
import {
// primary export
fr,
FixtureRiveter,

// ORM adapters
Adapter,
DefaultAdapter,
ObjectionAdapter,
SequelizeAdapter,

// object creation strategies
Strategy,
AttributesForStrategy,
BuildStrategy,
CreateStrategy,
} from "fixture-riveter";
```

## `fr` and `FixtureRiveter`

The primary method for consuming the library. (The `FixtureRiveter` constructor is exposed as well, in case you need to instantiate it yourself). The functionality is discussed further in [fr api](/api/fr/).

## `Adapter`

Instead of writing ORM-specific code for instancing and persisting created objects, we rely on this interface (and the following default implementation of it). This handles the two aforementioned aspects of `factory_bot`: creating an instance of a given model, and then persisting it to the database.
Empty file added docs/api/exports/README.md
Empty file.
7 changes: 7 additions & 0 deletions docs/api/fr/README.md
@@ -0,0 +1,7 @@
---
sidebar: auto
---

# `fr` instance

wow
4 changes: 4 additions & 0 deletions docs/changelog/README.md
@@ -1,3 +1,7 @@
---
sidebar: auto
---

# Changelog

All notable changes to this project will be documented in this file.
Expand Down
17 changes: 16 additions & 1 deletion lib/index.ts
@@ -1,13 +1,28 @@
import {FixtureRiveter} from "./fixture-riveter";

import {Adapter} from "./adapters/adapter";
import {DefaultAdapter} from "./adapters/default-adapter";
import {ObjectionAdapter} from "./adapters/objection-adapter";
import {FixtureRiveter} from "./fixture-riveter";
import {SequelizeAdapter} from "./adapters/sequelize-adapter";

import {Strategy} from "./strategies/strategy";
import {AttributesForStrategy} from "./strategies/attributes-for-strategy";
import {BuildStrategy} from "./strategies/build-strategy";
import {CreateStrategy} from "./strategies/create-strategy";

const fr = new FixtureRiveter();

export {
fr,
FixtureRiveter,

Adapter,
DefaultAdapter,
ObjectionAdapter,
SequelizeAdapter,

Strategy,
AttributesForStrategy,
BuildStrategy,
CreateStrategy,
};

0 comments on commit 0bb6691

Please sign in to comment.