@orpc/nest 2.0.0-beta.2 → 2.0.0-beta.3
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 +1 -1
- package/dist/index.mjs +10 -10
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -151,7 +151,7 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
151
151
|
<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
152
|
<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
153
|
<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=
|
|
154
|
+
<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
155
|
<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
156
|
<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
157
|
<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>
|
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.3",
|
|
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
|
},
|