@outfoxx/sunday 1.1.0-alpha.10 → 1.1.0-alpha.13
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/LICENSE.txt +203 -0
- package/README.md +1 -1
- package/dist/any-type.js +13 -0
- package/dist/any-type.js.map +1 -1
- package/dist/class-type.js +13 -0
- package/dist/class-type.js.map +1 -1
- package/dist/date-time-types.js +13 -0
- package/dist/date-time-types.js.map +1 -1
- package/dist/event-parser.js +13 -0
- package/dist/event-parser.js.map +1 -1
- package/dist/fetch-event-source.js +13 -0
- package/dist/fetch-event-source.js.map +1 -1
- package/dist/fetch-request-factory.js +13 -0
- package/dist/fetch-request-factory.js.map +1 -1
- package/dist/fetch.js +13 -0
- package/dist/fetch.js.map +1 -1
- package/dist/header-parameters.js +13 -0
- package/dist/header-parameters.js.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/logger.js +13 -0
- package/dist/logger.js.map +1 -1
- package/dist/media-type-codecs/any-text-decoder.d.ts +7 -0
- package/dist/media-type-codecs/any-text-decoder.js +29 -0
- package/dist/media-type-codecs/any-text-decoder.js.map +1 -0
- package/dist/media-type-codecs/any-text-encoder.d.ts +5 -0
- package/dist/media-type-codecs/any-text-encoder.js +23 -0
- package/dist/media-type-codecs/any-text-encoder.js.map +1 -0
- package/dist/media-type-codecs/binary-decoder.js +13 -0
- package/dist/media-type-codecs/binary-decoder.js.map +1 -1
- package/dist/media-type-codecs/binary-encoder.js +13 -0
- package/dist/media-type-codecs/binary-encoder.js.map +1 -1
- package/dist/media-type-codecs/cbor-decoder.js +13 -0
- package/dist/media-type-codecs/cbor-decoder.js.map +1 -1
- package/dist/media-type-codecs/cbor-encoder.js +13 -0
- package/dist/media-type-codecs/cbor-encoder.js.map +1 -1
- package/dist/media-type-codecs/cbor-tags.js +13 -0
- package/dist/media-type-codecs/cbor-tags.js.map +1 -1
- package/dist/media-type-codecs/json-decoder.js +13 -0
- package/dist/media-type-codecs/json-decoder.js.map +1 -1
- package/dist/media-type-codecs/json-encoder.js +13 -0
- package/dist/media-type-codecs/json-encoder.js.map +1 -1
- package/dist/media-type-codecs/media-type-decoder.js +13 -0
- package/dist/media-type-codecs/media-type-decoder.js.map +1 -1
- package/dist/media-type-codecs/media-type-decoders.js +21 -3
- package/dist/media-type-codecs/media-type-decoders.js.map +1 -1
- package/dist/media-type-codecs/media-type-encoder.js +13 -0
- package/dist/media-type-codecs/media-type-encoder.js.map +1 -1
- package/dist/media-type-codecs/media-type-encoders.js +20 -3
- package/dist/media-type-codecs/media-type-encoders.js.map +1 -1
- package/dist/media-type-codecs/www-form-url-encoder.js +56 -6
- package/dist/media-type-codecs/www-form-url-encoder.js.map +1 -1
- package/dist/media-type.js +13 -0
- package/dist/media-type.js.map +1 -1
- package/dist/problem.js +13 -0
- package/dist/problem.js.map +1 -1
- package/dist/request-factory.js +13 -0
- package/dist/request-factory.js.map +1 -1
- package/dist/sunday-error.js +13 -0
- package/dist/sunday-error.js.map +1 -1
- package/dist/url-template.js +13 -0
- package/dist/url-template.js.map +1 -1
- package/dist/util/any.js +13 -0
- package/dist/util/any.js.map +1 -1
- package/dist/util/base64.js +13 -0
- package/dist/util/base64.js.map +1 -1
- package/dist/util/error.js +13 -0
- package/dist/util/error.js.map +1 -1
- package/dist/util/hex.js +13 -0
- package/dist/util/hex.js.map +1 -1
- package/dist/util/rxjs.js +13 -0
- package/dist/util/rxjs.js.map +1 -1
- package/dist/util/stream-rxjs.js +13 -0
- package/dist/util/stream-rxjs.js.map +1 -1
- package/dist/util/temporal.js +13 -0
- package/dist/util/temporal.js.map +1 -1
- package/package.json +10 -9
- package/src/any-type.ts +14 -0
- package/src/class-type.ts +14 -0
- package/src/date-time-types.ts +14 -0
- package/src/event-parser.ts +14 -0
- package/src/fetch-event-source.ts +14 -0
- package/src/fetch-request-factory.ts +14 -0
- package/src/fetch.ts +14 -0
- package/src/header-parameters.ts +14 -0
- package/src/index.ts +14 -0
- package/src/logger.ts +14 -0
- package/src/media-type-codecs/any-text-decoder.ts +34 -0
- package/src/media-type-codecs/any-text-encoder.ts +26 -0
- package/src/media-type-codecs/binary-decoder.ts +14 -0
- package/src/media-type-codecs/binary-encoder.ts +14 -0
- package/src/media-type-codecs/cbor-decoder.ts +14 -0
- package/src/media-type-codecs/cbor-encoder.ts +14 -0
- package/src/media-type-codecs/cbor-tags.ts +14 -0
- package/src/media-type-codecs/json-decoder.ts +14 -0
- package/src/media-type-codecs/json-encoder.ts +14 -0
- package/src/media-type-codecs/media-type-decoder.ts +14 -0
- package/src/media-type-codecs/media-type-decoders.ts +23 -3
- package/src/media-type-codecs/media-type-encoder.ts +14 -0
- package/src/media-type-codecs/media-type-encoders.ts +21 -3
- package/src/media-type-codecs/www-form-url-encoder.ts +71 -7
- package/src/media-type.ts +14 -0
- package/src/problem.ts +14 -0
- package/src/request-factory.ts +14 -0
- package/src/sunday-error.ts +14 -0
- package/src/url-template.ts +14 -0
- package/src/util/any.ts +14 -0
- package/src/util/base64.ts +14 -0
- package/src/util/error.ts +14 -0
- package/src/util/hex.ts +14 -0
- package/src/util/rxjs.ts +14 -0
- package/src/util/stream-rxjs.ts +14 -0
- package/src/util/temporal.ts +14 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import { MediaTypeEncoder } from './media-type-encoder';
|
|
16
|
+
|
|
17
|
+
export class AnyTextEncoder implements MediaTypeEncoder {
|
|
18
|
+
static default = new AnyTextEncoder();
|
|
19
|
+
|
|
20
|
+
encode(value: unknown): BodyInit {
|
|
21
|
+
if (typeof value != 'string') {
|
|
22
|
+
throw Error('Invalid value, expected string');
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { MediaTypeDecoder } from './media-type-decoder';
|
|
2
16
|
import { AnyConstructableType } from '../any-type';
|
|
3
17
|
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { MediaTypeEncoder } from './media-type-encoder';
|
|
2
16
|
|
|
3
17
|
export class BinaryEncoder implements MediaTypeEncoder {
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import {
|
|
2
16
|
DateTimeFormatter,
|
|
3
17
|
DateTimeFormatterBuilder,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import {
|
|
2
16
|
ChronoField,
|
|
3
17
|
DateTimeFormatter,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
export const isoDateTimeTag = 0;
|
|
2
16
|
export const epochDateTimeTag = 1;
|
|
3
17
|
export const uriTag = 32;
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import {
|
|
2
16
|
DateTimeFormatter,
|
|
3
17
|
DateTimeFormatterBuilder,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import {
|
|
2
16
|
ChronoField,
|
|
3
17
|
DateTimeFormatter,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { AnyType } from '../any-type';
|
|
2
16
|
|
|
3
17
|
export interface MediaTypeDecoder {
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import { AnyTextDecoder } from './any-text-decoder';
|
|
1
16
|
import { BinaryDecoder } from './binary-decoder';
|
|
17
|
+
import { BinaryEncoder } from './binary-encoder';
|
|
2
18
|
import { CBORDecoder } from './cbor-decoder';
|
|
3
19
|
import { JSONDecoder } from './json-decoder';
|
|
4
20
|
import { MediaType } from '../media-type';
|
|
@@ -33,9 +49,13 @@ export class MediaTypeDecoders {
|
|
|
33
49
|
}
|
|
34
50
|
|
|
35
51
|
addDefaults(): MediaTypeDecodersBuilder {
|
|
36
|
-
return this.add(MediaType.
|
|
37
|
-
.add(MediaType.
|
|
38
|
-
.add(MediaType.CBOR, CBORDecoder.default)
|
|
52
|
+
return this.add(MediaType.OctetStream, BinaryDecoder.default)
|
|
53
|
+
.add(MediaType.JSON, JSONDecoder.default)
|
|
54
|
+
.add(MediaType.CBOR, CBORDecoder.default)
|
|
55
|
+
.add(MediaType.EventStream, BinaryDecoder.default)
|
|
56
|
+
.add(MediaType.AnyText, AnyTextDecoder.default)
|
|
57
|
+
.add(MediaType.X509CACert, BinaryDecoder.default)
|
|
58
|
+
.add(MediaType.X509UserCert, BinaryDecoder.default);
|
|
39
59
|
}
|
|
40
60
|
|
|
41
61
|
build(): MediaTypeDecoders {
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { AnyType } from '../any-type';
|
|
2
16
|
|
|
3
17
|
export interface MediaTypeEncoder {
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { MediaType } from '../media-type';
|
|
16
|
+
import { AnyTextEncoder } from './any-text-encoder';
|
|
2
17
|
import { BinaryEncoder } from './binary-encoder';
|
|
3
18
|
import { CBOREncoder } from './cbor-encoder';
|
|
4
19
|
import { JSONEncoder } from './json-encoder';
|
|
@@ -34,10 +49,13 @@ export class MediaTypeEncoders {
|
|
|
34
49
|
}
|
|
35
50
|
|
|
36
51
|
addDefaults(): MediaTypeEncodersBuilder {
|
|
37
|
-
return this.add(MediaType.
|
|
38
|
-
.add(MediaType.OctetStream, BinaryEncoder.default)
|
|
52
|
+
return this.add(MediaType.OctetStream, BinaryEncoder.default)
|
|
39
53
|
.add(MediaType.WWWFormUrlEncoded, WWWFormUrlEncoder.default)
|
|
40
|
-
.add(MediaType.
|
|
54
|
+
.add(MediaType.JSON, JSONEncoder.default)
|
|
55
|
+
.add(MediaType.CBOR, CBOREncoder.default)
|
|
56
|
+
.add(MediaType.AnyText, AnyTextEncoder.default)
|
|
57
|
+
.add(MediaType.X509CACert, BinaryEncoder.default)
|
|
58
|
+
.add(MediaType.X509UserCert, BinaryEncoder.default);
|
|
41
59
|
}
|
|
42
60
|
|
|
43
61
|
build(): MediaTypeEncoders {
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
DateTimeFormatter,
|
|
17
|
+
Instant,
|
|
18
|
+
LocalDate,
|
|
19
|
+
LocalDateTime,
|
|
20
|
+
LocalTime,
|
|
21
|
+
OffsetDateTime,
|
|
22
|
+
OffsetTime,
|
|
23
|
+
Temporal,
|
|
24
|
+
ZonedDateTime,
|
|
25
|
+
} from '@js-joda/core';
|
|
2
26
|
import { JsonStringifier } from '@outfoxx/jackson-js';
|
|
3
27
|
import { URLQueryParamsEncoder } from './media-type-encoder';
|
|
4
28
|
|
|
@@ -54,12 +78,24 @@ export class WWWFormUrlEncoder implements URLQueryParamsEncoder {
|
|
|
54
78
|
)
|
|
55
79
|
);
|
|
56
80
|
}
|
|
57
|
-
} else if (value instanceof
|
|
81
|
+
} else if (value instanceof Date) {
|
|
58
82
|
//
|
|
59
83
|
components.push(
|
|
60
84
|
encodeURIComponent(key) +
|
|
61
85
|
'=' +
|
|
62
|
-
encodeURIComponent(
|
|
86
|
+
encodeURIComponent(
|
|
87
|
+
encodeInstant(
|
|
88
|
+
Instant.ofEpochMilli(value.getTime()),
|
|
89
|
+
this.dateEncoding
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
} else if (value instanceof Temporal) {
|
|
94
|
+
//
|
|
95
|
+
components.push(
|
|
96
|
+
encodeURIComponent(key) +
|
|
97
|
+
'=' +
|
|
98
|
+
encodeURIComponent(encodeTemporal(value, this.dateEncoding))
|
|
63
99
|
);
|
|
64
100
|
} else if (typeof value === 'boolean') {
|
|
65
101
|
//
|
|
@@ -111,18 +147,46 @@ function encodeBoolean(
|
|
|
111
147
|
}
|
|
112
148
|
}
|
|
113
149
|
|
|
114
|
-
function
|
|
115
|
-
value:
|
|
150
|
+
function encodeTemporal(
|
|
151
|
+
value: Temporal,
|
|
152
|
+
encoding: WWWFormUrlEncoder.DateEncoding
|
|
153
|
+
): string {
|
|
154
|
+
if (value instanceof Instant) {
|
|
155
|
+
return encodeInstant(value, encoding);
|
|
156
|
+
} else if (value instanceof OffsetDateTime) {
|
|
157
|
+
if (encoding == WWWFormUrlEncoder.DateEncoding.ISO8601) {
|
|
158
|
+
return value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
|
159
|
+
}
|
|
160
|
+
return encodeInstant(value.toInstant(), encoding);
|
|
161
|
+
} else if (value instanceof ZonedDateTime) {
|
|
162
|
+
if (encoding == WWWFormUrlEncoder.DateEncoding.ISO8601) {
|
|
163
|
+
return value.format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
|
|
164
|
+
}
|
|
165
|
+
return encodeInstant(value.toInstant(), encoding);
|
|
166
|
+
} else if (value instanceof LocalDateTime) {
|
|
167
|
+
return value.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
|
|
168
|
+
} else if (value instanceof LocalDate) {
|
|
169
|
+
return value.format(DateTimeFormatter.ISO_LOCAL_DATE);
|
|
170
|
+
} else if (value instanceof LocalTime) {
|
|
171
|
+
return value.format(DateTimeFormatter.ISO_LOCAL_TIME);
|
|
172
|
+
} else if (value instanceof OffsetTime) {
|
|
173
|
+
return value.format(DateTimeFormatter.ISO_OFFSET_TIME);
|
|
174
|
+
} else {
|
|
175
|
+
throw Error('unsupported temporal value for ');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function encodeInstant(
|
|
180
|
+
value: Instant,
|
|
116
181
|
encoding: WWWFormUrlEncoder.DateEncoding
|
|
117
182
|
): string {
|
|
118
|
-
value = value instanceof Date ? Instant.ofEpochMilli(value.getTime()) : value;
|
|
119
183
|
switch (encoding) {
|
|
120
184
|
case WWWFormUrlEncoder.DateEncoding.DECIMAL_SECONDS_SINCE_EPOCH:
|
|
121
185
|
return (value.epochSecond() + value.nano() / 1_000_000_000.0).toFixed(7);
|
|
122
186
|
case WWWFormUrlEncoder.DateEncoding.MILLISECONDS_SINCE_EPOCH:
|
|
123
187
|
return `${value.toEpochMilli()}`;
|
|
124
188
|
case WWWFormUrlEncoder.DateEncoding.ISO8601:
|
|
125
|
-
return
|
|
189
|
+
return DateTimeFormatter.ISO_INSTANT.format(value);
|
|
126
190
|
default:
|
|
127
191
|
throw new Error('unknown date encoding');
|
|
128
192
|
}
|
package/src/media-type.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
export class MediaType {
|
|
2
16
|
type: MediaType.Type;
|
|
3
17
|
tree: MediaType.Tree;
|
package/src/problem.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { ResponseExample } from './fetch';
|
|
2
16
|
import {
|
|
3
17
|
JsonAnyGetter,
|
package/src/request-factory.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { Observable } from 'rxjs';
|
|
2
16
|
import { AnyType } from './any-type';
|
|
3
17
|
import { ClassType, ConstructableClassType } from './class-type';
|
package/src/sunday-error.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { ResponseExample } from './fetch';
|
|
2
16
|
|
|
3
17
|
export class SundayError extends Error {
|
package/src/url-template.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { URI } from 'uri-template-lite';
|
|
2
16
|
|
|
3
17
|
export class URLTemplate {
|
package/src/util/any.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
export function unknownGet<T = unknown>(obj: unknown, key: string): T {
|
|
2
16
|
return (obj as Record<string, unknown>)?.[key] as T;
|
|
3
17
|
}
|
package/src/util/base64.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
const chars =
|
|
2
16
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
3
17
|
|
package/src/util/error.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
export function isError(value: unknown): value is Error {
|
|
2
16
|
return value instanceof Error;
|
|
3
17
|
}
|
package/src/util/hex.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
export namespace Hex {
|
|
2
16
|
export function decode(hex: string): ArrayBuffer {
|
|
3
17
|
hex = hex.replace(/^0x/, '').replace(/\s/g, '');
|
package/src/util/rxjs.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { catchError, from, Observable, throwError } from 'rxjs';
|
|
2
16
|
import { ClassType } from '../class-type';
|
|
3
17
|
import { Problem } from '../problem';
|
package/src/util/stream-rxjs.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
import { Observable } from 'rxjs';
|
|
2
16
|
|
|
3
17
|
export function fromStream(
|
package/src/util/temporal.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
// Copyright 2020 Outfox, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
1
15
|
export function secondsToNumber(seconds: number, nanos: number): number {
|
|
2
16
|
if (nanos == 0) {
|
|
3
17
|
return seconds;
|