@orpc/openapi-client 0.0.0-next.32f3296 → 0.0.0-next.33ca37d
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.
|
@@ -9,7 +9,16 @@ declare class StandardBracketNotationSerializer {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
|
|
12
|
+
interface StandardOpenAPICustomJsonSerializer {
|
|
13
|
+
condition(data: unknown): boolean;
|
|
14
|
+
serialize(data: any): unknown;
|
|
15
|
+
}
|
|
16
|
+
interface StandardOpenAPIJsonSerializerOptions {
|
|
17
|
+
customJsonSerializers?: readonly StandardOpenAPICustomJsonSerializer[];
|
|
18
|
+
}
|
|
12
19
|
declare class StandardOpenAPIJsonSerializer {
|
|
20
|
+
private readonly customSerializers;
|
|
21
|
+
constructor(options?: StandardOpenAPIJsonSerializerOptions);
|
|
13
22
|
serialize(data: unknown, hasBlobRef?: {
|
|
14
23
|
value: boolean;
|
|
15
24
|
}): StandardOpenAPIJsonSerialized;
|
|
@@ -24,4 +33,4 @@ declare class StandardOpenAPISerializer {
|
|
|
24
33
|
deserialize(data: unknown): unknown;
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
export { type StandardBracketNotationSerialized, StandardBracketNotationSerializer, type StandardOpenAPIJsonSerialized, StandardOpenAPIJsonSerializer, StandardOpenAPISerializer };
|
|
36
|
+
export { type StandardBracketNotationSerialized, StandardBracketNotationSerializer, type StandardOpenAPICustomJsonSerializer, type StandardOpenAPIJsonSerialized, StandardOpenAPIJsonSerializer, type StandardOpenAPIJsonSerializerOptions, StandardOpenAPISerializer };
|
|
@@ -9,7 +9,16 @@ declare class StandardBracketNotationSerializer {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
type StandardOpenAPIJsonSerialized = [json: unknown, hasBlob: boolean];
|
|
12
|
+
interface StandardOpenAPICustomJsonSerializer {
|
|
13
|
+
condition(data: unknown): boolean;
|
|
14
|
+
serialize(data: any): unknown;
|
|
15
|
+
}
|
|
16
|
+
interface StandardOpenAPIJsonSerializerOptions {
|
|
17
|
+
customJsonSerializers?: readonly StandardOpenAPICustomJsonSerializer[];
|
|
18
|
+
}
|
|
12
19
|
declare class StandardOpenAPIJsonSerializer {
|
|
20
|
+
private readonly customSerializers;
|
|
21
|
+
constructor(options?: StandardOpenAPIJsonSerializerOptions);
|
|
13
22
|
serialize(data: unknown, hasBlobRef?: {
|
|
14
23
|
value: boolean;
|
|
15
24
|
}): StandardOpenAPIJsonSerialized;
|
|
@@ -24,4 +33,4 @@ declare class StandardOpenAPISerializer {
|
|
|
24
33
|
deserialize(data: unknown): unknown;
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
export { type StandardBracketNotationSerialized, StandardBracketNotationSerializer, type StandardOpenAPIJsonSerialized, StandardOpenAPIJsonSerializer, StandardOpenAPISerializer };
|
|
36
|
+
export { type StandardBracketNotationSerialized, StandardBracketNotationSerializer, type StandardOpenAPICustomJsonSerializer, type StandardOpenAPIJsonSerialized, StandardOpenAPIJsonSerializer, type StandardOpenAPIJsonSerializerOptions, StandardOpenAPISerializer };
|
|
@@ -122,7 +122,17 @@ function isValidArrayIndex(value) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
class StandardOpenAPIJsonSerializer {
|
|
125
|
+
customSerializers;
|
|
126
|
+
constructor(options = {}) {
|
|
127
|
+
this.customSerializers = options.customJsonSerializers ?? [];
|
|
128
|
+
}
|
|
125
129
|
serialize(data, hasBlobRef = { value: false }) {
|
|
130
|
+
for (const custom of this.customSerializers) {
|
|
131
|
+
if (custom.condition(data)) {
|
|
132
|
+
const result = this.serialize(custom.serialize(data), hasBlobRef);
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
126
136
|
if (data instanceof Blob) {
|
|
127
137
|
hasBlobRef.value = true;
|
|
128
138
|
return [data, hasBlobRef.value];
|
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.33ca37d",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@orpc/client": "0.0.0-next.
|
|
33
|
-
"@orpc/shared": "0.0.0-next.
|
|
34
|
-
"@orpc/standard-server": "0.0.0-next.
|
|
32
|
+
"@orpc/client": "0.0.0-next.33ca37d",
|
|
33
|
+
"@orpc/shared": "0.0.0-next.33ca37d",
|
|
34
|
+
"@orpc/standard-server": "0.0.0-next.33ca37d"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "unbuild",
|