@outfoxx/sunday 1.0.9 → 1.1.0-alpha.11
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 +35 -2
- package/dist/any-type.d.ts +2 -0
- package/dist/any-type.js +13 -0
- package/dist/any-type.js.map +1 -1
- package/dist/class-type.d.ts +2 -2
- package/dist/class-type.js +13 -0
- package/dist/class-type.js.map +1 -1
- package/dist/date-time-types.d.ts +2 -7
- package/dist/date-time-types.js +15 -4
- package/dist/date-time-types.js.map +1 -1
- package/dist/event-parser.d.ts +17 -0
- package/dist/event-parser.js +153 -0
- package/dist/event-parser.js.map +1 -0
- package/dist/fetch-event-source.d.ts +12 -10
- package/dist/fetch-event-source.js +154 -138
- package/dist/fetch-event-source.js.map +1 -1
- package/dist/fetch-request-factory.d.ts +10 -5
- package/dist/fetch-request-factory.js +100 -71
- package/dist/fetch-request-factory.js.map +1 -1
- package/dist/fetch.d.ts +7 -1
- package/dist/fetch.js +74 -8
- package/dist/fetch.js.map +1 -1
- package/dist/header-parameters.d.ts +3 -0
- package/dist/header-parameters.js +53 -0
- package/dist/header-parameters.js.map +1 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/dist/logger.js +13 -0
- package/dist/logger.js.map +1 -1
- package/dist/{binary-decoder.d.ts → media-type-codecs/binary-decoder.d.ts} +2 -2
- package/dist/media-type-codecs/binary-decoder.js +29 -0
- package/dist/media-type-codecs/binary-decoder.js.map +1 -0
- package/dist/{binary-encoder.d.ts → media-type-codecs/binary-encoder.d.ts} +0 -0
- package/dist/media-type-codecs/binary-encoder.js +26 -0
- package/dist/media-type-codecs/binary-encoder.js.map +1 -0
- package/dist/media-type-codecs/cbor-decoder.d.ts +39 -0
- package/dist/media-type-codecs/cbor-decoder.js +426 -0
- package/dist/media-type-codecs/cbor-decoder.js.map +1 -0
- package/dist/media-type-codecs/cbor-encoder.d.ts +43 -0
- package/dist/media-type-codecs/cbor-encoder.js +239 -0
- package/dist/media-type-codecs/cbor-encoder.js.map +1 -0
- package/dist/media-type-codecs/cbor-tags.d.ts +4 -0
- package/dist/media-type-codecs/cbor-tags.js +18 -0
- package/dist/media-type-codecs/cbor-tags.js.map +1 -0
- package/dist/media-type-codecs/json-decoder.d.ts +39 -0
- package/dist/media-type-codecs/json-decoder.js +380 -0
- package/dist/media-type-codecs/json-decoder.js.map +1 -0
- package/dist/media-type-codecs/json-encoder.d.ts +44 -0
- package/dist/media-type-codecs/json-encoder.js +276 -0
- package/dist/media-type-codecs/json-encoder.js.map +1 -0
- package/dist/media-type-codecs/media-type-decoder.d.ts +11 -0
- package/dist/media-type-codecs/media-type-decoder.js +19 -0
- package/dist/media-type-codecs/media-type-decoder.js.map +1 -0
- package/dist/{media-type-decoders.d.ts → media-type-codecs/media-type-decoders.d.ts} +5 -4
- package/dist/media-type-codecs/media-type-decoders.js +53 -0
- package/dist/media-type-codecs/media-type-decoders.js.map +1 -0
- package/dist/{media-type-encoder.d.ts → media-type-codecs/media-type-encoder.d.ts} +5 -1
- package/dist/media-type-codecs/media-type-encoder.js +24 -0
- package/dist/media-type-codecs/media-type-encoder.js.map +1 -0
- package/dist/{media-type-encoders.d.ts → media-type-codecs/media-type-encoders.d.ts} +5 -4
- package/dist/media-type-codecs/media-type-encoders.js +55 -0
- package/dist/media-type-codecs/media-type-encoders.js.map +1 -0
- package/dist/{url-encoder.d.ts → media-type-codecs/www-form-url-encoder.d.ts} +8 -8
- package/dist/{url-encoder.js → media-type-codecs/www-form-url-encoder.js} +51 -37
- package/dist/media-type-codecs/www-form-url-encoder.js.map +1 -0
- package/dist/media-type.d.ts +91 -13
- package/dist/media-type.js +286 -15
- package/dist/media-type.js.map +1 -1
- package/dist/problem.d.ts +24 -9
- package/dist/problem.js +153 -6
- package/dist/problem.js.map +1 -1
- package/dist/request-factory.d.ts +10 -10
- package/dist/request-factory.js +13 -0
- package/dist/request-factory.js.map +1 -1
- package/dist/sunday-error.d.ts +11 -0
- package/dist/sunday-error.js +31 -0
- package/dist/sunday-error.js.map +1 -0
- package/dist/url-template.js +13 -0
- package/dist/url-template.js.map +1 -1
- package/dist/util/any.d.ts +2 -0
- package/dist/util/any.js +24 -0
- package/dist/util/any.js.map +1 -0
- package/dist/util/base64.js +13 -0
- package/dist/util/base64.js.map +1 -1
- package/dist/util/error.d.ts +2 -0
- package/dist/util/error.js +26 -0
- package/dist/util/error.js.map +1 -0
- package/dist/util/hex.js +16 -2
- package/dist/util/hex.js.map +1 -1
- package/dist/util/rxjs.d.ts +3 -0
- package/dist/util/rxjs.js +22 -5
- 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.d.ts +2 -0
- package/dist/util/temporal.js +31 -0
- package/dist/util/temporal.js.map +1 -0
- package/package.json +29 -22
- package/src/any-type.ts +18 -0
- package/src/class-type.ts +20 -2
- package/src/date-time-types.ts +35 -8
- package/src/event-parser.ts +204 -0
- package/src/fetch-event-source.ts +163 -159
- package/src/fetch-request-factory.ts +142 -100
- package/src/fetch.ts +79 -14
- package/src/header-parameters.ts +66 -0
- package/src/index.ts +26 -12
- package/src/logger.ts +14 -0
- package/src/media-type-codecs/binary-decoder.ts +38 -0
- package/src/media-type-codecs/binary-encoder.ts +33 -0
- package/src/media-type-codecs/cbor-decoder.ts +529 -0
- package/src/media-type-codecs/cbor-encoder.ts +321 -0
- package/src/media-type-codecs/cbor-tags.ts +18 -0
- package/src/media-type-codecs/json-decoder.ts +484 -0
- package/src/media-type-codecs/json-encoder.ts +342 -0
- package/src/media-type-codecs/media-type-decoder.ts +34 -0
- package/src/media-type-codecs/media-type-decoders.ts +81 -0
- package/src/media-type-codecs/media-type-encoder.ts +45 -0
- package/src/media-type-codecs/media-type-encoders.ts +83 -0
- package/src/media-type-codecs/www-form-url-encoder.ts +193 -0
- package/src/media-type.ts +340 -22
- package/src/problem.ts +158 -12
- package/src/request-factory.ts +35 -12
- package/src/sunday-error.ts +51 -0
- package/src/url-template.ts +14 -0
- package/src/util/any.ts +24 -0
- package/src/util/base64.ts +14 -0
- package/src/util/error.ts +28 -0
- package/src/util/hex.ts +17 -2
- package/src/util/rxjs.ts +30 -5
- package/src/util/stream-rxjs.ts +14 -0
- package/src/util/temporal.ts +32 -0
- package/dist/binary-decoder.js +0 -16
- package/dist/binary-decoder.js.map +0 -1
- package/dist/binary-encoder.js +0 -13
- package/dist/binary-encoder.js.map +0 -1
- package/dist/cbor-decoder.d.ts +0 -15
- package/dist/cbor-decoder.js +0 -126
- package/dist/cbor-decoder.js.map +0 -1
- package/dist/cbor-encoder.d.ts +0 -29
- package/dist/cbor-encoder.js +0 -81
- package/dist/cbor-encoder.js.map +0 -1
- package/dist/cbor-tags.d.ts +0 -3
- package/dist/cbor-tags.js +0 -4
- package/dist/cbor-tags.js.map +0 -1
- package/dist/http-error.d.ts +0 -10
- package/dist/http-error.js +0 -45
- package/dist/http-error.js.map +0 -1
- package/dist/json-decoder.d.ts +0 -31
- package/dist/json-decoder.js +0 -139
- package/dist/json-decoder.js.map +0 -1
- package/dist/json-encoder.d.ts +0 -35
- package/dist/json-encoder.js +0 -134
- package/dist/json-encoder.js.map +0 -1
- package/dist/media-type-decoder.d.ts +0 -4
- package/dist/media-type-decoder.js +0 -2
- package/dist/media-type-decoder.js.map +0 -1
- package/dist/media-type-decoders.js +0 -40
- package/dist/media-type-decoders.js.map +0 -1
- package/dist/media-type-encoder.js +0 -6
- package/dist/media-type-encoder.js.map +0 -1
- package/dist/media-type-encoders.js +0 -42
- package/dist/media-type-encoders.js.map +0 -1
- package/dist/url-encoder.js.map +0 -1
- package/src/binary-decoder.ts +0 -24
- package/src/binary-encoder.ts +0 -19
- package/src/cbor-decoder.ts +0 -148
- package/src/cbor-encoder.ts +0 -95
- package/src/cbor-tags.ts +0 -3
- package/src/http-error.ts +0 -55
- package/src/json-decoder.ts +0 -164
- package/src/json-encoder.ts +0 -162
- package/src/media-type-decoder.ts +0 -5
- package/src/media-type-decoders.ts +0 -59
- package/src/media-type-encoder.ts +0 -16
- package/src/media-type-encoders.ts +0 -61
- package/src/url-encoder.ts +0 -173
package/dist/problem.js
CHANGED
|
@@ -1,11 +1,158 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
};
|
|
23
|
+
var Problem_1;
|
|
24
|
+
import { ResponseExample } from './fetch';
|
|
25
|
+
import { JsonAnyGetter, JsonAnySetter, JsonClassType, JsonCreator, JsonCreatorMode, JsonIgnore, JsonProperty, } from '@outfoxx/jackson-js';
|
|
26
|
+
let Problem = Problem_1 = class Problem extends Error {
|
|
27
|
+
constructor(spec) {
|
|
28
|
+
var _a;
|
|
29
|
+
super(`${spec.status.toString()} ${spec.type} - ${spec.title}`);
|
|
30
|
+
const src = spec;
|
|
31
|
+
const json = Object.assign({}, src);
|
|
32
|
+
this.type = (_a = Problem_1.parseURL(json.type)) !== null && _a !== void 0 ? _a : new URL('about:blank');
|
|
33
|
+
delete json.type;
|
|
5
34
|
this.status = json.status;
|
|
35
|
+
delete json.status;
|
|
6
36
|
this.title = json.title;
|
|
37
|
+
delete json.title;
|
|
7
38
|
this.detail = json.detail;
|
|
8
|
-
|
|
39
|
+
delete json.detail;
|
|
40
|
+
this.instance = Problem_1.parseURL(json.instance);
|
|
41
|
+
delete json.instance;
|
|
42
|
+
if (Object.keys(json).length != 0) {
|
|
43
|
+
this._parameters = json;
|
|
44
|
+
}
|
|
9
45
|
}
|
|
10
|
-
|
|
46
|
+
get parameters() {
|
|
47
|
+
return this._parameters;
|
|
48
|
+
}
|
|
49
|
+
setParameter(key, value) {
|
|
50
|
+
var _a;
|
|
51
|
+
this._parameters = (_a = this._parameters) !== null && _a !== void 0 ? _a : {};
|
|
52
|
+
this._parameters[key] = value;
|
|
53
|
+
}
|
|
54
|
+
toString() {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
const self = this;
|
|
58
|
+
const url = self.request ? (_a = self.request) === null || _a === void 0 ? void 0 : _a.url : undefined;
|
|
59
|
+
const response = (_b = self.response) === null || _b === void 0 ? void 0 : _b.example;
|
|
60
|
+
return JSON.stringify({
|
|
61
|
+
type: this.type,
|
|
62
|
+
status: this.status,
|
|
63
|
+
title: this.title,
|
|
64
|
+
detail: this.detail,
|
|
65
|
+
instance: this.instance,
|
|
66
|
+
url,
|
|
67
|
+
response,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
static fromStatus(status, title) {
|
|
71
|
+
return new Problem_1({
|
|
72
|
+
type: 'about:blank',
|
|
73
|
+
title,
|
|
74
|
+
status,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
static async fromResponse(response) {
|
|
78
|
+
const [bodyExcerpt, body] = await ResponseExample.bodyExcerpt(response, 256);
|
|
79
|
+
return new Problem_1({
|
|
80
|
+
type: 'about:blank',
|
|
81
|
+
title: response.statusText,
|
|
82
|
+
status: response.status,
|
|
83
|
+
request: {
|
|
84
|
+
url: response.url,
|
|
85
|
+
},
|
|
86
|
+
response: {
|
|
87
|
+
headers: response.headers,
|
|
88
|
+
ok: response.ok,
|
|
89
|
+
redirected: response.redirected,
|
|
90
|
+
status: response.status,
|
|
91
|
+
statusText: response.statusText,
|
|
92
|
+
type: response.type,
|
|
93
|
+
url: response.url,
|
|
94
|
+
body,
|
|
95
|
+
example: ResponseExample.build(response, bodyExcerpt),
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
static parseURL(value) {
|
|
100
|
+
if (value == null) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
if (value instanceof URL) {
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
if (typeof value == 'string') {
|
|
107
|
+
return new URL(value);
|
|
108
|
+
}
|
|
109
|
+
return new URL(`${value}`);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
__decorate([
|
|
113
|
+
JsonProperty(),
|
|
114
|
+
JsonClassType({ type: () => [URL] }),
|
|
115
|
+
__metadata("design:type", URL)
|
|
116
|
+
], Problem.prototype, "type", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
JsonProperty(),
|
|
119
|
+
JsonClassType({ type: () => [String] }),
|
|
120
|
+
__metadata("design:type", String)
|
|
121
|
+
], Problem.prototype, "title", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
JsonProperty(),
|
|
124
|
+
JsonClassType({ type: () => [Number] }),
|
|
125
|
+
__metadata("design:type", Number)
|
|
126
|
+
], Problem.prototype, "status", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
JsonProperty(),
|
|
129
|
+
JsonClassType({ type: () => [String] }),
|
|
130
|
+
__metadata("design:type", String)
|
|
131
|
+
], Problem.prototype, "detail", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
JsonProperty(),
|
|
134
|
+
JsonClassType({ type: () => [URL] }),
|
|
135
|
+
__metadata("design:type", URL)
|
|
136
|
+
], Problem.prototype, "instance", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
JsonIgnore(),
|
|
139
|
+
__metadata("design:type", Object)
|
|
140
|
+
], Problem.prototype, "_parameters", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
JsonClassType({ type: () => [Object] }),
|
|
143
|
+
JsonAnyGetter(),
|
|
144
|
+
__metadata("design:type", Object),
|
|
145
|
+
__metadata("design:paramtypes", [])
|
|
146
|
+
], Problem.prototype, "parameters", null);
|
|
147
|
+
__decorate([
|
|
148
|
+
JsonAnySetter(),
|
|
149
|
+
__metadata("design:type", Function),
|
|
150
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
151
|
+
__metadata("design:returntype", void 0)
|
|
152
|
+
], Problem.prototype, "setParameter", null);
|
|
153
|
+
Problem = Problem_1 = __decorate([
|
|
154
|
+
JsonCreator({ mode: JsonCreatorMode.DELEGATING }),
|
|
155
|
+
__metadata("design:paramtypes", [Object])
|
|
156
|
+
], Problem);
|
|
157
|
+
export { Problem };
|
|
11
158
|
//# sourceMappingURL=problem.js.map
|
package/dist/problem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problem.js","sourceRoot":"","sources":["../src/problem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"problem.js","sourceRoot":"","sources":["../src/problem.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AA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AE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;;uCAClB;AAItB;IAFC,YAAY,EAAE;IACd,aAAa,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;;uCACjB;AAIvB;IAFC,YAAY,EAAE;IACd,aAAa,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;8BACnB,GAAG;yCAAC;AAGtB;IADC,UAAU,EAAE;;4CACiC;AAI9C;IAFC,aAAa,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACvC,aAAa,EAAE;;;yCAGf;AAGD;IADC,aAAa,EAAE;;;;2CAIf;AAlCU,OAAO;IADnB,WAAW,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,CAAC;;GACrC,OAAO,CA8HnB;SA9HY,OAAO"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { ClassList } from '@outfoxx/jackson-js/dist/@types';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
3
2
|
import { AnyType } from './any-type';
|
|
4
|
-
import { ClassType } from './class-type';
|
|
3
|
+
import { ClassType, ConstructableClassType } from './class-type';
|
|
5
4
|
import { MediaType } from './media-type';
|
|
5
|
+
import { TextMediaTypeDecoder } from './media-type-codecs/media-type-decoder';
|
|
6
|
+
import { Problem } from './problem';
|
|
6
7
|
import { URLTemplate } from './url-template';
|
|
8
|
+
import { Logger } from './logger';
|
|
7
9
|
export interface RequestFactory {
|
|
8
10
|
readonly baseUrl: URLTemplate;
|
|
11
|
+
registerProblem(type: URL | string, problemType: ConstructableClassType<Problem>): void;
|
|
9
12
|
request(requestSpec: RequestSpec<unknown>): Observable<Request>;
|
|
10
13
|
response(request: Request, dataExpected?: boolean): Observable<Response>;
|
|
11
14
|
response<B>(requestSpec: RequestSpec<B>, dataExpected?: boolean): Observable<Response>;
|
|
@@ -14,8 +17,8 @@ export interface RequestFactory {
|
|
|
14
17
|
result<B, R>(requestSpec: RequestSpec<B>, resultType: [ClassType<Set<unknown>>, ClassType<R>]): Observable<Set<R>>;
|
|
15
18
|
result<B, R>(requestSpec: RequestSpec<B>, resultType: AnyType): Observable<R>;
|
|
16
19
|
result<B>(requestSpec: RequestSpec<B>): Observable<void>;
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
eventSource(requestSpec: RequestSpec<void>): ExtEventSource;
|
|
21
|
+
eventStream<E>(requestSpec: RequestSpec<void>, decoder: (decoder: TextMediaTypeDecoder, event: string | undefined, id: string | undefined, data: string, logger?: Logger) => E | undefined): Observable<E>;
|
|
19
22
|
}
|
|
20
23
|
export interface ExtEventSource extends EventSource {
|
|
21
24
|
connect(): void;
|
|
@@ -28,11 +31,8 @@ export interface RequestSpec<B> {
|
|
|
28
31
|
queryParameters?: Record<string, unknown>;
|
|
29
32
|
body?: B;
|
|
30
33
|
bodyType?: AnyType;
|
|
31
|
-
contentTypes?:
|
|
32
|
-
acceptTypes?:
|
|
33
|
-
headers?:
|
|
34
|
-
}
|
|
35
|
-
export interface EventTypes<E> {
|
|
36
|
-
[key: string]: ClassList<ClassType<E>>;
|
|
34
|
+
contentTypes?: MediaType[];
|
|
35
|
+
acceptTypes?: MediaType[];
|
|
36
|
+
headers?: Record<string, unknown>;
|
|
37
37
|
}
|
|
38
38
|
export declare type RequestAdapter = (request: Request) => Observable<Request>;
|
package/dist/request-factory.js
CHANGED
|
@@ -1,2 +1,15 @@
|
|
|
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.
|
|
1
14
|
export {};
|
|
2
15
|
//# sourceMappingURL=request-factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-factory.js","sourceRoot":"","sources":["../src/request-factory.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"request-factory.js","sourceRoot":"","sources":["../src/request-factory.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class SundayError extends Error {
|
|
2
|
+
url: string;
|
|
3
|
+
httpVersion: string;
|
|
4
|
+
status: number;
|
|
5
|
+
statusText: string;
|
|
6
|
+
headers: Headers;
|
|
7
|
+
body: unknown | undefined;
|
|
8
|
+
responseExample: string;
|
|
9
|
+
constructor(message: string, url: string, httpVersion: string, status: number, statusText: string, headers: Headers, body: unknown | undefined, responseExample: string);
|
|
10
|
+
static fromResponse(message: string, response: Response): Promise<SundayError>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { ResponseExample } from './fetch';
|
|
15
|
+
export class SundayError extends Error {
|
|
16
|
+
constructor(message, url, httpVersion, status, statusText, headers, body, responseExample) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.url = url;
|
|
19
|
+
this.httpVersion = httpVersion;
|
|
20
|
+
this.status = status;
|
|
21
|
+
this.statusText = statusText;
|
|
22
|
+
this.headers = headers;
|
|
23
|
+
this.body = body;
|
|
24
|
+
this.responseExample = responseExample;
|
|
25
|
+
}
|
|
26
|
+
static async fromResponse(message, response) {
|
|
27
|
+
const [bodyExcerpt, body] = await ResponseExample.bodyExcerpt(response, 256);
|
|
28
|
+
return new SundayError(message, response.url, '?.?', response.status, response.statusText, response.headers, body, ResponseExample.build(response, bodyExcerpt));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=sunday-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sunday-error.js","sourceRoot":"","sources":["../src/sunday-error.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YACE,OAAe,EACR,GAAW,EACX,WAAmB,EACnB,MAAc,EACd,UAAkB,EAClB,OAAgB,EAChB,IAAyB,EACzB,eAAuB;QAE9B,KAAK,CAAC,OAAO,CAAC,CAAC;QARR,QAAG,GAAH,GAAG,CAAQ;QACX,gBAAW,GAAX,WAAW,CAAQ;QACnB,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAS;QAChB,SAAI,GAAJ,IAAI,CAAqB;QACzB,oBAAe,GAAf,eAAe,CAAQ;IAGhC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,OAAe,EACf,QAAkB;QAElB,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,MAAM,eAAe,CAAC,WAAW,CAC3D,QAAQ,EACR,GAAG,CACJ,CAAC;QAEF,OAAO,IAAI,WAAW,CACpB,OAAO,EACP,QAAQ,CAAC,GAAG,EACZ,KAAK,EACL,QAAQ,CAAC,MAAM,EACf,QAAQ,CAAC,UAAU,EACnB,QAAQ,CAAC,OAAO,EAChB,IAAI,EACJ,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAC7C,CAAC;IACJ,CAAC;CACF"}
|
package/dist/url-template.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
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.
|
|
1
14
|
import { URI } from 'uri-template-lite';
|
|
2
15
|
export class URLTemplate {
|
|
3
16
|
constructor(template, parameters = {}) {
|
package/dist/url-template.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-template.js","sourceRoot":"","sources":["../src/url-template.ts"],"names":[],"mappings":"AAAA,OA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AAU,GAAV,UAAU,CAA8B;IAC9C,CAAC;IAEJ,QAAQ,CAAC,gBAAwB,EAAE,UAAmC;QACpE,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC3C,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;QAClB,MAAM,QAAQ,GACZ,gBAAgB,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM;YAC1D,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,IAAI,gBAAgB,EAAE,CAAC;QAE7B,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;IAClE,CAAC;CACF"}
|
package/dist/util/any.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
export function unknownGet(obj, key) {
|
|
15
|
+
var _a;
|
|
16
|
+
return (_a = obj) === null || _a === void 0 ? void 0 : _a[key];
|
|
17
|
+
}
|
|
18
|
+
export function unknownSet(obj, key, value) {
|
|
19
|
+
if (obj == null) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
obj[key] = value;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=any.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../src/util/any.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,MAAM,UAAU,UAAU,CAAc,GAAY,EAAE,GAAW;;IAC/D,OAAO,MAAC,GAA+B,0CAAG,GAAG,CAAM,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,UAAU,CAAI,GAAY,EAAE,GAAW,EAAE,KAAQ;IAC/D,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,OAAO;KACR;IACA,GAA+B,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChD,CAAC"}
|
package/dist/util/base64.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
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.
|
|
1
14
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
2
15
|
/* tslint:disable:no-bitwise */
|
|
3
16
|
// Use a lookup table to find the index.
|
package/dist/util/base64.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../src/util/base64.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GACT,kEAAkE,CAAC;AAErE,+BAA+B;AAE/B,wCAAwC;AACxC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACrC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CACjC;AAED,MAAM,KAAW,MAAM,CAiEtB;AAjED,WAAiB,MAAM;IACrB,SAAgB,MAAM,CAAC,MAAuB;QAC5C,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAFe,aAAM,SAErB,CAAA;IAED,SAAgB,WAAW,CACzB,MAAuB,EACvB,MAAc,EACd,MAAc;QAEd,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACrD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;QACzB,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CA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fox, 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
|
+
export function isError(value) {
|
|
15
|
+
return value instanceof Error;
|
|
16
|
+
}
|
|
17
|
+
export function errorToMessage(value, defMsg) {
|
|
18
|
+
return isError(value) ? value.message : defMsg !== null && defMsg !== void 0 ? defMsg : `${fmtMsg(value)}`;
|
|
19
|
+
}
|
|
20
|
+
function fmtMsg(value) {
|
|
21
|
+
if (value instanceof Object) {
|
|
22
|
+
return JSON.stringify(value);
|
|
23
|
+
}
|
|
24
|
+
return `${value}`;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/util/error.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,KAAK,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,MAAe;IAC5D,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACvE,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,KAAK,YAAY,MAAM,EAAE;QAC3B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KAC9B;IACD,OAAO,GAAG,KAAK,EAAE,CAAC;AACpB,CAAC"}
|
package/dist/util/hex.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
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.
|
|
1
14
|
export var Hex;
|
|
2
15
|
(function (Hex) {
|
|
3
16
|
function decode(hex) {
|
|
17
|
+
hex = hex.replace(/^0x/, '').replace(/\s/g, '');
|
|
4
18
|
const values = hex.match(/[\da-f]{2}/gi);
|
|
5
|
-
if (!values) {
|
|
6
|
-
throw Error(
|
|
19
|
+
if (!values || values.length != hex.length / 2) {
|
|
20
|
+
throw Error(`Invalid hex string`);
|
|
7
21
|
}
|
|
8
22
|
return new Uint8Array(values.map((b) => parseInt(b, 16))).buffer;
|
|
9
23
|
}
|
package/dist/util/hex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hex.js","sourceRoot":"","sources":["../../src/util/hex.ts"],"names":[],"mappings":"AAAA,MAAM,KAAW,GAAG,
|
|
1
|
+
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d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { ClassType } from '../class-type';
|
|
3
|
+
import { Problem } from '../problem';
|
|
2
4
|
export declare function nullifyNotFound<T>(): (source: Observable<T>) => Observable<T | null>;
|
|
5
|
+
export declare function nullifyResponse<T>(statuses: number[], problemTypes: ClassType<Problem>[]): (source: Observable<T>) => Observable<T | null>;
|
package/dist/util/rxjs.js
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
import { catchError, from, throwError } from 'rxjs';
|
|
3
15
|
import { Problem } from '../problem';
|
|
4
16
|
export function nullifyNotFound() {
|
|
17
|
+
return nullifyResponse([404], []);
|
|
18
|
+
}
|
|
19
|
+
export function nullifyResponse(statuses, problemTypes) {
|
|
5
20
|
return function (source) {
|
|
6
21
|
return source.pipe(catchError((error) => {
|
|
7
|
-
|
|
8
|
-
|
|
22
|
+
const errorType = error.constructor;
|
|
23
|
+
if (error instanceof Problem &&
|
|
24
|
+
(statuses.includes(error.status) || problemTypes.includes(errorType))) {
|
|
25
|
+
return from([null]);
|
|
9
26
|
}
|
|
10
|
-
return
|
|
27
|
+
return throwError(error);
|
|
11
28
|
}));
|
|
12
29
|
};
|
|
13
30
|
}
|
package/dist/util/rxjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxjs.js","sourceRoot":"","sources":["../../src/util/rxjs.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"rxjs.js","sourceRoot":"","sources":["../../src/util/rxjs.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAc,UAAU,EAAE,MAAM,MAAM,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,UAAU,eAAe;IAG7B,OAAO,eAAe,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,QAAkB,EAClB,YAAkC;IAElC,OAAO,UAAa,MAAqB;QACvC,OAAO,MAAM,CAAC,IAAI,CAChB,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,SAAS,GAAG,KAAK,CAAC,WAAiC,CAAC;YAC1D,IACE,KAAK,YAAY,OAAO;gBACxB,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EACrE;gBACA,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;aACrB;YACD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/util/stream-rxjs.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
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.
|
|
1
14
|
import { Observable } from 'rxjs';
|
|
2
15
|
export function fromStream(stream) {
|
|
3
16
|
return new Observable((subscriber) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-rxjs.js","sourceRoot":"","sources":["../../src/util/stream-rxjs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,MAAM,UAAU,UAAU,CACxB,MAAkC;IAElC,OAAO,IAAI,UAAU,CAAC,CAAC,UAAU,EAAE,EAAE;QACnC,IAAI,MAA+C,CAAC;QACpD,CAAC,KAAK,UAAU,QAAQ;YACtB,IAAI;gBACF,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC5B,OAAO,IAAI,EAAE;oBACX,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;oBAC5C,IAAI,KAAK,KAAK,SAAS,EAAE;wBACvB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBACxB;oBAED,IAAI,IAAI,EAAE;wBACR,UAAU,CAAC,QAAQ,EAAE,CAAC;wBACtB,OAAO;qBACR;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"stream-rxjs.js","sourceRoot":"","sources":["../../src/util/stream-rxjs.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,MAAM,UAAU,UAAU,CACxB,MAAkC;IAElC,OAAO,IAAI,UAAU,CAAC,CAAC,UAAU,EAAE,EAAE;QACnC,IAAI,MAA+C,CAAC;QACpD,CAAC,KAAK,UAAU,QAAQ;YACtB,IAAI;gBACF,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC5B,OAAO,IAAI,EAAE;oBACX,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;oBAC5C,IAAI,KAAK,KAAK,SAAS,EAAE;wBACvB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;qBACxB;oBAED,IAAI,IAAI,EAAE;wBACR,UAAU,CAAC,QAAQ,EAAE,CAAC;wBACtB,OAAO;qBACR;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
export function secondsToNumber(seconds, nanos) {
|
|
15
|
+
if (nanos == 0) {
|
|
16
|
+
return seconds;
|
|
17
|
+
}
|
|
18
|
+
const nanoStr = nanos.toString();
|
|
19
|
+
return parseFloat(`${seconds}.${'0'.repeat(9 - nanoStr.length)}${nanos}`);
|
|
20
|
+
}
|
|
21
|
+
export function encodeSeconds(seconds, fraction) {
|
|
22
|
+
const result = [];
|
|
23
|
+
if (seconds != 0 || fraction != 0) {
|
|
24
|
+
result.push(seconds);
|
|
25
|
+
if (fraction != 0) {
|
|
26
|
+
result.push(fraction);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=temporal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal.js","sourceRoot":"","sources":["../../src/util/temporal.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,KAAa;IAC5D,IAAI,KAAK,IAAI,CAAC,EAAE;QACd,OAAO,OAAO,CAAC;KAChB;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,OAAO,UAAU,CAAC,GAAG,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,QAAgB;IAC7D,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,IAAI,OAAO,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE;QACjC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,QAAQ,IAAI,CAAC,EAAE;YACjB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvB;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|