@orpc/nest 2.0.0-beta.2 → 2.0.0-beta.4
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 +2 -2
- package/dist/index.mjs +10 -10
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -134,7 +134,6 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
134
134
|
</tr>
|
|
135
135
|
<tr>
|
|
136
136
|
<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>
|
|
137
|
-
<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>
|
|
138
137
|
<td align="center"><a href="https://github.com/finom?ref=orpc" target="_blank" rel="noopener" title="Andrey Gubanov"><img src="https://avatars.githubusercontent.com/u/1082083?u=29e91400dbd4a9c217048a8f59562c4f740498e6&v=4" width="119" alt="Andrey Gubanov"/><br />Andrey Gubanov</a></td>
|
|
139
138
|
</tr>
|
|
140
139
|
</table>
|
|
@@ -151,7 +150,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
151
150
|
<a href="https://github.com/theoludwig?ref=orpc" target="_blank" rel="noopener" title="Théo LUDWIG"><img src="https://avatars.githubusercontent.com/u/25207499?u=a6a9653725a2f574c07893748806668e0598cdbe&v=4" width="32" height="32" alt="Théo LUDWIG" /></a>
|
|
152
151
|
<a href="https://github.com/abhay-ramesh?ref=orpc" target="_blank" rel="noopener" title="Abhay Ramesh"><img src="https://avatars.githubusercontent.com/u/66196314?u=c5c2b0327b26606c2efcfaf17046ab18c3d25c57&v=4" width="32" height="32" alt="Abhay Ramesh" /></a>
|
|
153
152
|
<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>
|
|
154
|
-
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=
|
|
153
|
+
<a href="https://github.com/johngerome?ref=orpc" target="_blank" rel="noopener" title="0x4e32"><img src="https://avatars.githubusercontent.com/u/2002000?u=505e54608466ab53754f702973687b04c6424c1f&v=4" width="32" height="32" alt="0x4e32" /></a>
|
|
155
154
|
<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>
|
|
156
155
|
<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>
|
|
157
156
|
<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>
|
|
@@ -173,6 +172,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
173
172
|
<a href="https://github.com/illarionvk?ref=orpc" target="_blank" rel="noopener" title="Illarion Koperski"><img src="https://avatars.githubusercontent.com/u/5012724?u=7cfa13652f7ac5fb3c56d880e3eb3fbe40c3ea34&v=4" width="32" height="32" alt="Illarion Koperski" /></a>
|
|
174
173
|
<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="32" height="32" alt="Anees Iqbal" /></a>
|
|
175
174
|
<a href="https://github.com/Scrumplex?ref=orpc" target="_blank" rel="noopener" title="Sefa Eyeoglu"><img src="https://avatars.githubusercontent.com/u/11587657?u=ab503582165c0bbff0cca47ce31c9450bb1553c9&v=4" width="32" height="32" alt="Sefa Eyeoglu" /></a>
|
|
175
|
+
<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="32" height="32" alt="nattstack" /></a>
|
|
176
176
|
<a href="https://github.com/ChromeGG?ref=orpc" target="_blank" rel="noopener" title="Adam Tkaczyk"><img src="https://avatars.githubusercontent.com/u/39050595?u=a58ca6042a6950e94e6e92442db76ef584279bc0&v=4" width="32" height="32" alt="Adam Tkaczyk" /></a>
|
|
177
177
|
<a href="https://github.com/plancraft?ref=orpc" target="_blank" rel="noopener" title="plancraft"><img src="https://avatars.githubusercontent.com/u/46482287?v=4" width="32" height="32" alt="plancraft" /></a>
|
|
178
178
|
</p>
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { getOpenAPIMeta, DEFAULT_OPENAPI_METHOD, getDynamicPathParams } from '@o
|
|
|
6
6
|
import { OpenAPIHandlerCodecCore } from '@orpc/openapi/standard';
|
|
7
7
|
import { DEFAULT_SUCCESS_STATUS, getRouter, unlazy, Procedure } from '@orpc/server';
|
|
8
8
|
import { StandardHandler } from '@orpc/server/standard';
|
|
9
|
-
import { get, isAsyncIteratorObject, stringifyJSON } from '@orpc/shared';
|
|
9
|
+
import { mergeHttpPath, get, isAsyncIteratorObject, stringifyJSON } from '@orpc/shared';
|
|
10
10
|
import { flattenStandardHeader, generateContentDisposition } from '@standardserver/core';
|
|
11
11
|
import { toStandardLazyRequest, toEventStream } from '@standardserver/node';
|
|
12
12
|
import { mergeMap } from 'rxjs';
|
|
@@ -77,19 +77,19 @@ const MethodDecoratorMap = {
|
|
|
77
77
|
function Implement(contract) {
|
|
78
78
|
if (contract instanceof ProcedureContract) {
|
|
79
79
|
const meta = getOpenAPIMeta(contract);
|
|
80
|
-
|
|
81
|
-
const path = meta?.path;
|
|
82
|
-
const successStatus = meta?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
83
|
-
if (path === void 0) {
|
|
80
|
+
if (meta?.path === void 0) {
|
|
84
81
|
throw new TypeError(`
|
|
85
82
|
@Implement decorator requires contract to have a 'openapi.path' meta.
|
|
86
83
|
Please define one using '.meta(openapi({ path: '/example' }))'.
|
|
87
|
-
Or use "
|
|
84
|
+
Or use "populateRouterContractOpenAPIPaths" from "@orpc/openapi" utility to automatically fill in any missing paths.
|
|
88
85
|
`);
|
|
89
86
|
}
|
|
87
|
+
const method = meta.method ?? DEFAULT_OPENAPI_METHOD;
|
|
88
|
+
const path = toNestPattern(meta.prefix ? mergeHttpPath(meta.prefix, meta.path) : meta.path);
|
|
89
|
+
const successStatus = meta.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
90
90
|
return (target, propertyKey, descriptor) => {
|
|
91
91
|
applyDecorators(
|
|
92
|
-
MethodDecoratorMap[method](
|
|
92
|
+
MethodDecoratorMap[method](path),
|
|
93
93
|
HttpCode(successStatus),
|
|
94
94
|
UseInterceptors(ImplementInterceptor)
|
|
95
95
|
)(target, propertyKey, descriptor);
|
|
@@ -237,11 +237,11 @@ function flattenParamValue(value) {
|
|
|
237
237
|
return Array.isArray(value) ? value.join("/") : value;
|
|
238
238
|
}
|
|
239
239
|
function toORPCOpenAPIParams(contract, params) {
|
|
240
|
-
const
|
|
241
|
-
if (!params ||
|
|
240
|
+
const meta = getOpenAPIMeta(contract);
|
|
241
|
+
if (!params || meta?.path === void 0) {
|
|
242
242
|
return void 0;
|
|
243
243
|
}
|
|
244
|
-
const dynamicParams = getDynamicPathParams(path);
|
|
244
|
+
const dynamicParams = getDynamicPathParams(meta.prefix ? mergeHttpPath(meta.prefix, meta.path) : meta.path);
|
|
245
245
|
if (!dynamicParams) {
|
|
246
246
|
return void 0;
|
|
247
247
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/nest",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@orpc/client": "2.0.0-beta.3",
|
|
41
|
-
"@orpc/contract": "2.0.0-beta.3",
|
|
42
|
-
"@orpc/openapi": "2.0.0-beta.3",
|
|
43
|
-
"@orpc/server": "2.0.0-beta.3",
|
|
44
|
-
"@orpc/shared": "2.0.0-beta.3",
|
|
40
|
+
"@orpc/client": "^2.0.0-beta.3",
|
|
41
|
+
"@orpc/contract": "^2.0.0-beta.3",
|
|
42
|
+
"@orpc/openapi": "^2.0.0-beta.3",
|
|
43
|
+
"@orpc/server": "^2.0.0-beta.3",
|
|
44
|
+
"@orpc/shared": "^2.0.0-beta.3",
|
|
45
45
|
"@standardserver/core": "^0.0.25",
|
|
46
46
|
"@standardserver/node": "^0.0.25"
|
|
47
47
|
},
|