@orpc/openapi-client 0.0.0-next.3d25567 → 0.0.0-next.3d8a81d
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/dist/adapters/fetch/index.d.mts +1 -1
- package/dist/adapters/fetch/index.d.ts +1 -1
- package/dist/adapters/fetch/index.mjs +1 -1
- package/dist/adapters/standard/index.d.mts +1 -1
- package/dist/adapters/standard/index.d.ts +1 -1
- package/dist/adapters/standard/index.mjs +2 -2
- package/dist/shared/{openapi-client.f2unmElJ.d.mts → openapi-client.Bc2pHPqD.d.mts} +2 -20
- package/dist/shared/{openapi-client.f2unmElJ.d.ts → openapi-client.Bc2pHPqD.d.ts} +2 -20
- package/dist/shared/{openapi-client.D3eD5ojB.mjs → openapi-client.Bix5hHnT.mjs} +5 -9
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
2
|
import { LinkFetchClientOptions } from '@orpc/client/fetch';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
|
-
import {
|
|
4
|
+
import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.Bc2pHPqD.mjs';
|
|
5
5
|
import '@orpc/client/standard';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@orpc/standard-server';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
2
|
import { LinkFetchClientOptions } from '@orpc/client/fetch';
|
|
3
3
|
import { AnyContractRouter } from '@orpc/contract';
|
|
4
|
-
import {
|
|
4
|
+
import { f as StandardOpenAPILinkOptions, g as StandardOpenAPILink } from '../../shared/openapi-client.Bc2pHPqD.js';
|
|
5
5
|
import '@orpc/client/standard';
|
|
6
6
|
import '@orpc/shared';
|
|
7
7
|
import '@orpc/standard-server';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LinkFetchClient } from '@orpc/client/fetch';
|
|
2
2
|
import '@orpc/shared';
|
|
3
3
|
import '@orpc/contract';
|
|
4
|
-
import { b as StandardOpenAPILink } from '../../shared/openapi-client.
|
|
4
|
+
import { b as StandardOpenAPILink } from '../../shared/openapi-client.Bix5hHnT.mjs';
|
|
5
5
|
import '@orpc/client';
|
|
6
6
|
import '@orpc/client/standard';
|
|
7
7
|
import '@orpc/standard-server';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as StandardBracketNotationSerialized,
|
|
1
|
+
export { S as StandardBracketNotationSerialized, a as StandardBracketNotationSerializer, c as StandardOpenAPICustomJsonSerializer, b as StandardOpenAPIJsonSerialized, e as StandardOpenAPIJsonSerializer, d as StandardOpenAPIJsonSerializerOptions, g as StandardOpenAPILink, f as StandardOpenAPILinkOptions, j as StandardOpenAPISerializeOptions, k as StandardOpenAPISerializer, i as StandardOpenapiLinkCodec, h as StandardOpenapiLinkCodecOptions } from '../../shared/openapi-client.Bc2pHPqD.mjs';
|
|
2
2
|
import { HTTPPath } from '@orpc/client';
|
|
3
3
|
import '@orpc/client/standard';
|
|
4
4
|
import '@orpc/contract';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as StandardBracketNotationSerialized,
|
|
1
|
+
export { S as StandardBracketNotationSerialized, a as StandardBracketNotationSerializer, c as StandardOpenAPICustomJsonSerializer, b as StandardOpenAPIJsonSerialized, e as StandardOpenAPIJsonSerializer, d as StandardOpenAPIJsonSerializerOptions, g as StandardOpenAPILink, f as StandardOpenAPILinkOptions, j as StandardOpenAPISerializeOptions, k as StandardOpenAPISerializer, i as StandardOpenapiLinkCodec, h as StandardOpenapiLinkCodecOptions } from '../../shared/openapi-client.Bc2pHPqD.js';
|
|
2
2
|
import { HTTPPath } from '@orpc/client';
|
|
3
3
|
import '@orpc/client/standard';
|
|
4
4
|
import '@orpc/contract';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StandardBracketNotationSerializer } from '../../shared/openapi-client.
|
|
2
|
-
export { a as StandardOpenAPIJsonSerializer, b as StandardOpenAPILink, d as StandardOpenAPISerializer, c as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.
|
|
1
|
+
import { S as StandardBracketNotationSerializer } from '../../shared/openapi-client.Bix5hHnT.mjs';
|
|
2
|
+
export { a as StandardOpenAPIJsonSerializer, b as StandardOpenAPILink, d as StandardOpenAPISerializer, c as StandardOpenapiLinkCodec, g as getDynamicParams, s as standardizeHTTPPath } from '../../shared/openapi-client.Bix5hHnT.mjs';
|
|
3
3
|
import { isSchemaIssue } from '@orpc/contract';
|
|
4
4
|
import { isTypescriptObject } from '@orpc/shared';
|
|
5
5
|
import '@orpc/client/standard';
|
|
@@ -5,25 +5,7 @@ import { Segment, Value, Promisable } from '@orpc/shared';
|
|
|
5
5
|
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
6
6
|
|
|
7
7
|
type StandardBracketNotationSerialized = [string, unknown][];
|
|
8
|
-
interface StandardBracketNotationSerializerOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Maximum allowed array index for bracket notation deserialization.
|
|
11
|
-
*
|
|
12
|
-
* This helps protect against memory exhaustion attacks where malicious input
|
|
13
|
-
* uses extremely large array indices (e.g., `?arr[4294967296]=value`).
|
|
14
|
-
*
|
|
15
|
-
* While bracket notation creates sparse arrays that handle large indices efficiently,
|
|
16
|
-
* downstream code might inadvertently convert these sparse arrays to dense arrays,
|
|
17
|
-
* potentially creating millions of undefined elements and causing memory issues.
|
|
18
|
-
*
|
|
19
|
-
* @note Only applies to deserialization.
|
|
20
|
-
* @default 9_999 (array with 10,000 elements)
|
|
21
|
-
*/
|
|
22
|
-
maxBracketNotationArrayIndex?: number;
|
|
23
|
-
}
|
|
24
8
|
declare class StandardBracketNotationSerializer {
|
|
25
|
-
private readonly maxArrayIndex;
|
|
26
|
-
constructor(options?: StandardBracketNotationSerializerOptions);
|
|
27
9
|
serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
|
|
28
10
|
deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
|
|
29
11
|
stringifyPath(segments: readonly Segment[]): string;
|
|
@@ -93,5 +75,5 @@ declare class StandardOpenAPILink<T extends ClientContext> extends StandardLink<
|
|
|
93
75
|
constructor(contract: AnyContractRouter, linkClient: StandardLinkClient<T>, options: StandardOpenAPILinkOptions<T>);
|
|
94
76
|
}
|
|
95
77
|
|
|
96
|
-
export { StandardBracketNotationSerializer as
|
|
97
|
-
export type { StandardBracketNotationSerialized as S,
|
|
78
|
+
export { StandardBracketNotationSerializer as a, StandardOpenAPIJsonSerializer as e, StandardOpenAPILink as g, StandardOpenapiLinkCodec as i, StandardOpenAPISerializer as k };
|
|
79
|
+
export type { StandardBracketNotationSerialized as S, StandardOpenAPIJsonSerialized as b, StandardOpenAPICustomJsonSerializer as c, StandardOpenAPIJsonSerializerOptions as d, StandardOpenAPILinkOptions as f, StandardOpenapiLinkCodecOptions as h, StandardOpenAPISerializeOptions as j };
|
|
@@ -5,25 +5,7 @@ import { Segment, Value, Promisable } from '@orpc/shared';
|
|
|
5
5
|
import { StandardHeaders, StandardRequest, StandardLazyResponse } from '@orpc/standard-server';
|
|
6
6
|
|
|
7
7
|
type StandardBracketNotationSerialized = [string, unknown][];
|
|
8
|
-
interface StandardBracketNotationSerializerOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Maximum allowed array index for bracket notation deserialization.
|
|
11
|
-
*
|
|
12
|
-
* This helps protect against memory exhaustion attacks where malicious input
|
|
13
|
-
* uses extremely large array indices (e.g., `?arr[4294967296]=value`).
|
|
14
|
-
*
|
|
15
|
-
* While bracket notation creates sparse arrays that handle large indices efficiently,
|
|
16
|
-
* downstream code might inadvertently convert these sparse arrays to dense arrays,
|
|
17
|
-
* potentially creating millions of undefined elements and causing memory issues.
|
|
18
|
-
*
|
|
19
|
-
* @note Only applies to deserialization.
|
|
20
|
-
* @default 9_999 (array with 10,000 elements)
|
|
21
|
-
*/
|
|
22
|
-
maxBracketNotationArrayIndex?: number;
|
|
23
|
-
}
|
|
24
8
|
declare class StandardBracketNotationSerializer {
|
|
25
|
-
private readonly maxArrayIndex;
|
|
26
|
-
constructor(options?: StandardBracketNotationSerializerOptions);
|
|
27
9
|
serialize(data: unknown, segments?: Segment[], result?: StandardBracketNotationSerialized): StandardBracketNotationSerialized;
|
|
28
10
|
deserialize(serialized: StandardBracketNotationSerialized): Record<string, unknown> | unknown[];
|
|
29
11
|
stringifyPath(segments: readonly Segment[]): string;
|
|
@@ -93,5 +75,5 @@ declare class StandardOpenAPILink<T extends ClientContext> extends StandardLink<
|
|
|
93
75
|
constructor(contract: AnyContractRouter, linkClient: StandardLinkClient<T>, options: StandardOpenAPILinkOptions<T>);
|
|
94
76
|
}
|
|
95
77
|
|
|
96
|
-
export { StandardBracketNotationSerializer as
|
|
97
|
-
export type { StandardBracketNotationSerialized as S,
|
|
78
|
+
export { StandardBracketNotationSerializer as a, StandardOpenAPIJsonSerializer as e, StandardOpenAPILink as g, StandardOpenapiLinkCodec as i, StandardOpenAPISerializer as k };
|
|
79
|
+
export type { StandardBracketNotationSerialized as S, StandardOpenAPIJsonSerialized as b, StandardOpenAPICustomJsonSerializer as c, StandardOpenAPIJsonSerializerOptions as d, StandardOpenAPILinkOptions as f, StandardOpenapiLinkCodecOptions as h, StandardOpenAPISerializeOptions as j };
|
|
@@ -5,10 +5,6 @@ import { isContractProcedure, fallbackContractConfig, ORPCError } from '@orpc/co
|
|
|
5
5
|
import { mergeStandardHeaders, ErrorEvent } from '@orpc/standard-server';
|
|
6
6
|
|
|
7
7
|
class StandardBracketNotationSerializer {
|
|
8
|
-
maxArrayIndex;
|
|
9
|
-
constructor(options = {}) {
|
|
10
|
-
this.maxArrayIndex = options.maxBracketNotationArrayIndex ?? 9999;
|
|
11
|
-
}
|
|
12
8
|
serialize(data, segments = [], result = []) {
|
|
13
9
|
if (Array.isArray(data)) {
|
|
14
10
|
data.forEach((item, i) => {
|
|
@@ -38,7 +34,7 @@ class StandardBracketNotationSerializer {
|
|
|
38
34
|
currentRef[nextSegment] = [];
|
|
39
35
|
}
|
|
40
36
|
if (i !== segments.length - 1) {
|
|
41
|
-
if (Array.isArray(currentRef[nextSegment]) && !isValidArrayIndex(segment
|
|
37
|
+
if (Array.isArray(currentRef[nextSegment]) && !isValidArrayIndex(segment)) {
|
|
42
38
|
if (arrayPushStyles.has(currentRef[nextSegment])) {
|
|
43
39
|
arrayPushStyles.delete(currentRef[nextSegment]);
|
|
44
40
|
currentRef[nextSegment] = pushStyleArrayToObject(currentRef[nextSegment]);
|
|
@@ -56,7 +52,7 @@ class StandardBracketNotationSerializer {
|
|
|
56
52
|
if (arrayPushStyles.has(currentRef[nextSegment])) {
|
|
57
53
|
arrayPushStyles.delete(currentRef[nextSegment]);
|
|
58
54
|
currentRef[nextSegment] = pushStyleArrayToObject(currentRef[nextSegment]);
|
|
59
|
-
} else if (!isValidArrayIndex(segment
|
|
55
|
+
} else if (!isValidArrayIndex(segment)) {
|
|
60
56
|
currentRef[nextSegment] = arrayToObject(currentRef[nextSegment]);
|
|
61
57
|
}
|
|
62
58
|
}
|
|
@@ -131,8 +127,8 @@ class StandardBracketNotationSerializer {
|
|
|
131
127
|
return inBrackets || segments.length === 0 ? [path] : segments;
|
|
132
128
|
}
|
|
133
129
|
}
|
|
134
|
-
function isValidArrayIndex(value
|
|
135
|
-
return /^0$|^[1-9]\d*$/.test(value)
|
|
130
|
+
function isValidArrayIndex(value) {
|
|
131
|
+
return /^0$|^[1-9]\d*$/.test(value);
|
|
136
132
|
}
|
|
137
133
|
function arrayToObject(array) {
|
|
138
134
|
const obj = new NullProtoObj();
|
|
@@ -428,7 +424,7 @@ class StandardOpenAPISerializer {
|
|
|
428
424
|
class StandardOpenAPILink extends StandardLink {
|
|
429
425
|
constructor(contract, linkClient, options) {
|
|
430
426
|
const jsonSerializer = new StandardOpenAPIJsonSerializer(options);
|
|
431
|
-
const bracketNotationSerializer = new StandardBracketNotationSerializer(
|
|
427
|
+
const bracketNotationSerializer = new StandardBracketNotationSerializer();
|
|
432
428
|
const serializer = new StandardOpenAPISerializer(jsonSerializer, bracketNotationSerializer);
|
|
433
429
|
const linkCodec = new StandardOpenapiLinkCodec(contract, serializer, options);
|
|
434
430
|
super(linkCodec, linkClient, options);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi-client",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.3d8a81d",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@orpc/client": "0.0.0-next.
|
|
38
|
-
"@orpc/contract": "0.0.0-next.
|
|
39
|
-
"@orpc/
|
|
40
|
-
"@orpc/
|
|
37
|
+
"@orpc/client": "0.0.0-next.3d8a81d",
|
|
38
|
+
"@orpc/contract": "0.0.0-next.3d8a81d",
|
|
39
|
+
"@orpc/shared": "0.0.0-next.3d8a81d",
|
|
40
|
+
"@orpc/standard-server": "0.0.0-next.3d8a81d"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@orpc/server": "0.0.0-next.
|
|
43
|
+
"@orpc/server": "0.0.0-next.3d8a81d"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "unbuild",
|