@orpc/openapi 2.0.0-beta.21 → 2.0.0-beta.23
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 +5 -5
- package/dist/adapters/fetch/index.d.mts +3 -3
- package/dist/adapters/fetch/index.d.ts +3 -3
- package/dist/adapters/fetch/index.mjs +4 -4
- package/dist/adapters/node/index.d.mts +2 -2
- package/dist/adapters/node/index.d.ts +2 -2
- package/dist/adapters/node/index.mjs +3 -3
- package/dist/adapters/standard/index.d.mts +10 -46
- package/dist/adapters/standard/index.d.ts +10 -46
- package/dist/adapters/standard/index.mjs +4 -4
- package/dist/extensions/route.d.mts +2 -2
- package/dist/extensions/route.d.ts +2 -2
- package/dist/helpers/index.mjs +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/shared/{openapi.zZH_UksW.mjs → openapi.0yE-t1W-.mjs} +113 -38
- package/dist/shared/{openapi.C-p_Q2lb.mjs → openapi.B48raJ3F.mjs} +6 -5
- package/dist/shared/openapi.BWJ1qv3c.d.ts +47 -0
- package/dist/shared/{openapi.CVgUshDP.mjs → openapi.BaqI61Xi.mjs} +88 -39
- package/dist/shared/{openapi.ByT4oUeY.d.mts → openapi.Bsz7d8xx.d.mts} +1 -1
- package/dist/shared/{openapi.ByT4oUeY.d.ts → openapi.Bsz7d8xx.d.ts} +1 -1
- package/dist/shared/{openapi.hg_rhZ4x.d.mts → openapi.COG_72WY.d.mts} +1 -1
- package/dist/shared/openapi.CTxN9oam.d.mts +47 -0
- package/dist/shared/{openapi.B6hEbRyF.d.ts → openapi.D7Fpk6aV.d.ts} +5 -3
- package/dist/shared/{openapi.BOOA-bde.d.mts → openapi.DBFXInk5.d.mts} +6 -1
- package/dist/shared/{openapi.BOOA-bde.d.ts → openapi.DBFXInk5.d.ts} +6 -1
- package/dist/shared/{openapi.BafbB3uM.d.mts → openapi.Dam82YDK.d.mts} +5 -3
- package/dist/shared/{openapi.DNNo0V-l.d.ts → openapi.Du7gMjyF.d.ts} +1 -1
- package/dist/shared/{openapi.Bt87OzTt.mjs → openapi.s_p5sN-P.mjs} +20 -15
- package/package.json +8 -8
|
@@ -4,7 +4,7 @@ import { StandardHandlerCodec, StandardHandlerHandleOptions, StandardHandlerCode
|
|
|
4
4
|
import { Value, Promisable } from '@orpc/shared';
|
|
5
5
|
import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
|
|
6
6
|
import { AnyProcedureContract } from '@orpc/contract';
|
|
7
|
-
import { O as OpenAPISerializer } from './openapi.
|
|
7
|
+
import { O as OpenAPISerializer } from './openapi.DBFXInk5.mjs';
|
|
8
8
|
|
|
9
9
|
interface OpenAPIMatcherOptions {
|
|
10
10
|
/**
|
|
@@ -18,7 +18,7 @@ declare class OpenAPIMatcher {
|
|
|
18
18
|
private readonly filter;
|
|
19
19
|
private readonly rootRouter;
|
|
20
20
|
private readonly tree;
|
|
21
|
-
private pendingLazyRouters;
|
|
21
|
+
private readonly pendingLazyRouters;
|
|
22
22
|
constructor(router: AnyRouter, options?: OpenAPIMatcherOptions);
|
|
23
23
|
private index;
|
|
24
24
|
match(method: string, pathname: `/${string}`, prefix: `/${string}` | undefined): Promise<{
|
|
@@ -26,8 +26,10 @@ declare class OpenAPIMatcher {
|
|
|
26
26
|
procedure: AnyProcedure;
|
|
27
27
|
params?: Record<string, string> | undefined;
|
|
28
28
|
} | undefined>;
|
|
29
|
-
private matchPathname;
|
|
30
29
|
private resolvePendingLazyRouters;
|
|
30
|
+
private loadPendingLazyRouters;
|
|
31
|
+
private loadPendingLazyRouter;
|
|
32
|
+
private indexPendingLazyRouter;
|
|
31
33
|
private resolveProcedure;
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -2,7 +2,7 @@ import { AnySchema, ErrorMap, MetaPlugin, AnyProcedureContract } from '@orpc/con
|
|
|
2
2
|
import { Lazy } from '@orpc/server';
|
|
3
3
|
import { Value } from '@orpc/shared';
|
|
4
4
|
import { StandardBodyHint } from '@standardserver/core';
|
|
5
|
-
import {
|
|
5
|
+
import { d as OpenAPIOperationObject } from './openapi.Bsz7d8xx.js';
|
|
6
6
|
|
|
7
7
|
interface OpenAPIMeta {
|
|
8
8
|
/**
|
|
@@ -6,21 +6,22 @@ class BracketNotationSerializer {
|
|
|
6
6
|
this.maxExplicitDeserializingArrayIndex = options.maxExplicitDeserializingArrayIndex ?? 999;
|
|
7
7
|
}
|
|
8
8
|
serialize(data) {
|
|
9
|
-
|
|
9
|
+
const result = [];
|
|
10
|
+
this.internalSerialize(data, "", true, result);
|
|
11
|
+
return result;
|
|
10
12
|
}
|
|
11
|
-
internalSerialize(data,
|
|
13
|
+
internalSerialize(data, path, isRoot, result) {
|
|
12
14
|
if (Array.isArray(data)) {
|
|
13
15
|
data.forEach((item, i) => {
|
|
14
|
-
this.internalSerialize(item,
|
|
16
|
+
this.internalSerialize(item, isRoot ? i.toString() : `${path}[${i}]`, false, result);
|
|
15
17
|
});
|
|
16
18
|
} else if (isPlainObject(data)) {
|
|
17
19
|
for (const key in data) {
|
|
18
|
-
this.internalSerialize(data[key],
|
|
20
|
+
this.internalSerialize(data[key], isRoot ? key : `${path}[${key}]`, false, result);
|
|
19
21
|
}
|
|
20
22
|
} else {
|
|
21
|
-
result.push([
|
|
23
|
+
result.push([path, data]);
|
|
22
24
|
}
|
|
23
|
-
return result;
|
|
24
25
|
}
|
|
25
26
|
deserialize(serialized) {
|
|
26
27
|
if (serialized.length === 0) {
|
|
@@ -32,7 +33,8 @@ class BracketNotationSerializer {
|
|
|
32
33
|
const segments = this.parsePath(path);
|
|
33
34
|
let currentRef = ref;
|
|
34
35
|
let nextSegment = "value";
|
|
35
|
-
segments.
|
|
36
|
+
for (let i = 0; i < segments.length; i++) {
|
|
37
|
+
const segment = segments[i];
|
|
36
38
|
if (!Array.isArray(currentRef[nextSegment]) && !isPlainObject(currentRef[nextSegment])) {
|
|
37
39
|
currentRef[nextSegment] = [];
|
|
38
40
|
}
|
|
@@ -63,7 +65,7 @@ class BracketNotationSerializer {
|
|
|
63
65
|
}
|
|
64
66
|
currentRef = currentRef[nextSegment];
|
|
65
67
|
nextSegment = segment;
|
|
66
|
-
}
|
|
68
|
+
}
|
|
67
69
|
if (Array.isArray(currentRef) && nextSegment === "") {
|
|
68
70
|
arrayPushStyles.add(currentRef);
|
|
69
71
|
currentRef.push(value);
|
|
@@ -80,12 +82,14 @@ class BracketNotationSerializer {
|
|
|
80
82
|
return ref.value;
|
|
81
83
|
}
|
|
82
84
|
stringifyPath(segments) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
if (segments.length === 0) {
|
|
86
|
+
return "";
|
|
87
|
+
}
|
|
88
|
+
let result = segments[0].toString();
|
|
89
|
+
for (let i = 1; i < segments.length; i++) {
|
|
90
|
+
result += `[${segments[i]}]`;
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
89
93
|
}
|
|
90
94
|
parsePath(path) {
|
|
91
95
|
const segments = [];
|
|
@@ -112,8 +116,9 @@ class BracketNotationSerializer {
|
|
|
112
116
|
return inBrackets || segments.length === 0 ? [path] : segments;
|
|
113
117
|
}
|
|
114
118
|
}
|
|
119
|
+
const INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
|
|
115
120
|
function internalIsValidArrayIndex(value, maxIndex) {
|
|
116
|
-
return
|
|
121
|
+
return INTEGER_PATTERN.test(value) && Number(value) <= maxIndex;
|
|
117
122
|
}
|
|
118
123
|
function internalArrayToObject(array) {
|
|
119
124
|
const obj = new NullProtoObj();
|
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.23",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@hey-api/spec-types": "0.0.0-next-20260408030107",
|
|
78
|
-
"@standardserver/core": "^0.
|
|
79
|
-
"@standardserver/fetch": "^0.
|
|
78
|
+
"@standardserver/core": "^0.6.0",
|
|
79
|
+
"@standardserver/fetch": "^0.6.0",
|
|
80
80
|
"rou3": "^0.9.1",
|
|
81
|
-
"@orpc/client": "2.0.0-beta.
|
|
82
|
-
"@orpc/
|
|
83
|
-
"@orpc/
|
|
84
|
-
"@orpc/
|
|
85
|
-
"@orpc/
|
|
81
|
+
"@orpc/client": "2.0.0-beta.23",
|
|
82
|
+
"@orpc/contract": "2.0.0-beta.23",
|
|
83
|
+
"@orpc/json-schema": "2.0.0-beta.23",
|
|
84
|
+
"@orpc/server": "2.0.0-beta.23",
|
|
85
|
+
"@orpc/shared": "2.0.0-beta.23"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@scalar/api-reference": "^1.63.0",
|