@utiliread/http 1.19.6 → 1.20.0
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/event-aggregator.d.ts +11 -0
- package/dist/events.d.ts +11 -0
- package/dist/header-names.d.ts +182 -0
- package/dist/helpers.d.ts +5 -0
- package/dist/http-builder.d.ts +61 -0
- package/dist/http-error.d.ts +10 -0
- package/dist/http-response.d.ts +18 -0
- package/dist/http.d.ts +33 -0
- package/dist/http.spec.d.ts +1 -0
- package/dist/index.d.ts +16 -231
- package/dist/index.js +616 -242
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +601 -215
- package/dist/index.mjs.map +1 -1
- package/dist/mapper.d.ts +9 -0
- package/dist/pagination.d.ts +23 -0
- package/dist/{json.d.ts → plugins/json/index.d.ts} +1 -2
- package/dist/plugins/json/index.js +87 -0
- package/dist/plugins/json/index.js.map +1 -0
- package/dist/plugins/json/index.mjs +85 -0
- package/dist/plugins/json/index.mjs.map +1 -0
- package/dist/{jsonpatch.d.ts → plugins/jsonpatch/index.d.ts} +0 -2
- package/dist/plugins/jsonpatch/index.js +21 -0
- package/dist/plugins/jsonpatch/index.js.map +1 -0
- package/dist/plugins/jsonpatch/index.mjs +19 -0
- package/dist/plugins/jsonpatch/index.mjs.map +1 -0
- package/dist/{msgpack.d.ts → plugins/msgpack/index.d.ts} +1 -2
- package/dist/plugins/msgpack/index.js +41 -0
- package/dist/plugins/msgpack/index.js.map +1 -0
- package/dist/plugins/msgpack/index.mjs +39 -0
- package/dist/plugins/msgpack/index.mjs.map +1 -0
- package/dist/problem-details.d.ts +7 -0
- package/dist/query-string.d.ts +6 -0
- package/dist/query-string.spec.d.ts +1 -0
- package/dist/status-codes.d.ts +65 -0
- package/dist/timeout-error.d.ts +3 -0
- package/json.d.ts +1 -1
- package/json.rollup.config.mjs +32 -0
- package/jsonpatch.d.ts +1 -1
- package/jsonpatch.rollup.config.mjs +32 -0
- package/msgpack.d.ts +1 -1
- package/msgpack.rollup.config.mjs +37 -0
- package/package.json +24 -24
- package/rollup.config.mjs +31 -0
- package/src/header-names.ts +273 -0
- package/src/index.ts +2 -1
- package/{plugins/json/src → src/plugins/json}/index.ts +138 -142
- package/{plugins/jsonpatch/src → src/plugins/jsonpatch}/index.ts +36 -36
- package/{plugins/msgpack/src → src/plugins/msgpack}/index.ts +69 -66
- package/src/status-codes.ts +65 -67
- package/tsconfig.json +6 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/json.d.ts.map +0 -1
- package/dist/json.js +0 -93
- package/dist/json.js.map +0 -1
- package/dist/json.mjs +0 -82
- package/dist/json.mjs.map +0 -1
- package/dist/jsonpatch.d.ts.map +0 -1
- package/dist/jsonpatch.js +0 -33
- package/dist/jsonpatch.js.map +0 -1
- package/dist/jsonpatch.mjs +0 -22
- package/dist/jsonpatch.mjs.map +0 -1
- package/dist/msgpack.d.ts.map +0 -1
- package/dist/msgpack.js +0 -50
- package/dist/msgpack.js.map +0 -1
- package/dist/msgpack.mjs +0 -39
- package/dist/msgpack.mjs.map +0 -1
- package/plugins/json/node_modules/@utiliread/http/package.json +0 -4
- package/plugins/json/package.json +0 -15
- package/plugins/json/tsconfig.json +0 -7
- package/plugins/jsonpatch/node_modules/@utiliread/http/package.json +0 -4
- package/plugins/jsonpatch/package.json +0 -16
- package/plugins/jsonpatch/tsconfig.json +0 -7
- package/plugins/msgpack/node_modules/@utiliread/http/package.json +0 -4
- package/plugins/msgpack/package.json +0 -16
- package/plugins/msgpack/tsconfig.json +0 -7
|
@@ -1,142 +1,138 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HttpBuilder,
|
|
3
|
-
HttpBuilderOfT,
|
|
4
|
-
InfinitePaginationResult,
|
|
5
|
-
PaginationResult,
|
|
6
|
-
TypeOrMapper,
|
|
7
|
-
getMapper,
|
|
8
|
-
getNullableMapper,
|
|
9
|
-
} from "@utiliread/http";
|
|
10
|
-
import { deserialize, serialize } from "@utiliread/json";
|
|
11
|
-
|
|
12
|
-
// Force declarations to be module augmentations instead of ambient module declarations
|
|
13
|
-
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules
|
|
14
|
-
export default {};
|
|
15
|
-
|
|
16
|
-
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
|
17
|
-
declare module "@utiliread/http" {
|
|
18
|
-
interface HttpBuilder {
|
|
19
|
-
withJson(content: any): this;
|
|
20
|
-
|
|
21
|
-
expectJson<T>(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
):
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this
|
|
60
|
-
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this
|
|
73
|
-
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this
|
|
101
|
-
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this
|
|
124
|
-
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
});
|
|
140
|
-
return promise;
|
|
141
|
-
});
|
|
142
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
HttpBuilder,
|
|
3
|
+
HttpBuilderOfT,
|
|
4
|
+
InfinitePaginationResult,
|
|
5
|
+
PaginationResult,
|
|
6
|
+
TypeOrMapper,
|
|
7
|
+
getMapper,
|
|
8
|
+
getNullableMapper,
|
|
9
|
+
} from "@utiliread/http";
|
|
10
|
+
import { deserialize, serialize } from "@utiliread/json";
|
|
11
|
+
|
|
12
|
+
// Force declarations to be module augmentations instead of ambient module declarations
|
|
13
|
+
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules
|
|
14
|
+
export default {};
|
|
15
|
+
|
|
16
|
+
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
|
17
|
+
declare module "@utiliread/http" {
|
|
18
|
+
interface HttpBuilder {
|
|
19
|
+
withJson(content: any): this;
|
|
20
|
+
|
|
21
|
+
expectJson<T>(typeOrMapper?: TypeOrMapper<T>): HttpBuilderOfT<T>;
|
|
22
|
+
expectJsonArray<T>(typeOrMapper: TypeOrMapper<T>): HttpBuilderOfT<T[]>;
|
|
23
|
+
expectJsonNullableArray<T>(
|
|
24
|
+
typeOrMapper: TypeOrMapper<T>,
|
|
25
|
+
): HttpBuilderOfT<(T | null)[]>;
|
|
26
|
+
expectJsonPaginationResult<T>(
|
|
27
|
+
typeOrMapper: TypeOrMapper<T>,
|
|
28
|
+
): HttpBuilderOfT<PaginationResult<T>>;
|
|
29
|
+
expectJsonInfinitePaginationResult<T>(
|
|
30
|
+
typeOrMapper: TypeOrMapper<T>,
|
|
31
|
+
): HttpBuilderOfT<InfinitePaginationResult<T>>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface HttpBuilderOfT<T> {
|
|
35
|
+
withJson(content: any): this;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
HttpBuilder.prototype.withJson = function (this: HttpBuilder, content: any) {
|
|
40
|
+
this.message.content = serialize(content);
|
|
41
|
+
this.message.contentType = "application/json";
|
|
42
|
+
return this;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
HttpBuilderOfT.prototype.withJson = function <T>(
|
|
46
|
+
this: HttpBuilderOfT<T>,
|
|
47
|
+
content: any,
|
|
48
|
+
) {
|
|
49
|
+
this.message.content = serialize(content);
|
|
50
|
+
this.message.contentType = "application/json";
|
|
51
|
+
return this;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
HttpBuilder.prototype.expectJson = function <T>(
|
|
55
|
+
this: HttpBuilder,
|
|
56
|
+
typeOrMapper?: TypeOrMapper<T>,
|
|
57
|
+
) {
|
|
58
|
+
this.message.headers.set("Accept", "application/json");
|
|
59
|
+
return this.useHandler((response) => {
|
|
60
|
+
const promise = response.rawResponse
|
|
61
|
+
.json()
|
|
62
|
+
.then((x) => getMapper(deserialize, typeOrMapper)(x));
|
|
63
|
+
return promise;
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
HttpBuilder.prototype.expectJsonArray = function <T>(
|
|
68
|
+
this: HttpBuilder,
|
|
69
|
+
typeOrMapper: TypeOrMapper<T>,
|
|
70
|
+
) {
|
|
71
|
+
this.message.headers.set("Accept", "application/json");
|
|
72
|
+
return this.useHandler((response) => {
|
|
73
|
+
const promise = response.rawResponse.json().then((x: any[]) => {
|
|
74
|
+
const itemFactory = getMapper(deserialize, typeOrMapper);
|
|
75
|
+
return x.map(itemFactory);
|
|
76
|
+
});
|
|
77
|
+
return promise;
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
HttpBuilder.prototype.expectJsonNullableArray = function <T>(
|
|
82
|
+
this: HttpBuilder,
|
|
83
|
+
typeOrMapper: TypeOrMapper<T>,
|
|
84
|
+
): HttpBuilderOfT<(T | null)[]> {
|
|
85
|
+
this.message.headers.set("Accept", "application/json");
|
|
86
|
+
return this.useHandler((response) => {
|
|
87
|
+
const promise = response.rawResponse.json().then((x: any[]) => {
|
|
88
|
+
const itemFactory = getNullableMapper(deserialize, typeOrMapper);
|
|
89
|
+
return x.map(itemFactory);
|
|
90
|
+
});
|
|
91
|
+
return promise;
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
HttpBuilder.prototype.expectJsonPaginationResult = function <T>(
|
|
96
|
+
this: HttpBuilder,
|
|
97
|
+
typeOrMapper: TypeOrMapper<T>,
|
|
98
|
+
) {
|
|
99
|
+
this.message.headers.set("Accept", "application/json");
|
|
100
|
+
return this.useHandler((response) => {
|
|
101
|
+
const promise = response.rawResponse
|
|
102
|
+
.json()
|
|
103
|
+
.then((x: PaginationResult<any>) => {
|
|
104
|
+
const itemFactory = getMapper(deserialize, typeOrMapper);
|
|
105
|
+
return {
|
|
106
|
+
meta: {
|
|
107
|
+
pageCount: x.meta.pageCount,
|
|
108
|
+
pageSize: x.meta.pageSize,
|
|
109
|
+
totalItems: x.meta.totalItems,
|
|
110
|
+
},
|
|
111
|
+
data: x.data.map(itemFactory),
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
return promise;
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
HttpBuilder.prototype.expectJsonInfinitePaginationResult = function <T>(
|
|
119
|
+
this: HttpBuilder,
|
|
120
|
+
typeOrMapper: TypeOrMapper<T>,
|
|
121
|
+
) {
|
|
122
|
+
this.message.headers.set("Accept", "application/json");
|
|
123
|
+
return this.useHandler((response) => {
|
|
124
|
+
const promise = response.rawResponse
|
|
125
|
+
.json()
|
|
126
|
+
.then((x: InfinitePaginationResult<any>) => {
|
|
127
|
+
const itemFactory = getMapper(deserialize, typeOrMapper);
|
|
128
|
+
return {
|
|
129
|
+
meta: {
|
|
130
|
+
pageSize: x.meta.pageSize,
|
|
131
|
+
continuationToken: x.meta.continuationToken,
|
|
132
|
+
},
|
|
133
|
+
data: x.data.map(itemFactory),
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
return promise;
|
|
137
|
+
});
|
|
138
|
+
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { HttpBuilder, HttpBuilderOfT } from "@utiliread/http";
|
|
2
|
-
|
|
3
|
-
import { serialize } from "@utiliread/json";
|
|
4
|
-
|
|
5
|
-
// Force declarations to be module augmentations instead of ambient module declarations
|
|
6
|
-
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules
|
|
7
|
-
export default {};
|
|
8
|
-
|
|
9
|
-
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
|
10
|
-
declare module "@utiliread/http" {
|
|
11
|
-
interface HttpBuilder {
|
|
12
|
-
withJsonPatch(operations: import("@utiliread/jsonpatch").Operation[]): this;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface HttpBuilderOfT<T> {
|
|
16
|
-
withJsonPatch(operations: import("@utiliread/jsonpatch").Operation[]): this;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
HttpBuilder.prototype.withJsonPatch = function (
|
|
21
|
-
this: HttpBuilder,
|
|
22
|
-
operations: import("@utiliread/jsonpatch").Operation[]
|
|
23
|
-
) {
|
|
24
|
-
this.message.content = serialize(operations);
|
|
25
|
-
this.message.contentType = "application/json-patch+json";
|
|
26
|
-
return this;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
HttpBuilderOfT.prototype.withJsonPatch = function <T>(
|
|
30
|
-
this: HttpBuilderOfT<T>,
|
|
31
|
-
operations: import("@utiliread/jsonpatch").Operation[]
|
|
32
|
-
) {
|
|
33
|
-
this.message.content = serialize(operations);
|
|
34
|
-
this.message.contentType = "application/json-patch+json";
|
|
35
|
-
return this;
|
|
36
|
-
};
|
|
1
|
+
import { HttpBuilder, HttpBuilderOfT } from "@utiliread/http";
|
|
2
|
+
|
|
3
|
+
import { serialize } from "@utiliread/json";
|
|
4
|
+
|
|
5
|
+
// Force declarations to be module augmentations instead of ambient module declarations
|
|
6
|
+
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules
|
|
7
|
+
export default {};
|
|
8
|
+
|
|
9
|
+
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
|
10
|
+
declare module "@utiliread/http" {
|
|
11
|
+
interface HttpBuilder {
|
|
12
|
+
withJsonPatch(operations: import("@utiliread/jsonpatch").Operation[]): this;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface HttpBuilderOfT<T> {
|
|
16
|
+
withJsonPatch(operations: import("@utiliread/jsonpatch").Operation[]): this;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
HttpBuilder.prototype.withJsonPatch = function (
|
|
21
|
+
this: HttpBuilder,
|
|
22
|
+
operations: import("@utiliread/jsonpatch").Operation[],
|
|
23
|
+
) {
|
|
24
|
+
this.message.content = serialize(operations);
|
|
25
|
+
this.message.contentType = "application/json-patch+json";
|
|
26
|
+
return this;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
HttpBuilderOfT.prototype.withJsonPatch = function <T>(
|
|
30
|
+
this: HttpBuilderOfT<T>,
|
|
31
|
+
operations: import("@utiliread/jsonpatch").Operation[],
|
|
32
|
+
) {
|
|
33
|
+
this.message.content = serialize(operations);
|
|
34
|
+
this.message.contentType = "application/json-patch+json";
|
|
35
|
+
return this;
|
|
36
|
+
};
|
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
): HttpBuilderOfT<T
|
|
19
|
-
|
|
20
|
-
typeOrMapper?: TypeOrMapper<T
|
|
21
|
-
): HttpBuilderOfT<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
HttpBuilder,
|
|
3
|
+
HttpResponse,
|
|
4
|
+
TypeOrMapper,
|
|
5
|
+
getMapper,
|
|
6
|
+
} from "@utiliread/http";
|
|
7
|
+
import { decodeArrayStream, decodeAsync } from "@msgpack/msgpack";
|
|
8
|
+
|
|
9
|
+
import { deserialize } from "@utiliread/msgpack";
|
|
10
|
+
|
|
11
|
+
// Force declarations to be module augmentations instead of ambient module declarations
|
|
12
|
+
// https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules
|
|
13
|
+
export default {};
|
|
14
|
+
|
|
15
|
+
// https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
|
16
|
+
declare module "@utiliread/http" {
|
|
17
|
+
interface HttpBuilder {
|
|
18
|
+
expectMessagePack<T>(typeOrMapper?: TypeOrMapper<T>): HttpBuilderOfT<T>;
|
|
19
|
+
expectMessagePackArray<T>(
|
|
20
|
+
typeOrMapper?: TypeOrMapper<T>,
|
|
21
|
+
): HttpBuilderOfT<T[]>;
|
|
22
|
+
streamMessagePackArray<T>(
|
|
23
|
+
typeOrMapper?: TypeOrMapper<T>,
|
|
24
|
+
): HttpBuilderOfT<AsyncGenerator<T, void, unknown>>;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
HttpBuilder.prototype.expectMessagePack = function <T>(
|
|
29
|
+
this: HttpBuilder,
|
|
30
|
+
typeOrMapper?: TypeOrMapper<T>,
|
|
31
|
+
) {
|
|
32
|
+
this.message.headers.set("Accept", "application/x-msgpack");
|
|
33
|
+
return this.useHandler(async (response) => {
|
|
34
|
+
const itemFactory = getMapper(deserialize, typeOrMapper);
|
|
35
|
+
const decoded = await decodeAsync(response.rawResponse.body!);
|
|
36
|
+
return itemFactory(decoded);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
HttpBuilder.prototype.expectMessagePackArray = function <T>(
|
|
41
|
+
this: HttpBuilder,
|
|
42
|
+
typeOrMapper?: TypeOrMapper<T>,
|
|
43
|
+
) {
|
|
44
|
+
this.message.headers.set("Accept", "application/x-msgpack");
|
|
45
|
+
return this.useHandler(async (response) => {
|
|
46
|
+
const items: T[] = [];
|
|
47
|
+
const itemFactory = getMapper(deserialize, typeOrMapper);
|
|
48
|
+
for await (const item of decodeArrayStream(response.rawResponse.body!)) {
|
|
49
|
+
items.push(itemFactory(item));
|
|
50
|
+
}
|
|
51
|
+
return items;
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
HttpBuilder.prototype.streamMessagePackArray = function <T>(
|
|
56
|
+
this: HttpBuilder,
|
|
57
|
+
typeOrMapper?: TypeOrMapper<T>,
|
|
58
|
+
) {
|
|
59
|
+
this.message.headers.set("Accept", "application/x-msgpack");
|
|
60
|
+
|
|
61
|
+
async function* handler(response: HttpResponse) {
|
|
62
|
+
const itemFactory = getMapper(deserialize, typeOrMapper);
|
|
63
|
+
for await (const item of decodeArrayStream(response.rawResponse.body!)) {
|
|
64
|
+
yield itemFactory(item);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return this.useHandler((response) => Promise.resolve(handler(response)));
|
|
69
|
+
};
|
package/src/status-codes.ts
CHANGED
|
@@ -1,67 +1,65 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
status511NetworkAuthenticationRequired: 511,
|
|
67
|
-
});
|
|
1
|
+
export const status100Continue = 100;
|
|
2
|
+
export const status101SwitchingProtocols = 101;
|
|
3
|
+
export const status102Processing = 102;
|
|
4
|
+
export const status200OK = 200;
|
|
5
|
+
export const status201Created = 201;
|
|
6
|
+
export const status202Accepted = 202;
|
|
7
|
+
export const status203NonAuthoritative = 203;
|
|
8
|
+
export const status204NoContent = 204;
|
|
9
|
+
export const status205ResetContent = 205;
|
|
10
|
+
export const status206PartialContent = 206;
|
|
11
|
+
export const status207MultiStatus = 207;
|
|
12
|
+
export const status208AlreadyReported = 208;
|
|
13
|
+
export const status226IMUsed = 226;
|
|
14
|
+
export const status300MultipleChoices = 300;
|
|
15
|
+
export const status301MovedPermanently = 301;
|
|
16
|
+
export const status302Found = 302;
|
|
17
|
+
export const status303SeeOther = 303;
|
|
18
|
+
export const status304NotModified = 304;
|
|
19
|
+
export const status305UseProxy = 305;
|
|
20
|
+
export const status306SwitchProxy = 306;
|
|
21
|
+
export const status307TemporaryRedirect = 307;
|
|
22
|
+
export const status308PermanentRedirect = 308;
|
|
23
|
+
export const status400BadRequest = 400;
|
|
24
|
+
export const status401Unauthorized = 401;
|
|
25
|
+
export const status402PaymentRequired = 402;
|
|
26
|
+
export const status403Forbidden = 403;
|
|
27
|
+
export const status404NotFound = 404;
|
|
28
|
+
export const status405MethodNotAllowed = 405;
|
|
29
|
+
export const status406NotAcceptable = 406;
|
|
30
|
+
export const status407ProxyAuthenticationRequired = 407;
|
|
31
|
+
export const status408RequestTimeout = 408;
|
|
32
|
+
export const status409Conflict = 409;
|
|
33
|
+
export const status410Gone = 410;
|
|
34
|
+
export const status411LengthRequired = 411;
|
|
35
|
+
export const status412PreconditionFailed = 412;
|
|
36
|
+
export const status413RequestEntityTooLarge = 413;
|
|
37
|
+
export const status413PayloadTooLarge = 413;
|
|
38
|
+
export const status414RequestUriTooLong = 414;
|
|
39
|
+
export const status414UriTooLong = 414;
|
|
40
|
+
export const status415UnsupportedMediaType = 415;
|
|
41
|
+
export const status416RequestedRangeNotSatisfiable = 416;
|
|
42
|
+
export const status416RangeNotSatisfiable = 416;
|
|
43
|
+
export const status417ExpectationFailed = 417;
|
|
44
|
+
export const status418ImATeapot = 418;
|
|
45
|
+
export const status419AuthenticationTimeout = 419;
|
|
46
|
+
export const status421MisdirectedRequest = 421;
|
|
47
|
+
export const status422UnprocessableEntity = 422;
|
|
48
|
+
export const status423Locked = 423;
|
|
49
|
+
export const status424FailedDependency = 424;
|
|
50
|
+
export const status426UpgradeRequired = 426;
|
|
51
|
+
export const status428PreconditionRequired = 428;
|
|
52
|
+
export const status429TooManyRequests = 429;
|
|
53
|
+
export const status431RequestHeaderFieldsTooLarge = 431;
|
|
54
|
+
export const status451UnavailableForLegalReasons = 451;
|
|
55
|
+
export const status500InternalServerError = 500;
|
|
56
|
+
export const status501NotImplemented = 501;
|
|
57
|
+
export const status502BadGateway = 502;
|
|
58
|
+
export const status503ServiceUnavailable = 503;
|
|
59
|
+
export const status504GatewayTimeout = 504;
|
|
60
|
+
export const status505HttpVersionNotsupported = 505;
|
|
61
|
+
export const status506VariantAlsoNegotiates = 506;
|
|
62
|
+
export const status507InsufficientStorage = 507;
|
|
63
|
+
export const status508LoopDetected = 508;
|
|
64
|
+
export const status510NotExtended = 510;
|
|
65
|
+
export const status511NetworkAuthenticationRequired = 511;
|