Skip to content

Commit

Permalink
🎉 feat: 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Dec 23, 2024
1 parent 7b982cf commit 1a0b7ec
Show file tree
Hide file tree
Showing 11 changed files with 1,222 additions and 1,300 deletions.
Binary file modified bun.lockb
Binary file not shown.
19 changes: 14 additions & 5 deletions example/a.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { Elysia } from 'elysia'
import { Elysia, t } from 'elysia'
import { treaty } from '../src'

const app = new Elysia()
.get('', function* () {
return 'a'
.get('/error', ({ error }) => error("I'm a teapot", 'Kirifuji Nagisa'), {
response: {
200: t.Void(),
418: t.Literal('Kirifuji Nagisa'),
420: t.Literal('Snoop Dogg')
}
})
.listen(3000)

const { data } = await treaty(app).index.get()
app._routes.error

data
const a = treaty(app)

const { data, error } = await a.error.get()

console.log(data?.image)
166 changes: 83 additions & 83 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
{
"name": "@elysiajs/eden",
"version": "1.1.3",
"description": "Fully type-safe Elysia client",
"author": {
"name": "saltyAom",
"url": "https://github.com/SaltyAom",
"email": "[email protected]"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"exports": {
"./package.json": "./package.json",
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"node": "./dist/index.js",
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./treaty": {
"require": "./dist/treaty.js",
"import": "./dist/treaty.mjs",
"node": "./dist/treaty.js",
"default": "./dist/treaty.js",
"types": "./dist/treaty/index.d.ts"
},
"./treaty2": {
"require": "./dist/2.js",
"import": "./dist/treaty2.mjs",
"node": "./dist/treaty2.js",
"default": "./dist/treaty2.js",
"types": "./dist/treaty2/index.d.ts"
},
"./fetch": {
"require": "./dist/fetch.js",
"import": "./dist/fetch.mjs",
"node": "./dist/fetch.js",
"default": "./dist/fetch.js",
"types": "./dist/fetch/index.d.ts"
}
},
"types": "./dist/index.d.ts",
"keywords": [
"elysia",
"eden",
"connector"
],
"homepage": "https://github.com/elysiajs/eden",
"repository": {
"type": "git",
"url": "https://github.com/elysiajs/eden"
},
"bugs": "https://github.com/elysiajs/eden/issues",
"license": "MIT",
"scripts": {
"dev": "bun run --watch example/index.ts",
"test": "bun test && bun test:types",
"test:types": "tsc --project tsconfig.test.json",
"build": "rimraf dist && tsup",
"release": "npm run build && npm run test && npm publish --access public"
},
"peerDependencies": {
"elysia": ">= 1.1.0"
},
"devDependencies": {
"@elysiajs/cors": "0.7.0",
"@types/bun": "^1.0.3",
"@types/node": "^18.15.5",
"elysia": ">= 1.1.0",
"esbuild": "^0.19.3",
"eslint": "^8.26.0",
"expect-type": "^0.17.3",
"rimraf": "^4.4.1",
"tsup": "^8.1.0",
"typescript": "^5.4.5",
"vite": "^5.3.3"
},
"prettier": {
"semi": false,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none"
}
"name": "@elysiajs/eden",
"version": "1.2.0-rc.0",
"description": "Fully type-safe Elysia client",
"author": {
"name": "saltyAom",
"url": "https://github.com/SaltyAom",
"email": "[email protected]"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"exports": {
"./package.json": "./package.json",
".": {
"require": "./dist/index.js",
"import": "./dist/index.mjs",
"node": "./dist/index.js",
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./treaty": {
"require": "./dist/treaty.js",
"import": "./dist/treaty.mjs",
"node": "./dist/treaty.js",
"default": "./dist/treaty.js",
"types": "./dist/treaty/index.d.ts"
},
"./treaty2": {
"require": "./dist/2.js",
"import": "./dist/treaty2.mjs",
"node": "./dist/treaty2.js",
"default": "./dist/treaty2.js",
"types": "./dist/treaty2/index.d.ts"
},
"./fetch": {
"require": "./dist/fetch.js",
"import": "./dist/fetch.mjs",
"node": "./dist/fetch.js",
"default": "./dist/fetch.js",
"types": "./dist/fetch/index.d.ts"
}
},
"types": "./dist/index.d.ts",
"keywords": [
"elysia",
"eden",
"connector"
],
"homepage": "https://github.com/elysiajs/eden",
"repository": {
"type": "git",
"url": "https://github.com/elysiajs/eden"
},
"bugs": "https://github.com/elysiajs/eden/issues",
"license": "MIT",
"scripts": {
"dev": "bun run --watch example/index.ts",
"test": "bun test && bun test:types",
"test:types": "tsc --project tsconfig.test.json",
"build": "rimraf dist && tsup",
"release": "npm run build && npm run test && npm publish --access public"
},
"peerDependencies": {
"elysia": ">= 1.2.0-rc.0"
},
"devDependencies": {
"@elysiajs/cors": "1.2.0-rc.0",
"@types/bun": "^1.1.14",
"@types/node": "^20.17.0",
"elysia": "1.2.0-rc.0",
"esbuild": "^0.19.3",
"eslint": "^8.26.0",
"expect-type": "^1.1.0",
"rimraf": "^4.4.1",
"tsup": "^8.3.5",
"typescript": "^5.7.2",
"vite": "^6.0.5"
},
"prettier": {
"semi": false,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none"
}
}
2 changes: 1 addition & 1 deletion src/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const handleResponse = async (response: Response, retry: () => any) => {
}

export const edenFetch =
<App extends Elysia<any, any, any, any, any, any, any, any>>(
<App extends Elysia<any, any, any, any, any, any, any>>(
server: string,
config?: EdenFetch.Config
): EdenFetch.Create<App> =>
Expand Down
2 changes: 1 addition & 1 deletion src/fetch/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
} from '../types'

export namespace EdenFetch {
export type Create<App extends Elysia<any, any, any, any, any, any, any, any>> =
export type Create<App extends Elysia<any, any, any, any, any, any, any>> =
App extends {
_routes: infer Schema extends Record<string, unknown>
}
Expand Down
2 changes: 1 addition & 1 deletion src/treaty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ const createProxy = (
}) as unknown as Record<string, unknown>

export const edenTreaty = <
App extends Elysia<any, any, any, any, any, any, any, any>
App extends Elysia<any, any, any, any, any, any, any>
>(
domain: string,
config: EdenTreaty.Config = {
Expand Down
2 changes: 1 addition & 1 deletion src/treaty/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type MaybeArray<T> = T | T[]

export namespace EdenTreaty {
export type Create<
App extends Elysia<any, any, any, any, any, any, any, any>
App extends Elysia<any, any, any, any, any, any, any>
> = App extends {
_routes: infer Schema extends Record<string, unknown>
}
Expand Down
6 changes: 3 additions & 3 deletions src/treaty2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ const createProxy = (
append(key, JSON.stringify(value))
continue
}


append(key, `${value}`)
}
}
Expand Down Expand Up @@ -468,7 +468,7 @@ const createProxy = (
}) as any

export const treaty = <
const App extends Elysia<any, any, any, any, any, any, any, any>
const App extends Elysia<any, any, any, any, any, any, any>
>(
domain: string | App,
config: Treaty.Config = {}
Expand Down
Loading

0 comments on commit 1a0b7ec

Please sign in to comment.