Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamchanii committed Jun 21, 2023
1 parent 89ae883 commit 11f98f2
Show file tree
Hide file tree
Showing 14 changed files with 3,017 additions and 1,111 deletions.
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
# pothos-plugin-effect

Status: WIP
Status: WIP

## Installation

```bash
# @effect/io and @effect/data is peer-dependencies.
pnpm add pothos-plugin-effect @effect/io @effect/data
```

## Setup

```ts
import EffectPlugin from 'pothos-plugin-effect';

new SchemaBuilder<{
EffectDefaultLayer: Layer.Layer<never, never, Random>;
EffectDefaultContext: Context.Context<Random>;
EffectDefaultServices: Random;
}>({
plugins: [EffectPlugin],
effectOptions: {
defaultLayer: (context) => Layer.succeed(Random, {}),
defaultContext: (context) => Context.empty(),
defaultServices: (context) => [
[Random, (_context) => Random.of({ next: () => Effect.succeed(0.5) })],
],
},
});
```

## Usage

```typescript
t.effect({
type: 'String',
effect: {
services: (_context) => [
[Random, (_context) => Random.of({ next: () => Effect.succeed(0.5) })],
],
context: (_context) => Context.empty({}),
layer: (_context) => Layer.succeed({}),
},
resolve: () =>
pipe(
Random,
Effect.flatMap(random => random.next()),
Effect.map(value =>
value > 0.5
? Effect.succeed('Lucky!')
: Effect.succeed('Nah')
),
),
});
```

## Licenses

MIT
11 changes: 11 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
],
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
};
50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,57 @@
"registiry": "https://registry.npmjs.org"
},
"version": "0.0.0",
"sideEffects": false,
"type": "module",
"files": [
"package.json",
"README.md",
"dist"
],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"type": "module",
"main": "./dist/index.mjs",
"exports": {
".": {
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
"require": "./dist/index.mjs",
"import": "./dist/index.mjs"
}
},
"scripts": {
"dev": "vite build --watch",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "vite build && tsc --emitDeclarationOnly",
"test": "NODE_OPTIONS=--experimental-vm-modules pnpm jest",
"build": "nanobundle build",
"prepack": "pnpm build"
},
"keywords": [],
"author": "",
"license": "ISC",
"keywords": [
"effect",
"pothos",
"plugin"
],
"author": {
"name": "Chanhee Lee",
"email": "iamchanii.0310@gmail.com"
},
"license": "MIT",
"devDependencies": {
"@effect/data": "^0.12.9",
"@effect/io": "^0.26.1",
"@pothos/core": "^3.30.0",
"@swc/core": "^1.3.66",
"@swc/jest": "^0.2.26",
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"eslint": "^8.43.0",
"eslint-plugin-dprint-integration": "^0.3.0",
"eslint-plugin-perfectionist": "^1.4.0",
"graphql": "^16.6.0",
"graphql-yoga": "^4.0.1",
"tsm": "^2.3.0",
"typescript": "^5.1.3",
"vite": "^4.3.9",
"vitest": "^0.32.2"
"jest": "^29.5.0",
"nanobundle": "^1.6.0",
"typescript": "^5.1.3"
},
"peerDependencies": {
"@effect/data": "^0",
"@effect/io": "^0",
"@pothos/core": "^3",
"graphql": "^16"
},
"pnpm": {
"overrides": {
"graphql": "16.6.0",
"@pothos/core@*>graphql": "$graphql"
}
"graphql": "^16 || ^17"
}
}
Loading

0 comments on commit 11f98f2

Please sign in to comment.