Repository: Quramy/prisma-fabbrica (ts)

Issue:
export interfaces on defineXFactory
First of all, really like the look of this library. Hoping to switch to it from our current solution.

However having an issue with creating reusable factory templates and exporting them (e.g. for overriding defaults across several different test files). For example:

```Typescript
export const factory = defineUserFactory({
  defaultData: async () => ({
    displayName: faker.name.fullName().slice(0, 30),
    email: faker.internet.email().slice(0, 100),
  }),
});
```

Current fails to compile with `Exported variable 'factory' has or is using name 'UserFactoryInterface' from external module "<dir>/src/factories/__generated__/fabbrica/index" but cannot be named.`. This would be solvable by being able to import `UserFactoryInterface`, however the generated factories don't export these interfaces. 

Is it possible to either:
- Export the related interfaces for each `defineXFactory`, so they can be imported into another file?
- For me to do this in a better way that doesn't require that above?

Thanks for your time!

Pull request:
fix: Export ModelFactoryInterface
It closes #101 

Patch:
diff --git a/examples/example-prj/src/__generated__/fabbrica/index.d.ts b/examples/example-prj/src/__generated__/fabbrica/index.d.ts
index a741263..8a6ea03 100644
--- a/examples/example-prj/src/__generated__/fabbrica/index.d.ts
+++ b/examples/example-prj/src/__generated__/fabbrica/index.d.ts
@@ -20,7 +20,7 @@ type UserFactoryDefineInput = {
 type UserFactoryDefineOptions = {
     defaultData?: Resolver<UserFactoryDefineInput, BuildDataOptions>;
 };
-interface UserFactoryInterface {
+export interface UserFactoryInterface {
     readonly _factoryFor: "User";
     build(inputData?: Partial<Prisma.UserCreateInput>): PromiseLike<Prisma.UserCreateInput>;
     buildCreateInput(inputData?: Partial<Prisma.UserCreateInput>): PromiseLike<Prisma.UserCreateInput>;
@@ -53,7 +53,7 @@ type PostFactoryDefineInput = {
 type PostFactoryDefineOptions = {
     defaultData: Resolver<PostFactoryDefineInput, BuildDataOptions>;
 };
-interface PostFactoryInterface {
+export interface PostFactoryInterface {
     readonly _factoryFor: "Post";
     build(inputData?: Partial<Prisma.PostCreateInput>): PromiseLike<Prisma.PostCreateInput>;
     buildCreateInput(inputData?: Partial<Prisma.PostCreateInput>): PromiseLike<Prisma.PostCreateInput>;
@@ -89,7 +89,7 @@ type CommentFactoryDefineInput = {
 type CommentFactoryDefineOptions = {
     defaultData: Resolver<CommentFactoryDefineInput, BuildDataOptions>;
 };
-interface CommentFactoryInterface {
+export interface CommentFactoryInterface {
     readonly _factoryFor: "Comment";
     build(inputData?: Partial<Prisma.CommentCreateInput>): PromiseLike<Prisma.CommentCreateInput>;
     buildCreateInput(inputData?: Partial<Prisma.CommentCreateInput>): PromiseLike<Prisma.CommentCreateInput>;
@@ -114,7 +114,7 @@ type CategoryFactoryDefineInput = {
 type CategoryFactoryDefineOptions = {
     defaultData?: Resolver<CategoryFactoryDefineInput, BuildDataOptions>;
 };
-interface CategoryFactoryInterface {
+export interface CategoryFactoryInterface {
     readonly _factoryFor: "Category";
     build(inputData?: Partial<Prisma.CategoryCreateInput>): PromiseLike<Prisma.CategoryCreateInput>;
     buildCreateInput(inputData?: Partial<Prisma.CategoryCreateInput>): PromiseLike<Prisma.CategoryCreateInput>;
diff --git a/packages/prisma-fabbrica/src/templates/index.ts b/packages/prisma-fabbrica/src/templates/index.ts
index dd9f07a..44904de 100644
--- a/packages/prisma-fabbrica/src/templates/index.ts
+++ b/packages/prisma-fabbrica/src/templates/index.ts
@@ -232,7 +232,7 @@ export const modelFactoryDefineOptions = (modelName: string, isOpionalDefaultDat
 
 export const modelFactoryInterface = (model: DMMF.Model) =>
   template.statement`
-    interface MODEL_FACTORY_INTERFACE {
+    export interface MODEL_FACTORY_INTERFACE {
       readonly _factoryFor: ${() => ast.literalTypeNode(ast.stringLiteral(model.name))}
       build(inputData?: Partial<Prisma.MODEL_CREATE_INPUT>): PromiseLike<Prisma.MODEL_CREATE_INPUT>
       buildCreateInput(inputData?: Partial<Prisma.MODEL_CREATE_INPUT>): PromiseLike<Prisma.MODEL_CREATE_INPUT>


Test patch:
diff --git a/examples/example-prj/src/sample.test.ts b/examples/example-prj/src/sample.test.ts
index 76abcbd..8e1c451 100644
--- a/examples/example-prj/src/sample.test.ts
+++ b/examples/example-prj/src/sample.test.ts
@@ -2,9 +2,9 @@ import { defineUserFactory, definePostFactory } from "./__generated__/fabbrica";
 
 const prisma = jestPrisma.client;
 
-const UserFactory = defineUserFactory();
+export const UserFactory = defineUserFactory();
 
-const PostFactory = definePostFactory({
+export const PostFactory = definePostFactory({
   defaultData: {
     author: UserFactory,
   },
diff --git a/packages/prisma-fabbrica/src/templates/__snapshots__/getSourceFile.test.ts.snap b/packages/prisma-fabbrica/src/templates/__snapshots__/getSourceFile.test.ts.snap
index addab28..48474f3 100644
--- a/packages/prisma-fabbrica/src/templates/__snapshots__/getSourceFile.test.ts.snap
+++ b/packages/prisma-fabbrica/src/templates/__snapshots__/getSourceFile.test.ts.snap
@@ -30,7 +30,7 @@ type UserFactoryDefineOptions = {
     defaultData?: Resolver<UserFactoryDefineInput, BuildDataOptions>;
 };
 
-interface UserFactoryInterface {
+export interface UserFactoryInterface {
     readonly _factoryFor: "User";
     build(inputData?: Partial<Prisma.UserCreateInput>): PromiseLike<Prisma.UserCreateInput>;
     buildCreateInput(inputData?: Partial<Prisma.UserCreateInput>): PromiseLike<Prisma.UserCreateInput>;