@orpc/openapi 2.0.0-beta.37 → 2.0.0-beta.39
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 +13 -5
- package/dist/adapters/aws-lambda/index.mjs +2 -2
- package/dist/adapters/fastify/index.mjs +2 -2
- package/dist/adapters/fetch/index.mjs +3 -3
- package/dist/adapters/node/index.mjs +2 -2
- package/dist/adapters/standard/index.mjs +3 -3
- package/dist/index.mjs +3 -5
- package/dist/shared/{openapi.DPmbXebg.mjs → openapi.BBMnAJGy.mjs} +2 -2
- package/dist/shared/{openapi.DI39r-Ta.mjs → openapi.D0jfrG14.mjs} +1 -1
- package/dist/shared/{openapi.DAmA59tr.mjs → openapi.zZxYUkc8.mjs} +7 -5
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -38,11 +38,11 @@ You can read the documentation [here](https://orpc.dev).
|
|
|
38
38
|
|
|
39
39
|
**Schema validation**
|
|
40
40
|
|
|
41
|
-
| Package | Purpose
|
|
42
|
-
| ------------------------------------------------------------ |
|
|
43
|
-
| [@orpc/zod](https://www.npmjs.com/package/@orpc/zod) |
|
|
44
|
-
| [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot) |
|
|
45
|
-
| [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype) |
|
|
41
|
+
| Package | Purpose | Docs |
|
|
42
|
+
| ------------------------------------------------------------ | ---------------------------------------------------------- | ----------------------------------------------------- |
|
|
43
|
+
| [@orpc/zod](https://www.npmjs.com/package/@orpc/zod) | JSON Schema converter for [Zod](https://zod.dev/). | [Zod](https://orpc.dev/docs/integrations/zod) |
|
|
44
|
+
| [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot) | JSON Schema converter for [Valibot](https://valibot.dev/). | [Valibot](https://orpc.dev/docs/integrations/valibot) |
|
|
45
|
+
| [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype) | JSON Schema converter for [ArkType](https://arktype.io/). | [ArkType](https://orpc.dev/docs/integrations/arktype) |
|
|
46
46
|
|
|
47
47
|
**Built-in features**
|
|
48
48
|
|
|
@@ -103,6 +103,14 @@ Like what we build over at [middleapi](https://github.com/middleapi)? You can he
|
|
|
103
103
|
</tr>
|
|
104
104
|
</table>
|
|
105
105
|
|
|
106
|
+
### Premium Sponsors
|
|
107
|
+
|
|
108
|
+
<table>
|
|
109
|
+
<tr>
|
|
110
|
+
<td align="center"><a href="https://github.com/nexa-ca?ref=middleapi&utm_source=middleapi&utm_medium=sponsor" target="_blank" rel="noopener sponsored" title="Nexa"><img src="https://avatars.githubusercontent.com/u/199146462?v=4" width="209" alt="Nexa"/><br />Nexa</a></td>
|
|
111
|
+
</tr>
|
|
112
|
+
</table>
|
|
113
|
+
|
|
106
114
|
### Organization Sponsors
|
|
107
115
|
|
|
108
116
|
<table>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AwsLambdaHandler } from '@orpc/server/aws-lambda';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.D0jfrG14.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
|
-
import '../../shared/openapi.
|
|
8
|
+
import '../../shared/openapi.zZxYUkc8.mjs';
|
|
9
9
|
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FastifyHandler } from '@orpc/server/fastify';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.D0jfrG14.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
|
-
import '../../shared/openapi.
|
|
8
|
+
import '../../shared/openapi.zZxYUkc8.mjs';
|
|
9
9
|
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FetchHandler } from '@orpc/server/fetch';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.D0jfrG14.mjs';
|
|
4
4
|
import { FetchLinkTransport } from '@orpc/client/fetch';
|
|
5
5
|
import { StandardLink } from '@orpc/client/standard';
|
|
6
|
-
import { O as OpenAPILinkCodec } from '../../shared/openapi.
|
|
6
|
+
import { O as OpenAPILinkCodec } from '../../shared/openapi.BBMnAJGy.mjs';
|
|
7
7
|
import '@orpc/client';
|
|
8
8
|
import '@orpc/server';
|
|
9
9
|
import '@orpc/shared';
|
|
10
10
|
import '@standard-server/core';
|
|
11
|
-
import '../../shared/openapi.
|
|
11
|
+
import '../../shared/openapi.zZxYUkc8.mjs';
|
|
12
12
|
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
13
13
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
14
14
|
import 'rou3';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { NodeHttpHandler } from '@orpc/server/node';
|
|
2
2
|
import { StandardHandler } from '@orpc/server/standard';
|
|
3
|
-
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.
|
|
3
|
+
import { O as OpenAPIHandlerCodec } from '../../shared/openapi.D0jfrG14.mjs';
|
|
4
4
|
import '@orpc/client';
|
|
5
5
|
import '@orpc/server';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@standard-server/core';
|
|
8
|
-
import '../../shared/openapi.
|
|
8
|
+
import '../../shared/openapi.zZxYUkc8.mjs';
|
|
9
9
|
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
10
10
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
11
11
|
import 'rou3';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.
|
|
2
|
-
export { O as OpenAPILinkCodec } from '../../shared/openapi.
|
|
1
|
+
export { O as OpenAPIHandlerCodec, a as OpenAPIHandlerCodecCore, b as OpenAPIMatcher, s as serializeHeaders } from '../../shared/openapi.D0jfrG14.mjs';
|
|
2
|
+
export { O as OpenAPILinkCodec } from '../../shared/openapi.BBMnAJGy.mjs';
|
|
3
3
|
import '@orpc/client';
|
|
4
4
|
import '@orpc/server';
|
|
5
5
|
import '@orpc/shared';
|
|
6
6
|
import '@standard-server/core';
|
|
7
|
-
import '../../shared/openapi.
|
|
7
|
+
import '../../shared/openapi.zZxYUkc8.mjs';
|
|
8
8
|
import '../../shared/openapi.B2G-HeFn.mjs';
|
|
9
9
|
import '../../shared/openapi.B9PQzqBn.mjs';
|
|
10
10
|
import 'rou3';
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { B as BracketNotationSerializer } from './shared/openapi.B2G-HeFn.mjs';
|
|
2
2
|
import { createContractClientFactory, getAsyncIteratorObjectSchemaDetails, ProcedureContract, resolveMetaPlugins } from '@orpc/contract';
|
|
3
|
-
import { D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE, i as isBodylessMethod, O as OpenAPISerializer, g as getDynamicPathParams } from './shared/openapi.
|
|
4
|
-
export { d as OpenAPIJsonSerializer } from './shared/openapi.
|
|
3
|
+
import { D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, c as DEFAULT_OPENAPI_SUCCESS_DESCRIPTION, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE, i as isBodylessMethod, O as OpenAPISerializer, g as getDynamicPathParams } from './shared/openapi.zZxYUkc8.mjs';
|
|
4
|
+
export { d as OpenAPIJsonSerializer } from './shared/openapi.zZxYUkc8.mjs';
|
|
5
5
|
import { g as getOpenAPIMeta, o as openapi } from './shared/openapi.B9PQzqBn.mjs';
|
|
6
6
|
import { downgradeSpecV32ToV31, downgradeSpecV31ToV30 } from '@openapi-spec/downgrader';
|
|
7
7
|
import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
@@ -604,11 +604,10 @@ function buildErrorResponse(ctx, operation, def) {
|
|
|
604
604
|
properties: {
|
|
605
605
|
defined: { const: false },
|
|
606
606
|
code: { type: "string" },
|
|
607
|
-
status: { type: "number" },
|
|
608
607
|
message: { type: "string" },
|
|
609
608
|
data: {}
|
|
610
609
|
},
|
|
611
|
-
required: ["defined", "code", "
|
|
610
|
+
required: ["defined", "code", "message"]
|
|
612
611
|
});
|
|
613
612
|
for (const [status, definitions] of definitionsByStatus.entries()) {
|
|
614
613
|
const descriptions = definitions.map(({ defaultMessage }) => defaultMessage).filter((m) => m !== void 0);
|
|
@@ -624,7 +623,6 @@ function buildErrorResponse(ctx, operation, def) {
|
|
|
624
623
|
...combineJsonObjectSchemaEntries([
|
|
625
624
|
["defined", { const: true }, false],
|
|
626
625
|
["code", { const: code }, false],
|
|
627
|
-
["status", { const: status }, false],
|
|
628
626
|
// avoid using the defaultMessage here to improve component reusability
|
|
629
627
|
["message", { type: "string" }, false],
|
|
630
628
|
["data", ctx.registry.hoistDefs(dataJsonSchema, "output"), dataOptional]
|
|
@@ -4,9 +4,9 @@ import { unlazy } from '@orpc/server';
|
|
|
4
4
|
import { value, pathToHttpPath, mergeHttpPath, isTypescriptObject, stringifyJSON, safeEncodeURIComponent } from '@orpc/shared';
|
|
5
5
|
import { mergeStandardHeaders, parseStandardUrl } from '@standard-server/core';
|
|
6
6
|
import { toStandardHeaders } from '@standard-server/fetch';
|
|
7
|
-
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer, D as DEFAULT_OPENAPI_METHOD, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, g as getDynamicPathParams, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.zZxYUkc8.mjs';
|
|
8
8
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
9
|
-
import { s as serializeHeaders } from './openapi.
|
|
9
|
+
import { s as serializeHeaders } from './openapi.D0jfrG14.mjs';
|
|
10
10
|
|
|
11
11
|
const END_SLASH_REGEX = /\/$/;
|
|
12
12
|
class OpenAPILinkCodec {
|
|
@@ -2,7 +2,7 @@ import { COMMON_ERROR_STATUS_MAP } from '@orpc/client';
|
|
|
2
2
|
import { walkProcedureContractsSync, Procedure, unlazy, getRouter, createContractProcedure, DEFAULT_SUCCESS_STATUS, DEFAULT_ERROR_STATUS } from '@orpc/server';
|
|
3
3
|
import { value, pathToHttpPath, mergeHttpPath, normalizeHttpPath, safeDecodeURIComponent, NullProtoObj, isTypescriptObject, isPlainObject, stringifyJSON, getOwn, parseEmptyableJSON } from '@orpc/shared';
|
|
4
4
|
import { parseStandardUrl } from '@standard-server/core';
|
|
5
|
-
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.
|
|
5
|
+
import { D as DEFAULT_OPENAPI_METHOD, g as getDynamicPathParams, O as OpenAPISerializer, a as DEFAULT_OPENAPI_INPUT_STRUCTURE, i as isBodylessMethod, b as DEFAULT_OPENAPI_OUTPUT_STRUCTURE } from './openapi.zZxYUkc8.mjs';
|
|
6
6
|
import { g as getOpenAPIMeta } from './openapi.B9PQzqBn.mjs';
|
|
7
7
|
import { createRouter, addRoute, findRoute, routeToRegExp } from 'rou3';
|
|
8
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { wrapAsyncIteratorPreservingEventMeta, toORPCError, isORPCErrorJson, createORPCErrorFromJson } from '@orpc/client';
|
|
2
|
-
import { isPlainObject, NullProtoObj, isAsyncIteratorObject } from '@orpc/shared';
|
|
2
|
+
import { isPlainObject, NullProtoObj, copyOnWrite, isAsyncIteratorObject } from '@orpc/shared';
|
|
3
3
|
import { ErrorEvent } from '@standard-server/core';
|
|
4
4
|
import { B as BracketNotationSerializer } from './openapi.B2G-HeFn.mjs';
|
|
5
5
|
|
|
@@ -199,14 +199,16 @@ class OpenAPIJsonSerializer {
|
|
|
199
199
|
return data;
|
|
200
200
|
}
|
|
201
201
|
deserialize(serialized) {
|
|
202
|
-
const ref = {
|
|
202
|
+
const ref = { json: serialized.json };
|
|
203
203
|
if (serialized.blobs?.length) {
|
|
204
204
|
for (let i = 0; i < serialized.maps.length; i++) {
|
|
205
205
|
const segments = serialized.maps[i];
|
|
206
|
+
let original = serialized;
|
|
206
207
|
let currentRef = ref;
|
|
207
|
-
let preSegment = "
|
|
208
|
+
let preSegment = "json";
|
|
208
209
|
for (let j = 0; j < segments.length; j++) {
|
|
209
|
-
|
|
210
|
+
original = original[preSegment];
|
|
211
|
+
currentRef = copyOnWrite(currentRef, preSegment, original);
|
|
210
212
|
preSegment = segments[j];
|
|
211
213
|
if (!Object.hasOwn(currentRef, preSegment)) {
|
|
212
214
|
throw new TypeError(`Invalid OpenAPI serialized data: segment "${preSegment}" does not exist.`);
|
|
@@ -215,7 +217,7 @@ class OpenAPIJsonSerializer {
|
|
|
215
217
|
currentRef[preSegment] = serialized.blobs[i];
|
|
216
218
|
}
|
|
217
219
|
}
|
|
218
|
-
return ref.
|
|
220
|
+
return ref.json;
|
|
219
221
|
}
|
|
220
222
|
}
|
|
221
223
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.39",
|
|
5
5
|
"description": "Generate OpenAPI specs from oRPC routers and serve OpenAPI-compliant APIs with end-to-end type safety",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": [
|
|
@@ -99,11 +99,11 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@openapi-spec/downgrader": "~0.1.0",
|
|
101
101
|
"@openapi-spec/types": "~0.1.0",
|
|
102
|
-
"@orpc/client": "2.0.0-beta.
|
|
103
|
-
"@orpc/contract": "2.0.0-beta.
|
|
104
|
-
"@orpc/json-schema": "2.0.0-beta.
|
|
105
|
-
"@orpc/server": "2.0.0-beta.
|
|
106
|
-
"@orpc/shared": "2.0.0-beta.
|
|
102
|
+
"@orpc/client": "2.0.0-beta.39",
|
|
103
|
+
"@orpc/contract": "2.0.0-beta.39",
|
|
104
|
+
"@orpc/json-schema": "2.0.0-beta.39",
|
|
105
|
+
"@orpc/server": "2.0.0-beta.39",
|
|
106
|
+
"@orpc/shared": "2.0.0-beta.39",
|
|
107
107
|
"@standard-server/core": "~0.9.2",
|
|
108
108
|
"@standard-server/fetch": "~0.9.2",
|
|
109
109
|
"rou3": "^0.9.1"
|