-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from simplyStyle/main
- Loading branch information
Showing
16 changed files
with
168 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import type { Lucia } from './core.js'; | ||
|
||
export interface Register {} | ||
|
||
export type UserId = Register extends { | ||
UserId: infer _UserId; | ||
} | ||
? _UserId | ||
: string; | ||
|
||
export type RegisteredLucia = Register extends { | ||
Lucia: infer _Lucia; | ||
} | ||
? _Lucia extends Lucia<any, any> | ||
? _Lucia | ||
: Lucia | ||
: Lucia; | ||
|
||
export type RegisteredDatabaseUserAttributes = Register extends { | ||
DatabaseUserAttributes: infer _DatabaseUserAttributes; | ||
} | ||
? _DatabaseUserAttributes | ||
: {}; | ||
|
||
export type RegisteredDatabaseSessionAttributes = Register extends { | ||
DatabaseSessionAttributes: infer _DatabaseSessionAttributes; | ||
} | ||
? _DatabaseSessionAttributes | ||
: {}; | ||
|
||
export type RegisteredDatabaseAuthAttributes = Register extends { | ||
DatabaseAuthAttributes: infer _DatabaseAuthAttributes; | ||
} | ||
? _DatabaseAuthAttributes | ||
: {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/next-prisma/tests/__snapshots__/prisma-merge.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`merge prisma 1`] = ` | ||
"// *** GENERATED BY next-prisma :: DO NOT EDIT *** | ||
model User { | ||
id Int @unique | ||
name String | ||
content Int | ||
desc String | ||
} | ||
model Post { | ||
id String @unique | ||
name String | ||
}" | ||
`; | ||
|
||
exports[`merge prisma cover 1`] = ` | ||
"// *** GENERATED BY next-prisma :: DO NOT EDIT *** | ||
model User { | ||
id Int @unique | ||
name Int | ||
content String | ||
desc String | ||
} | ||
model Post { | ||
id String @unique | ||
name String | ||
}" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as fs from 'node:fs'; | ||
import { promisify } from 'node:util'; | ||
|
||
import { prismaMerge } from '../src/index.js'; | ||
|
||
const readFile = promisify(fs.readFile); | ||
|
||
test('merge prisma', async () => { | ||
const luciaPrismaContent = ` | ||
model User { | ||
id String @unique | ||
name String | ||
} | ||
`; | ||
|
||
await prismaMerge({ | ||
prePrismaModel: luciaPrismaContent, | ||
input: ['tests/prisma/test1.prisma'], | ||
output: 'tests/prisma/testMerge1.prisma', | ||
}); | ||
|
||
const prismaContent = await readFile('tests/prisma/testMerge1.prisma', { | ||
encoding: 'utf-8', | ||
}); | ||
expect(prismaContent).toMatchSnapshot(); | ||
}); | ||
|
||
test('merge prisma cover', async () => { | ||
const luciaPrismaContent = ` | ||
model User { | ||
id String @unique | ||
name String | ||
} | ||
`; | ||
|
||
await prismaMerge({ | ||
prePrismaModel: luciaPrismaContent, | ||
input: ['tests/prisma/test1.prisma', 'tests/prisma/test2.prisma'], | ||
output: 'tests/prisma/testMerge2.prisma', | ||
}); | ||
|
||
const prismaContent = await readFile('tests/prisma/testMerge2.prisma', { | ||
encoding: 'utf-8', | ||
}); | ||
expect(prismaContent).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
model User { | ||
id Int @unique | ||
content Int | ||
desc String | ||
} | ||
|
||
model Post { | ||
id String @unique | ||
name String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
model User { | ||
id Int @unique | ||
name Int | ||
content String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// *** GENERATED BY next-prisma :: DO NOT EDIT *** | ||
model User { | ||
id Int @unique | ||
name String | ||
content Int | ||
desc String | ||
} | ||
model Post { | ||
id String @unique | ||
name String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// *** GENERATED BY next-prisma :: DO NOT EDIT *** | ||
model User { | ||
id Int @unique | ||
name Int | ||
content String | ||
desc String | ||
} | ||
model Post { | ||
id String @unique | ||
name String | ||
} |
Oops, something went wrong.