@orpc/nest 1.14.0 → 1.14.2
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.
- package/README.md +7 -4
- package/dist/index.mjs +20 -5
- package/package.json +15 -10
package/README.md
CHANGED
|
@@ -139,7 +139,6 @@ If you find oRPC valuable and would like to support its development, you can do
|
|
|
139
139
|
<table>
|
|
140
140
|
<tr>
|
|
141
141
|
<td align="center"><a href="https://misskey.io/?ref=orpc" target="_blank" rel="noopener" title="村上さん"><img src="https://avatars.githubusercontent.com/u/37681609?u=0dd4c7e4ba937cbb52b068c55914b1d8164dc0c7&v=4" width="209" alt="村上さん"/><br />村上さん</a></td>
|
|
142
|
-
<td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="209" alt="christ12938"/><br />christ12938</a></td>
|
|
143
142
|
</tr>
|
|
144
143
|
</table>
|
|
145
144
|
|
|
@@ -165,13 +164,13 @@ If you find oRPC valuable and would like to support its development, you can do
|
|
|
165
164
|
<tr>
|
|
166
165
|
<td align="center"><a href="https://github.com/dcramer?ref=orpc" target="_blank" rel="noopener" title="David Cramer"><img src="https://avatars.githubusercontent.com/u/23610?v=4" width="139" alt="David Cramer"/><br />David Cramer</a></td>
|
|
167
166
|
<td align="center"><a href="https://github.com/valerii15298?ref=orpc" target="_blank" rel="noopener" title="Valerii Petryniak"><img src="https://avatars.githubusercontent.com/u/44531564?u=88ac74d9bacd20401518441907acad21063cd397&v=4" width="139" alt="Valerii Petryniak"/><br />Valerii Petryniak</a></td>
|
|
168
|
-
<td align="center"><a href="https://github.com/happyboy2022?ref=orpc" target="_blank" rel="noopener" title="happyboy"><img src="https://avatars.githubusercontent.com/u/103669586?u=65b49c4b893ed3703909fbb3a7a22313f3f9c121&v=4" width="139" alt="happyboy"/><br />happyboy</a></td>
|
|
169
167
|
<td align="center"><a href="https://github.com/letstri?ref=orpc" target="_blank" rel="noopener" title="Valerii Strilets"><img src="https://avatars.githubusercontent.com/u/13253748?u=c7b10399ccc8f8081e24db94ec32cd9858e86ac3&v=4" width="139" alt="Valerii Strilets"/><br />Valerii Strilets</a></td>
|
|
170
168
|
<td align="center"><a href="https://github.com/K-Mistele?ref=orpc" target="_blank" rel="noopener" title="Kyle Mistele"><img src="https://avatars.githubusercontent.com/u/18430555?u=3afebeb81de666e35aaac3ed46f14159d7603ffb&v=4" width="139" alt="Kyle Mistele"/><br />Kyle Mistele</a></td>
|
|
171
169
|
<td align="center"><a href="https://github.com/andrewpeters9?ref=orpc" target="_blank" rel="noopener" title="Andrew Peters"><img src="https://avatars.githubusercontent.com/u/36251325?v=4" width="139" alt="Andrew Peters"/><br />Andrew Peters</a></td>
|
|
170
|
+
<td align="center"><a href="https://github.com/R44VC0RP?ref=orpc" target="_blank" rel="noopener" title="Ryan Vogel"><img src="https://avatars.githubusercontent.com/u/89211796?u=1857347b9787d8d8a7ea5bfc333f96be92d5a683&v=4" width="139" alt="Ryan Vogel"/><br />Ryan Vogel</a></td>
|
|
172
171
|
</tr>
|
|
173
172
|
<tr>
|
|
174
|
-
<td align="center"><a href="https://github.com/
|
|
173
|
+
<td align="center"><a href="https://github.com/christ12938?ref=orpc" target="_blank" rel="noopener" title="christ12938"><img src="https://avatars.githubusercontent.com/u/25758598?v=4" width="139" alt="christ12938"/><br />christ12938</a></td>
|
|
175
174
|
<td align="center"><a href="https://github.com/peter-adam-dy?ref=orpc" target="_blank" rel="noopener" title="Peter Adam"><img src="https://avatars.githubusercontent.com/u/132129459?u=4f3dbbb3b443990b56acb7d6a5d11ed2c555f6db&v=4" width="139" alt="Peter Adam"/><br />Peter Adam</a></td>
|
|
176
175
|
<td align="center"><a href="https://github.com/yukimotochern?ref=orpc" target="_blank" rel="noopener" title="Chen, Zhi-Yuan"><img src="https://avatars.githubusercontent.com/u/20896173?u=945c33fc21725e4d566a0d02afc54b136ca1d67a&v=4" width="139" alt="Chen, Zhi-Yuan"/><br />Chen, Zhi-Yuan</a></td>
|
|
177
176
|
<td align="center"><a href="https://github.com/Ryanjso?ref=orpc" target="_blank" rel="noopener" title="Ryan Soderberg"><img src="https://avatars.githubusercontent.com/u/39172778?u=5ed913c31d57e7221b75784abcad48c7ebddde27&v=4" width="139" alt="Ryan Soderberg"/><br />Ryan Soderberg</a></td>
|
|
@@ -196,9 +195,12 @@ If you find oRPC valuable and would like to support its development, you can do
|
|
|
196
195
|
<td align="center"><a href="https://github.com/Titoine?ref=orpc" target="_blank" rel="noopener" title="Titoine"><img src="https://avatars.githubusercontent.com/u/3514286?u=1bb1e86b0c99c8a1121372e56d51a177eea12191&v=4" width="119" alt="Titoine"/><br />Titoine</a></td>
|
|
197
196
|
<td align="center"><a href="https://github.com/Mnigos?ref=orpc" target="_blank" rel="noopener" title="Igor Makowski"><img src="https://avatars.githubusercontent.com/u/56691628?u=ee8c879478f7c151b9156aef6c74243fa3e247a8&v=4" width="119" alt="Igor Makowski"/><br />Igor Makowski</a></td>
|
|
198
197
|
<td align="center"><a href="https://github.com/steelbrain?ref=orpc" target="_blank" rel="noopener" title="Anees Iqbal"><img src="https://avatars.githubusercontent.com/u/4278113?u=22b80b5399eed68ac76cd58b02961b0481f1db11&v=4" width="119" alt="Anees Iqbal"/><br />Anees Iqbal</a></td>
|
|
199
|
-
<td align="center"><a href="https://github.com/hanayashiki?ref=orpc" target="_blank" rel="noopener" title="wang chenyu"><img src="https://avatars.githubusercontent.com/u/26056783?u=
|
|
198
|
+
<td align="center"><a href="https://github.com/hanayashiki?ref=orpc" target="_blank" rel="noopener" title="wang chenyu"><img src="https://avatars.githubusercontent.com/u/26056783?u=06c3b9205a16fd41a871e82da1cc2a09306d53f5&v=4" width="119" alt="wang chenyu"/><br />wang chenyu</a></td>
|
|
200
199
|
<td align="center"><a href="https://github.com/piscis?ref=orpc" target="_blank" rel="noopener" title="Alex"><img src="https://avatars.githubusercontent.com/u/326163?u=b245f368bd940cf51d08c0b6bf55f8257f359437&v=4" width="119" alt="Alex"/><br />Alex</a></td>
|
|
201
200
|
</tr>
|
|
201
|
+
<tr>
|
|
202
|
+
<td align="center"><a href="https://github.com/nattstack?ref=orpc" target="_blank" rel="noopener" title="nattstack"><img src="https://avatars.githubusercontent.com/u/31426677?u=fa9dbb8b3e66eb0ea3c88db5dc07f31c8c5418fe&v=4" width="119" alt="nattstack"/><br />nattstack</a></td>
|
|
203
|
+
</tr>
|
|
202
204
|
</table>
|
|
203
205
|
|
|
204
206
|
### Past Sponsors
|
|
@@ -215,6 +217,7 @@ If you find oRPC valuable and would like to support its development, you can do
|
|
|
215
217
|
<a href="https://github.com/shr-ink?ref=orpc" target="_blank" rel="noopener" title="shr.ink oü"><img src="https://avatars.githubusercontent.com/u/139700438?v=4" width="32" height="32" alt="shr.ink oü" /></a>
|
|
216
218
|
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=24e8dd943cfc862aa284d858a023532c75071ade&v=4" width="32" height="32" alt="0x4e32" /></a>
|
|
217
219
|
<a href="https://github.com/yzuyr?ref=orpc" target="_blank" rel="noopener" title="Ryuz"><img src="https://avatars.githubusercontent.com/u/196539378?u=d38374588d219b6748b16406982f6559411466d4&v=4" width="32" height="32" alt="Ryuz" /></a>
|
|
220
|
+
<a href="https://github.com/happyboy2022?ref=orpc" target="_blank" rel="noopener" title="happyboy"><img src="https://avatars.githubusercontent.com/u/103669586?u=65b49c4b893ed3703909fbb3a7a22313f3f9c121&v=4" width="32" height="32" alt="happyboy" /></a>
|
|
218
221
|
<a href="https://github.com/YiCChi?ref=orpc" target="_blank" rel="noopener" title="yicchi"><img src="https://avatars.githubusercontent.com/u/86967274?u=6c2756f09fe15dd94d572f560e979cd157982852&v=4" width="32" height="32" alt="yicchi" /></a>
|
|
219
222
|
<a href="https://github.com/cloudycotton?ref=orpc" target="_blank" rel="noopener" title="Saksham"><img src="https://avatars.githubusercontent.com/u/168998965?u=9b9634a5aed66a51c1b880663272725b00b92b14&v=4" width="32" height="32" alt="Saksham" /></a>
|
|
220
223
|
<a href="https://github.com/hrynevychroman?ref=orpc" target="_blank" rel="noopener" title="Roman Hrynevych"><img src="https://avatars.githubusercontent.com/u/82209198?u=1a1d111ab3d589855b9cc8a7fefb1b5c6a4fbbaf&v=4" width="32" height="32" alt="Roman Hrynevych" /></a>
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getRouter, unlazy, isProcedure, implement as implement$1 } from '@orpc/server';
|
|
2
2
|
export { ORPCError, onError, onFinish, onStart, onSuccess } from '@orpc/server';
|
|
3
|
-
import { Module,
|
|
3
|
+
import { Module, applyDecorators, Options, Delete, Patch, Put, Post, Get, Head, HttpCode, UseInterceptors, Injectable, Inject, Optional } from '@nestjs/common';
|
|
4
4
|
import { isContractProcedure, fallbackContractConfig } from '@orpc/contract';
|
|
5
5
|
export { populateContractRouterPaths } from '@orpc/contract';
|
|
6
6
|
import { standardizeHTTPPath, StandardOpenAPISerializer, StandardOpenAPIJsonSerializer, StandardBracketNotationSerializer } from '@orpc/openapi-client/standard';
|
|
@@ -8,6 +8,7 @@ import { StandardOpenAPICodec } from '@orpc/openapi/standard';
|
|
|
8
8
|
import { StandardHandler } from '@orpc/server/standard';
|
|
9
9
|
import { get, toArray, intercept } from '@orpc/shared';
|
|
10
10
|
import * as StandardServerFastify from '@orpc/standard-server-fastify';
|
|
11
|
+
import * as StandardServerFetch from '@orpc/standard-server-fetch';
|
|
11
12
|
import * as StandardServerNode from '@orpc/standard-server-node';
|
|
12
13
|
import { mergeMap } from 'rxjs';
|
|
13
14
|
|
|
@@ -75,7 +76,8 @@ const MethodDecoratorMap = {
|
|
|
75
76
|
POST: Post,
|
|
76
77
|
PUT: Put,
|
|
77
78
|
PATCH: Patch,
|
|
78
|
-
DELETE: Delete
|
|
79
|
+
DELETE: Delete,
|
|
80
|
+
OPTIONS: Options
|
|
79
81
|
};
|
|
80
82
|
function Implement(contract) {
|
|
81
83
|
if (isContractProcedure(contract)) {
|
|
@@ -141,7 +143,17 @@ let ImplementInterceptor = class {
|
|
|
141
143
|
}
|
|
142
144
|
const req = ctx.switchToHttp().getRequest();
|
|
143
145
|
const res = ctx.switchToHttp().getResponse();
|
|
144
|
-
const
|
|
146
|
+
const isHono = "finalized" in res && typeof res.newResponse === "function";
|
|
147
|
+
const isFastify = "raw" in req && !isHono;
|
|
148
|
+
const standardRequest = (() => {
|
|
149
|
+
if (isHono) {
|
|
150
|
+
return StandardServerFetch.toStandardLazyRequest(req.raw);
|
|
151
|
+
}
|
|
152
|
+
if (isFastify) {
|
|
153
|
+
return StandardServerFastify.toStandardLazyRequest(req, res);
|
|
154
|
+
}
|
|
155
|
+
return StandardServerNode.toStandardLazyRequest(req, res);
|
|
156
|
+
})();
|
|
145
157
|
const handler = new StandardHandler(procedure, {
|
|
146
158
|
init: () => {
|
|
147
159
|
},
|
|
@@ -160,7 +172,10 @@ let ImplementInterceptor = class {
|
|
|
160
172
|
toArray(this.config.sendResponseInterceptors),
|
|
161
173
|
{ request: req, response: res, standardResponse: result.response },
|
|
162
174
|
async ({ response, standardResponse }) => {
|
|
163
|
-
if (
|
|
175
|
+
if (isHono) {
|
|
176
|
+
const fetchResponse = StandardServerFetch.toFetchResponse(standardResponse, this.config);
|
|
177
|
+
return response.newResponse(fetchResponse.body, fetchResponse);
|
|
178
|
+
} else if (isFastify) {
|
|
164
179
|
await StandardServerFastify.sendStandardResponse(response, standardResponse, this.config);
|
|
165
180
|
} else {
|
|
166
181
|
await StandardServerNode.sendStandardResponse(response, standardResponse, this.config);
|
|
@@ -179,7 +194,7 @@ ImplementInterceptor = __decorateClass([
|
|
|
179
194
|
], ImplementInterceptor);
|
|
180
195
|
function flattenParams(params) {
|
|
181
196
|
const flatten = {};
|
|
182
|
-
for (const [key, value] of Object.entries(params)) {
|
|
197
|
+
for (const [key, value] of Object.entries(params ?? {})) {
|
|
183
198
|
if (Array.isArray(value)) {
|
|
184
199
|
flatten[key] = value.join("/");
|
|
185
200
|
} else {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/nest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"keywords": [
|
|
13
13
|
"orpc"
|
|
14
14
|
],
|
|
15
|
+
"sideEffects": false,
|
|
15
16
|
"exports": {
|
|
16
17
|
".": {
|
|
17
18
|
"types": "./dist/index.d.mts",
|
|
@@ -38,18 +39,21 @@
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"@orpc/client": "1.14.
|
|
42
|
-
"@orpc/openapi": "1.14.
|
|
43
|
-
"@orpc/openapi-client": "1.14.
|
|
44
|
-
"@orpc/shared": "1.14.
|
|
45
|
-
"@orpc/
|
|
46
|
-
"@orpc/standard-server": "1.14.
|
|
47
|
-
"@orpc/contract": "1.14.
|
|
48
|
-
"@orpc/server": "1.14.
|
|
49
|
-
"@orpc/standard-server-
|
|
42
|
+
"@orpc/client": "1.14.2",
|
|
43
|
+
"@orpc/openapi": "1.14.2",
|
|
44
|
+
"@orpc/openapi-client": "1.14.2",
|
|
45
|
+
"@orpc/shared": "1.14.2",
|
|
46
|
+
"@orpc/server": "1.14.2",
|
|
47
|
+
"@orpc/standard-server-fastify": "1.14.2",
|
|
48
|
+
"@orpc/contract": "1.14.2",
|
|
49
|
+
"@orpc/standard-server": "1.14.2",
|
|
50
|
+
"@orpc/standard-server-fetch": "1.14.2",
|
|
51
|
+
"@orpc/standard-server-node": "1.14.2"
|
|
50
52
|
},
|
|
51
53
|
"devDependencies": {
|
|
52
54
|
"@fastify/cookie": "^11.0.2",
|
|
55
|
+
"@hono/node-server": "^1.19.11",
|
|
56
|
+
"@mnigos/platform-hono": "^0.1.3",
|
|
53
57
|
"@nestjs/common": "^11.1.16",
|
|
54
58
|
"@nestjs/core": "^11.1.16",
|
|
55
59
|
"@nestjs/platform-express": "^11.1.16",
|
|
@@ -59,6 +63,7 @@
|
|
|
59
63
|
"@types/express": "^5.0.6",
|
|
60
64
|
"express": "^5.2.1",
|
|
61
65
|
"fastify": "^5.8.3",
|
|
66
|
+
"hono": "^4.10.7",
|
|
62
67
|
"rxjs": "^7.8.2",
|
|
63
68
|
"supertest": "^7.1.4",
|
|
64
69
|
"zod": "^4.3.6"
|