@orpc/nest 0.0.0-next.d888fab → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -55
  2. package/dist/index.mjs +2 -7
  3. package/package.json +10 -10
package/README.md CHANGED
@@ -63,61 +63,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
63
63
 
64
64
  ## `@orpc/nest`
65
65
 
66
- Deeply integrate oRPC with [NestJS](https://nestjs.com/). Read the [documentation](https://orpc.unnoq.com/docs/openapi/nest/implement-contract) for more information.
67
-
68
- ### Implement Contract
69
-
70
- An overview of how to implement an [oRPC contract](https://orpc.unnoq.com/docs/contract-first/define-contract) in NestJS.
71
-
72
- ```ts
73
- import { Implement, implement, ORPCError } from '@orpc/nest'
74
-
75
- @Controller()
76
- export class PlanetController {
77
- /**
78
- * Implement a standalone procedure
79
- */
80
- @Implement(contract.planet.list)
81
- list() {
82
- return implement(contract.planet.list).handler(({ input }) => {
83
- // Implement logic here
84
-
85
- return []
86
- })
87
- }
88
-
89
- /**
90
- * Implement entire a contract
91
- */
92
- @Implement(contract.planet)
93
- planet() {
94
- return {
95
- list: implement(contract.planet.list).handler(({ input }) => {
96
- // Implement logic here
97
- return []
98
- }),
99
- find: implement(contract.planet.find).handler(({ input }) => {
100
- // Implement logic here
101
- return {
102
- id: 1,
103
- name: 'Earth',
104
- description: 'The planet Earth',
105
- }
106
- }),
107
- create: implement(contract.planet.create).handler(({ input }) => {
108
- // Implement logic here
109
- return {
110
- id: 1,
111
- name: 'Earth',
112
- description: 'The planet Earth',
113
- }
114
- }),
115
- }
116
- }
117
-
118
- // other handlers...
119
- }
120
- ```
66
+ Deeply integrate oRPC with [NestJS](https://nestjs.com/).
121
67
 
122
68
  ## Sponsors
123
69
 
package/dist/index.mjs CHANGED
@@ -3,10 +3,9 @@ import { toORPCError } from '@orpc/client';
3
3
  import { isContractProcedure, ContractProcedure, fallbackContractConfig } from '@orpc/contract';
4
4
  import { standardizeHTTPPath, StandardOpenAPISerializer, StandardOpenAPIJsonSerializer, StandardBracketNotationSerializer } from '@orpc/openapi-client/standard';
5
5
  import { StandardOpenAPICodec } from '@orpc/openapi/standard';
6
- import { getRouter, unlazy, isProcedure, createProcedureClient, ORPCError } from '@orpc/server';
6
+ import { getRouter, unlazy, isProcedure, call, ORPCError } from '@orpc/server';
7
7
  export { ORPCError, implement } from '@orpc/server';
8
8
  import { toArray, get } from '@orpc/shared';
9
- import { flattenHeader } from '@orpc/standard-server';
10
9
  import { toStandardLazyRequest, sendStandardResponse } from '@orpc/standard-server-node';
11
10
  import { mergeMap } from 'rxjs';
12
11
  import { toHttpPath } from '@orpc/client/standard';
@@ -108,14 +107,10 @@ class ImplementInterceptor {
108
107
  const standardResponse = await (async () => {
109
108
  let isDecoding = false;
110
109
  try {
111
- const client = createProcedureClient(procedure);
112
110
  isDecoding = true;
113
111
  const input = await codec.decode(standardRequest, flattenParams(req.params), procedure);
114
112
  isDecoding = false;
115
- const output = await client(input, {
116
- signal: standardRequest.signal,
117
- lastEventId: flattenHeader(standardRequest.headers["last-event-id"])
118
- });
113
+ const output = await call(procedure, input);
119
114
  return codec.encode(output, procedure);
120
115
  } catch (e) {
121
116
  const error = isDecoding && !(e instanceof ORPCError) ? new ORPCError("BAD_REQUEST", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/nest",
3
3
  "type": "module",
4
- "version": "0.0.0-next.d888fab",
4
+ "version": "0.0.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -28,7 +28,8 @@
28
28
  "@nestjs/core": ">=11.0.0",
29
29
  "express": ">=5.0.0",
30
30
  "fastify": ">=5.0.0",
31
- "rxjs": ">=7.0.0"
31
+ "rxjs": ">=7.0.0",
32
+ "@orpc/contract": "1.2.0"
32
33
  },
33
34
  "peerDependenciesMeta": {
34
35
  "express": {
@@ -39,14 +40,13 @@
39
40
  }
40
41
  },
41
42
  "dependencies": {
42
- "@orpc/client": "0.0.0-next.d888fab",
43
- "@orpc/contract": "0.0.0-next.d888fab",
44
- "@orpc/openapi": "0.0.0-next.d888fab",
45
- "@orpc/openapi-client": "0.0.0-next.d888fab",
46
- "@orpc/server": "0.0.0-next.d888fab",
47
- "@orpc/shared": "0.0.0-next.d888fab",
48
- "@orpc/standard-server": "0.0.0-next.d888fab",
49
- "@orpc/standard-server-node": "0.0.0-next.d888fab"
43
+ "@orpc/client": "1.2.0",
44
+ "@orpc/openapi": "1.2.0",
45
+ "@orpc/server": "1.2.0",
46
+ "@orpc/openapi-client": "1.2.0",
47
+ "@orpc/shared": "1.2.0",
48
+ "@orpc/standard-server": "1.2.0",
49
+ "@orpc/standard-server-node": "1.2.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@nestjs/common": "^11.1.0",