This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update workspace, refactor codes and ready for start development again * Rewrite core logic * Fix type inferrence with nullable * Resolve promise value * Rewrite integration with errors plugin * Split relay integration * Improve types for t.effectConnection * Add prisma integration * Change api. only keep t.effect * Add one case which using Drizzle ORM * Symlink README.md * Update README.md * Update test case * Write contributing, migration docs * Setup changesets * setup codecov * Enable corepack * Add cache input * Fix ci * Add codecov badge
- Loading branch information
Showing
87 changed files
with
7,614 additions
and
9,888 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) |
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 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "restricted", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
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 @@ | ||
{ | ||
"mode": "pre", | ||
"tag": "next", | ||
"initialVersions": { | ||
"pothos-plugin-effect": "0.8.0" | ||
}, | ||
"changesets": [ | ||
"tricky-months-protect" | ||
] | ||
} |
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 @@ | ||
--- | ||
"pothos-plugin-effect": major | ||
--- | ||
|
||
1.0 |
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,3 @@ | ||
[*.ts] | ||
indent_style = space | ||
indent_size = 2 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request_target: | ||
types: [assigned, opened, synchronize, reopened] | ||
push: | ||
branches: | ||
- main | ||
- next | ||
|
||
jobs: | ||
test: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- run: corepack enable | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.tool-versions' | ||
cache: 'yarn' | ||
|
||
- name: Install Dependencies | ||
run: yarn | ||
|
||
- name: Run Test | ||
run: yarn test --coverage | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
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 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- next | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
||
- run: corepack enable | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.tool-versions' | ||
cache: 'yarn' | ||
|
||
- name: Install Dependencies | ||
run: yarn | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
version: yarn changeset version | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
**/node_modules | ||
**/dist | ||
dev.db | ||
src/tests/fixtures/prisma-client | ||
|
||
.idea/ | ||
.idea/ | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
**/coverage |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
nodejs 20.11.0 |
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,3 @@ | ||
{ | ||
"recommendations": ["editorconfig.editorconfig", "biomejs.biome"] | ||
} |
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
{ | ||
"prettier.enable": false, | ||
"editor.formatOnSave": true, | ||
"eslint.format.enable": true, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint" | ||
}, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
"editor.defaultFormatter": "biomejs.biome", | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"[markdown]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
} |
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,2 @@ | ||
nmMode: hardlinks-global | ||
nodeLinker: node-modules |
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 |
---|---|---|
@@ -1,13 +1,9 @@ | ||
## Install | ||
# Contributing Guide | ||
|
||
```sh | ||
pnpm install | ||
``` | ||
## Install Node.js | ||
|
||
## Run tests | ||
Install the version of Node.js specified in `.tool-versions`. It doesn't matter how, I personally recommend to use asdf-vm for manage Node.js version. | ||
|
||
```sh | ||
pnpm test | ||
``` | ||
## Run Test | ||
|
||
This command will be remove `./prisma/dev.db` (if exists), run `prisma db push` to create new `dev.db` and setup database data to running test cases about Prisma plugin integration. | ||
You can run `vitest` using `yarn test` in project root. Write test cases for major changes. |
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,54 @@ | ||
# Migration from v0.x | ||
|
||
The 1.0 release contains a large number of breaking changes. If you're using [email protected] (thanksfully), follow the instructions below. | ||
|
||
## `t.effect` is not field builder. | ||
|
||
`t.effect` is provided as a utility function rather than in the field builder. Use `t.effect` inside any kind of Pothos field resolver function to resolve the Effect. | ||
|
||
```ts | ||
t.int({ | ||
resolve: () => t.effect(Effect.succeed(1)), | ||
}); | ||
``` | ||
|
||
## Removed service/context/layer configuration options at field level. | ||
|
||
Instead, you can [configure a custom effect runtime](/README.md#configure-custom-runtime). | ||
|
||
## Removed `t.effectConnection` | ||
|
||
Instead, you can directly use the `resolveArrayConnection`/`resolveCursorConnection`/`resolveOffsetConnection` which imported from [`@pothos/plugin-relay`](https://pothos-graphql.dev/docs/plugins/relay), with `t.effect`. Below is an example code for using `resolveArrayConnection`: | ||
|
||
```ts | ||
t.connection({ | ||
type: "String", | ||
resolve: async (_root, args) => { | ||
return resolveArrayConnection( | ||
{ args }, | ||
await t.effect(Effect.succeed(["1", "2", "3", "4"])) | ||
); | ||
}, | ||
}); | ||
``` | ||
|
||
## Removed `t.prismaEffect` (aka Prisma Integration) | ||
|
||
`t.effect` works even if the end result of the Effect is a Promise. | ||
|
||
```ts | ||
t.prismaField({ | ||
type: "User", | ||
resolve: (query) => | ||
t.effect( | ||
pipe( | ||
PrismaClient, | ||
Effect.map((prisma) => prisma.user.findFirstOrThrow({ ...query })) | ||
) | ||
), | ||
}); | ||
``` | ||
|
||
## Removed error type inferring | ||
|
||
Removed `errors.types` inference functionality provided by integration with the errors plugin. |
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 @@ | ||
./packages/pothos-plugin-effect/README.md |
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json", | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"formatter": { | ||
"indentWidth": 2, | ||
"indentStyle": "space" | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true, | ||
"style": { | ||
"noUnusedTemplateLiteral": "off" | ||
}, | ||
"suspicious": { | ||
"noExplicitAny": "off", | ||
"noShadowRestrictedNames": "off", | ||
"noEmptyInterface": "off", | ||
"noRedeclare": "off" | ||
}, | ||
"complexity": { | ||
"noBannedTypes": "off" | ||
} | ||
} | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single", | ||
"jsxQuoteStyle": "double", | ||
"semicolons": "always" | ||
} | ||
} | ||
} |
Empty file.
Oops, something went wrong.