@daffodil/core 0.38.6 → 0.39.2
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/bundles/daffodil-core-graphql.umd.js +24 -153
- package/bundles/daffodil-core-graphql.umd.js.map +1 -1
- package/bundles/daffodil-core-graphql.umd.min.js +1 -1
- package/bundles/daffodil-core-graphql.umd.min.js.map +1 -1
- package/bundles/daffodil-core-routing.umd.js +9 -90
- package/bundles/daffodil-core-routing.umd.js.map +1 -1
- package/bundles/daffodil-core-routing.umd.min.js +1 -1
- package/bundles/daffodil-core-routing.umd.min.js.map +1 -1
- package/bundles/daffodil-core-state.umd.js +23 -154
- package/bundles/daffodil-core-state.umd.js.map +1 -1
- package/bundles/daffodil-core-state.umd.min.js +1 -1
- package/bundles/daffodil-core-state.umd.min.js.map +1 -1
- package/bundles/daffodil-core-testing.umd.js +7 -68
- package/bundles/daffodil-core-testing.umd.js.map +1 -1
- package/bundles/daffodil-core-testing.umd.min.js +1 -1
- package/bundles/daffodil-core-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-core.umd.js +56 -389
- package/bundles/daffodil-core.umd.js.map +1 -1
- package/bundles/daffodil-core.umd.min.js +1 -1
- package/bundles/daffodil-core.umd.min.js.map +1 -1
- package/esm2015/address/address.js +2 -28
- package/esm2015/canonically-locateable/canonically-locateable.interface.js +2 -18
- package/esm2015/constructable/constructable.js +2 -6
- package/esm2015/daffodil-core.js +2 -7
- package/esm2015/errors/error-map.js +2 -11
- package/esm2015/errors/error.interface.js +2 -17
- package/esm2015/errors/inheritable-error.js +1 -14
- package/esm2015/errors/public_api.js +1 -6
- package/esm2015/graphql/apollo/cacheable-operations/cacheable-operations-link.interface.js +2 -16
- package/esm2015/graphql/apollo/public_api.js +1 -6
- package/esm2015/graphql/apollo/queued-apollo/queued-apollo.service.js +10 -59
- package/esm2015/graphql/daffodil-core-graphql.js +2 -7
- package/esm2015/graphql/fragments/build-fragment-definition.js +3 -18
- package/esm2015/graphql/fragments/build-fragment-name-spread.js +6 -44
- package/esm2015/graphql/fragments/public_api.js +1 -6
- package/esm2015/graphql/index.js +2 -7
- package/esm2015/graphql/public_api.js +3 -8
- package/esm2015/identifiable/identifiable.interface.js +2 -18
- package/esm2015/index.js +2 -7
- package/esm2015/locateable/locateable.interface.js +2 -18
- package/esm2015/operators/backoff.pipe.js +5 -20
- package/esm2015/operators/public_api.js +2 -7
- package/esm2015/orderable/orderable.js +2 -18
- package/esm2015/public_api.js +6 -11
- package/esm2015/routing/daffodil-core-routing.js +2 -7
- package/esm2015/routing/index.js +2 -7
- package/esm2015/routing/public_api.js +2 -7
- package/esm2015/routing/uri/normalizer.service.js +4 -21
- package/esm2015/routing/uri/public_api.js +2 -7
- package/esm2015/routing/uri/truncation/file-extension.js +2 -13
- package/esm2015/routing/uri/truncation/leading-path-segments.js +2 -12
- package/esm2015/routing/uri/truncation/leading-slash.js +2 -13
- package/esm2015/routing/uri/truncation/public_api.js +1 -6
- package/esm2015/routing/uri/truncation/query-fragment.js +3 -13
- package/esm2015/state/collection/paginable.js +2 -21
- package/esm2015/state/collection/public_api.js +3 -8
- package/esm2015/state/collection/sortable.js +10 -56
- package/esm2015/state/daffodil-core-state.js +2 -7
- package/esm2015/state/errors/public_api.js +1 -6
- package/esm2015/state/errors/state-error.interface.js +2 -17
- package/esm2015/state/errors/transform-error-to-state-error.js +1 -8
- package/esm2015/state/index.js +2 -7
- package/esm2015/state/operators/public_api.js +2 -7
- package/esm2015/state/operators/substream.pipe.js +13 -51
- package/esm2015/state/public_api.js +6 -11
- package/esm2015/state/reducers/create-meta.js +2 -20
- package/esm2015/state/reducers/public_api.js +1 -6
- package/esm2015/state/states/loading.js +2 -6
- package/esm2015/state/states/mutable-loading.js +2 -6
- package/esm2015/state/states/public_api.js +2 -6
- package/esm2015/state/states/state.enum.js +2 -55
- package/esm2015/state/states/stateable.interface.js +2 -17
- package/esm2015/state/store/facade.js +2 -18
- package/esm2015/storage/error/error.js +1 -15
- package/esm2015/storage/error/error.service.js +3 -32
- package/esm2015/storage/error/public_api.js +1 -6
- package/esm2015/storage/localstorage/localstorage.service.js +3 -21
- package/esm2015/storage/noopstorage/noopstorage.service.js +3 -24
- package/esm2015/storage/persistence.interface.js +3 -38
- package/esm2015/storage/public_api.js +3 -8
- package/esm2015/storage/server-error/public_api.js +1 -6
- package/esm2015/storage/server-error/server-error.js +1 -15
- package/esm2015/storage/server-error/server-error.service.js +4 -33
- package/esm2015/testing/address/factories/address.factory.js +2 -25
- package/esm2015/testing/angular/interfaces/in-memory-data-service.interface.js +2 -33
- package/esm2015/testing/angular/mocks/pipes/currency.js +2 -11
- package/esm2015/testing/daffodil-core-testing.js +2 -7
- package/esm2015/testing/factories/factory.interface.js +2 -24
- package/esm2015/testing/factories/factory.js +3 -32
- package/esm2015/testing/index.js +1 -6
- package/esm2015/testing/testing.module.js +1 -6
- package/esm2015/types/dict.type.js +2 -6
- package/esm2015/types/id.type.js +2 -6
- package/esm2015/types/public_api.js +2 -6
- package/esm2015/utils/array-to-dict.js +3 -24
- package/esm2015/utils/long-arithmetic.js +19 -45
- package/esm2015/utils/public_api.js +2 -7
- package/esm2015/utils/random-slice.js +4 -19
- package/esm2015/utils/random-subset.js +5 -17
- package/esm2015/utils/range.js +5 -21
- package/esm2015/utils/sample.js +2 -13
- package/esm2015/utils/shuffle.js +5 -23
- package/fesm2015/daffodil-core-graphql.js +18 -146
- package/fesm2015/daffodil-core-graphql.js.map +1 -1
- package/fesm2015/daffodil-core-routing.js +10 -95
- package/fesm2015/daffodil-core-routing.js.map +1 -1
- package/fesm2015/daffodil-core-state.js +23 -196
- package/fesm2015/daffodil-core-state.js.map +1 -1
- package/fesm2015/daffodil-core-testing.js +7 -79
- package/fesm2015/daffodil-core-testing.js.map +1 -1
- package/fesm2015/daffodil-core.js +53 -416
- package/fesm2015/daffodil-core.js.map +1 -1
- package/graphql/package.json +1 -1
- package/locateable/locateable.interface.d.ts +1 -0
- package/package.json +1 -1
- package/routing/package.json +1 -1
- package/state/package.json +1 -1
- package/testing/package.json +1 -1
- package/utils/long-arithmetic.d.ts +3 -0
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ɵɵdefineInjectable, Injectable, ɵɵinject, PLATFORM_ID, Inject, InjectionToken, inject } from '@angular/core';
|
|
2
2
|
import { isPlatformBrowser } from '@angular/common';
|
|
3
3
|
import { pipe, throwError, timer } from 'rxjs';
|
|
4
4
|
import { retryWhen, mergeMap } from 'rxjs/operators';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @fileoverview added by tsickle
|
|
8
|
-
* Generated from: utils/long-arithmetic.ts
|
|
9
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
10
|
-
*/
|
|
11
6
|
/**
|
|
12
7
|
* A helper function to get the number of decimal significant figures of a number.
|
|
13
8
|
* This function will fail if the given number has more than 16 significant figures or
|
|
14
9
|
* the value of the number is greater than 10^11
|
|
15
10
|
*
|
|
16
|
-
* @param
|
|
17
|
-
* @return {?}
|
|
11
|
+
* @param number
|
|
18
12
|
*/
|
|
19
13
|
function daffPrecision(number) {
|
|
20
|
-
/** @type {?} */
|
|
21
14
|
let p = 10000;
|
|
22
15
|
if (number === undefined || number === null) {
|
|
23
16
|
return p;
|
|
@@ -32,91 +25,67 @@ function daffPrecision(number) {
|
|
|
32
25
|
* This function only guarantees correct answers when the numbers given and the result are less than
|
|
33
26
|
* 16 significant figures and less than 10^11
|
|
34
27
|
*
|
|
35
|
-
* @param
|
|
36
|
-
* @return {?}
|
|
28
|
+
* @param numbers
|
|
37
29
|
*/
|
|
38
30
|
function daffAdd(...numbers) {
|
|
39
31
|
if (numbers.length < 2) {
|
|
40
32
|
throw new Error('Provide at least 2 numbers for daffAdd.');
|
|
41
33
|
}
|
|
42
|
-
/** @type {?} */
|
|
43
34
|
const precision = Math.max(...numbers.map(daffPrecision));
|
|
44
|
-
return numbers.reduce((
|
|
45
|
-
* @param {?} acc
|
|
46
|
-
* @param {?} number
|
|
47
|
-
* @return {?}
|
|
48
|
-
*/
|
|
49
|
-
(acc, number) => acc + Math.round(number * precision)), 0) / precision;
|
|
35
|
+
return numbers.reduce((acc, number) => acc + Math.round(number * precision), 0) / precision;
|
|
50
36
|
}
|
|
51
37
|
/**
|
|
52
38
|
* A function to subtract long numbers accurately with conversions and integer math.
|
|
53
39
|
* This function only guarantees correct answers when the numbers given and the result are each less than
|
|
54
40
|
* 16 significant figures and less than 10^11
|
|
55
41
|
*
|
|
56
|
-
* @param
|
|
57
|
-
* @return {?}
|
|
42
|
+
* @param numbers
|
|
58
43
|
*/
|
|
59
44
|
function daffSubtract(...numbers) {
|
|
60
45
|
if (numbers.length < 2) {
|
|
61
46
|
throw new Error('Provide at least 2 numbers for daffSubtract.');
|
|
62
47
|
}
|
|
63
|
-
/** @type {?} */
|
|
64
48
|
const precision = Math.max(...numbers.map(daffPrecision));
|
|
65
|
-
return numbers.slice(1).reduce((
|
|
66
|
-
* @param {?} acc
|
|
67
|
-
* @param {?} number
|
|
68
|
-
* @return {?}
|
|
69
|
-
*/
|
|
70
|
-
(acc, number) => acc - Math.round(number * precision)), Math.round(numbers[0] * precision)) / precision;
|
|
49
|
+
return numbers.slice(1).reduce((acc, number) => acc - Math.round(number * precision), Math.round(numbers[0] * precision)) / precision;
|
|
71
50
|
}
|
|
72
51
|
/**
|
|
73
52
|
* A function to multiply long numbers accurately with conversions and integer math.
|
|
74
53
|
* This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures
|
|
75
54
|
* and less than 10^11
|
|
76
55
|
*
|
|
77
|
-
* @param
|
|
78
|
-
* @return {?}
|
|
56
|
+
* @param numbers
|
|
79
57
|
*/
|
|
80
58
|
function daffMultiply(...numbers) {
|
|
81
59
|
if (numbers.length < 2) {
|
|
82
60
|
throw new Error('Provide at least 2 numbers for daffMultiply.');
|
|
83
61
|
}
|
|
84
|
-
/** @type {?} */
|
|
85
62
|
const precision = Math.max(...numbers.map(daffPrecision));
|
|
86
|
-
return numbers.reduce((
|
|
87
|
-
* @param {?} acc
|
|
88
|
-
* @param {?} number
|
|
89
|
-
* @return {?}
|
|
90
|
-
*/
|
|
91
|
-
(acc, number) => acc * Math.round(number * precision)), 1) / Math.pow(precision, numbers.length);
|
|
63
|
+
return numbers.reduce((acc, number) => acc * Math.round(number * precision), 1) / Math.pow(precision, numbers.length);
|
|
92
64
|
}
|
|
93
65
|
/**
|
|
94
66
|
* A function to divide long numbers accurately with conversions and integer math.
|
|
95
67
|
* This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures
|
|
96
68
|
* and less than 10^11
|
|
97
69
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
70
|
+
* Returns NaN when attempting to use NaN as an input.
|
|
71
|
+
* Returns NaN when attempting to divide by 0 or null.
|
|
72
|
+
*
|
|
73
|
+
* @param numbers
|
|
100
74
|
*/
|
|
101
75
|
function daffDivide(...numbers) {
|
|
102
76
|
if (numbers.length < 2) {
|
|
103
77
|
throw new Error('Provide at least 2 numbers for daffDivide.');
|
|
104
78
|
}
|
|
105
|
-
|
|
79
|
+
// TODO(griest024): use better condition after IE support is dropped
|
|
80
|
+
const illegalOperation = numbers.filter(isNaN).length > 0
|
|
81
|
+
|| numbers.slice(1).filter(n => n === 0 || n === null).length > 0;
|
|
82
|
+
if (illegalOperation) {
|
|
83
|
+
return NaN;
|
|
84
|
+
}
|
|
106
85
|
const precision = Math.max(...numbers.map(daffPrecision));
|
|
107
|
-
return numbers.slice(1).reduce((
|
|
108
|
-
* @param {?} acc
|
|
109
|
-
* @param {?} number
|
|
110
|
-
* @return {?}
|
|
111
|
-
*/
|
|
112
|
-
(acc, number) => acc / Math.round(number * precision)), Math.round(numbers[0] * precision)) * Math.pow(precision, numbers.length - 2);
|
|
86
|
+
return numbers.slice(1).reduce((acc, number) => acc / Math.round(number * precision), Math.round(numbers[0] * precision)) * Math.pow(precision, numbers.length - 2);
|
|
113
87
|
}
|
|
114
88
|
|
|
115
|
-
/**
|
|
116
|
-
* @fileoverview added by tsickle
|
|
117
|
-
* Generated from: utils/range.ts
|
|
118
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
119
|
-
*/
|
|
120
89
|
/**
|
|
121
90
|
* Range
|
|
122
91
|
*
|
|
@@ -124,102 +93,49 @@ function daffDivide(...numbers) {
|
|
|
124
93
|
* and returns an array filled with numbers from
|
|
125
94
|
* `start` to `end`.
|
|
126
95
|
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* @type {?}
|
|
131
|
-
*/
|
|
132
|
-
const range = (/**
|
|
133
|
-
* @param {?} start
|
|
134
|
-
* @param {?} end
|
|
135
|
-
* @return {?}
|
|
136
|
-
*/
|
|
137
|
-
(start, end) => Array.apply(null, Array(end - start + 1)).map((/**
|
|
138
|
-
* @param {?} val
|
|
139
|
-
* @param {?} index
|
|
140
|
-
* @return {?}
|
|
96
|
+
* @param start
|
|
97
|
+
* @param end
|
|
98
|
+
* @returns number
|
|
141
99
|
*/
|
|
142
|
-
(val, index) => index + start)
|
|
100
|
+
const range = (start, end) => Array.apply(null, Array(end - start + 1)).map((val, index) => index + start);
|
|
143
101
|
|
|
144
|
-
/**
|
|
145
|
-
* @fileoverview added by tsickle
|
|
146
|
-
* Generated from: utils/shuffle.ts
|
|
147
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
148
|
-
*/
|
|
149
102
|
/**
|
|
150
103
|
* Immutable Fisher-Yates Shuffle
|
|
151
104
|
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
|
|
152
|
-
* @type {?}
|
|
153
105
|
*/
|
|
154
|
-
const shuffle = (
|
|
155
|
-
* @template T
|
|
156
|
-
* @param {?} array
|
|
157
|
-
* @return {?}
|
|
158
|
-
*/
|
|
159
|
-
(array) => {
|
|
160
|
-
/** @type {?} */
|
|
106
|
+
const shuffle = (array) => {
|
|
161
107
|
const result = [];
|
|
162
|
-
array.forEach((
|
|
163
|
-
* @param {?} el
|
|
164
|
-
* @param {?} i
|
|
165
|
-
* @return {?}
|
|
166
|
-
*/
|
|
167
|
-
(el, i) => {
|
|
168
|
-
/** @type {?} */
|
|
108
|
+
array.forEach((el, i) => {
|
|
169
109
|
const s = Math.floor(Math.random() * i);
|
|
170
110
|
if (s !== i) {
|
|
171
111
|
result[i] = result[s];
|
|
172
112
|
}
|
|
173
113
|
result[s] = el;
|
|
174
|
-
})
|
|
114
|
+
});
|
|
175
115
|
return result;
|
|
176
|
-
}
|
|
116
|
+
};
|
|
177
117
|
|
|
178
|
-
/**
|
|
179
|
-
* @fileoverview added by tsickle
|
|
180
|
-
* Generated from: utils/random-subset.ts
|
|
181
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
182
|
-
*/
|
|
183
118
|
/**
|
|
184
119
|
* Returns a random subset of an array in a random order.
|
|
185
120
|
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* @type {?}
|
|
189
|
-
*/
|
|
190
|
-
const randomSubset = (/**
|
|
191
|
-
* @template T
|
|
192
|
-
* @param {?} array
|
|
193
|
-
* @param {?=} length
|
|
194
|
-
* @return {?}
|
|
121
|
+
* @param array
|
|
122
|
+
* @param length
|
|
195
123
|
*/
|
|
196
|
-
(array, length) => {
|
|
124
|
+
const randomSubset = (array, length) => {
|
|
197
125
|
if (length > array.length) {
|
|
198
126
|
throw new Error('Requested length is longer than array length.');
|
|
199
127
|
}
|
|
200
128
|
length = length ? length : Math.floor(Math.random() * array.length);
|
|
201
129
|
return shuffle(array).slice(0, length);
|
|
202
|
-
}
|
|
130
|
+
};
|
|
203
131
|
|
|
204
|
-
/**
|
|
205
|
-
* @fileoverview added by tsickle
|
|
206
|
-
* Generated from: utils/random-slice.ts
|
|
207
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
208
|
-
*/
|
|
209
132
|
/**
|
|
210
133
|
* Returns a random slice of an array.
|
|
211
134
|
* An optional length may be specified.
|
|
212
135
|
*
|
|
213
|
-
*
|
|
214
|
-
* @type {?}
|
|
136
|
+
* @param array
|
|
215
137
|
*/
|
|
216
|
-
const randomSlice = (
|
|
217
|
-
* @template T
|
|
218
|
-
* @param {?} array
|
|
219
|
-
* @param {?=} length
|
|
220
|
-
* @return {?}
|
|
221
|
-
*/
|
|
222
|
-
(array, length) => {
|
|
138
|
+
const randomSlice = (array, length) => {
|
|
223
139
|
if (array.length === 0) {
|
|
224
140
|
return [];
|
|
225
141
|
}
|
|
@@ -227,72 +143,26 @@ const randomSlice = (/**
|
|
|
227
143
|
if (length > array.length) {
|
|
228
144
|
throw new Error('Requested length is longer than array length.');
|
|
229
145
|
}
|
|
230
|
-
/** @type {?} */
|
|
231
146
|
const arrayLength = length || Math.floor(Math.random() * array.length);
|
|
232
|
-
/** @type {?} */
|
|
233
147
|
const start = Math.floor(Math.random() * (array.length - arrayLength));
|
|
234
|
-
/** @type {?} */
|
|
235
148
|
const end = start + arrayLength;
|
|
236
149
|
return array.slice(start, end);
|
|
237
|
-
}
|
|
150
|
+
};
|
|
238
151
|
|
|
239
|
-
/**
|
|
240
|
-
* @fileoverview added by tsickle
|
|
241
|
-
* Generated from: utils/array-to-dict.ts
|
|
242
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
243
|
-
*/
|
|
244
152
|
/**
|
|
245
153
|
* Converts an array into a dictionary.
|
|
246
154
|
* Dictionary values are keyed by the return of the specified getKey, or `'key'` by default.
|
|
247
|
-
* @type {?}
|
|
248
155
|
*/
|
|
249
|
-
const daffArrayToDict = (
|
|
250
|
-
* @template T
|
|
251
|
-
* @param {?} array
|
|
252
|
-
* @param {?=} getKey
|
|
253
|
-
* @return {?}
|
|
254
|
-
*/
|
|
255
|
-
(array, getKey = (/**
|
|
256
|
-
* @param {?} val
|
|
257
|
-
* @return {?}
|
|
258
|
-
*/
|
|
259
|
-
(val) => ((/** @type {?} */ (val))).key)) => array.reduce((/**
|
|
260
|
-
* @param {?} dict
|
|
261
|
-
* @param {?} val
|
|
262
|
-
* @return {?}
|
|
263
|
-
*/
|
|
264
|
-
(dict, val) => {
|
|
156
|
+
const daffArrayToDict = (array, getKey = (val) => val.key) => array.reduce((dict, val) => {
|
|
265
157
|
dict[getKey(val)] = val;
|
|
266
158
|
return dict;
|
|
267
|
-
}
|
|
159
|
+
}, {});
|
|
268
160
|
|
|
269
|
-
/**
|
|
270
|
-
* @fileoverview added by tsickle
|
|
271
|
-
* Generated from: utils/sample.ts
|
|
272
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
273
|
-
*/
|
|
274
161
|
/**
|
|
275
162
|
* Returns a random element of an array.
|
|
276
|
-
* @type {?}
|
|
277
|
-
*/
|
|
278
|
-
const sample = (/**
|
|
279
|
-
* @template T
|
|
280
|
-
* @param {?} array
|
|
281
|
-
* @return {?}
|
|
282
|
-
*/
|
|
283
|
-
(array) => randomSlice(array, 1)[0]);
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* @fileoverview added by tsickle
|
|
287
|
-
* Generated from: utils/public_api.ts
|
|
288
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
289
163
|
*/
|
|
164
|
+
const sample = (array) => randomSlice(array, 1)[0];
|
|
290
165
|
|
|
291
|
-
/**
|
|
292
|
-
* @fileoverview added by tsickle
|
|
293
|
-
* Generated from: errors/inheritable-error.ts
|
|
294
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
295
|
-
*/
|
|
296
166
|
/**
|
|
297
167
|
* A class which allows you to appropriately check the inheritance of an error.
|
|
298
168
|
*
|
|
@@ -311,215 +181,95 @@ const sample = (/**
|
|
|
311
181
|
* https://github.com/microsoft/TypeScript/issues/13965
|
|
312
182
|
*/
|
|
313
183
|
class DaffInheritableError extends Error {
|
|
314
|
-
/**
|
|
315
|
-
* @param {?=} message
|
|
316
|
-
*/
|
|
317
184
|
constructor(message) {
|
|
318
|
-
/** @type {?} */
|
|
319
185
|
const trueProto = new.target.prototype;
|
|
320
186
|
super(message);
|
|
321
187
|
Object.setPrototypeOf(this, trueProto);
|
|
322
188
|
}
|
|
323
189
|
}
|
|
324
|
-
if (false) {
|
|
325
|
-
/** @type {?} */
|
|
326
|
-
DaffInheritableError.prototype.__proto__;
|
|
327
|
-
}
|
|
328
190
|
|
|
329
|
-
/**
|
|
330
|
-
* @fileoverview added by tsickle
|
|
331
|
-
* Generated from: errors/public_api.ts
|
|
332
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
333
|
-
*/
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* @fileoverview added by tsickle
|
|
337
|
-
* Generated from: storage/error/error.ts
|
|
338
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
339
|
-
*/
|
|
340
191
|
class DaffStorageServiceError extends DaffInheritableError {
|
|
341
|
-
/**
|
|
342
|
-
* @param {?} message
|
|
343
|
-
*/
|
|
344
192
|
constructor(message) {
|
|
345
193
|
super(message);
|
|
346
194
|
this.message = message;
|
|
347
195
|
this.code = 'DAFF_STORAGE_FAILURE';
|
|
348
196
|
}
|
|
349
197
|
}
|
|
350
|
-
if (false) {
|
|
351
|
-
/** @type {?} */
|
|
352
|
-
DaffStorageServiceError.prototype.code;
|
|
353
|
-
/** @type {?} */
|
|
354
|
-
DaffStorageServiceError.prototype.message;
|
|
355
|
-
}
|
|
356
198
|
|
|
357
199
|
/**
|
|
358
|
-
* @
|
|
359
|
-
* Generated from: storage/error/error.service.ts
|
|
360
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
361
|
-
*/
|
|
362
|
-
/**
|
|
363
|
-
* \@inheritdoc
|
|
200
|
+
* @inheritdoc
|
|
364
201
|
*/
|
|
365
202
|
class DaffErrorStorageService {
|
|
366
|
-
/**
|
|
367
|
-
* @param {?} key
|
|
368
|
-
* @param {?} value
|
|
369
|
-
* @return {?}
|
|
370
|
-
*/
|
|
371
203
|
setItem(key, value) {
|
|
372
204
|
this.throwError();
|
|
373
205
|
}
|
|
374
|
-
/**
|
|
375
|
-
* @param {?} key
|
|
376
|
-
* @return {?}
|
|
377
|
-
*/
|
|
378
206
|
getItem(key) {
|
|
379
207
|
this.throwError();
|
|
380
208
|
}
|
|
381
|
-
/**
|
|
382
|
-
* @param {?} key
|
|
383
|
-
* @return {?}
|
|
384
|
-
*/
|
|
385
209
|
removeItem(key) {
|
|
386
210
|
this.throwError();
|
|
387
211
|
}
|
|
388
|
-
/**
|
|
389
|
-
* @return {?}
|
|
390
|
-
*/
|
|
391
212
|
clear() {
|
|
392
213
|
this.throwError();
|
|
393
214
|
}
|
|
394
|
-
/**
|
|
395
|
-
* @private
|
|
396
|
-
* @return {?}
|
|
397
|
-
*/
|
|
398
215
|
throwError() {
|
|
399
216
|
throw new DaffStorageServiceError(DaffErrorStorageService.ERROR_MESSAGE);
|
|
400
217
|
}
|
|
401
218
|
}
|
|
402
219
|
DaffErrorStorageService.ERROR_MESSAGE = 'The DaffErrorStorageService always throws an error.';
|
|
220
|
+
/** @nocollapse */ DaffErrorStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffErrorStorageService_Factory() { return new DaffErrorStorageService(); }, token: DaffErrorStorageService, providedIn: "root" });
|
|
403
221
|
DaffErrorStorageService.decorators = [
|
|
404
222
|
{ type: Injectable, args: [{
|
|
405
223
|
providedIn: 'root',
|
|
406
224
|
},] }
|
|
407
225
|
];
|
|
408
|
-
/** @nocollapse */ DaffErrorStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffErrorStorageService_Factory() { return new DaffErrorStorageService(); }, token: DaffErrorStorageService, providedIn: "root" });
|
|
409
|
-
if (false) {
|
|
410
|
-
/** @type {?} */
|
|
411
|
-
DaffErrorStorageService.ERROR_MESSAGE;
|
|
412
|
-
}
|
|
413
226
|
|
|
414
|
-
/**
|
|
415
|
-
* @fileoverview added by tsickle
|
|
416
|
-
* Generated from: storage/error/public_api.ts
|
|
417
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
418
|
-
*/
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* @fileoverview added by tsickle
|
|
422
|
-
* Generated from: storage/server-error/server-error.ts
|
|
423
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
424
|
-
*/
|
|
425
227
|
/**
|
|
426
228
|
* An error thrown when there is an attempt to access storage on the server and none is available.
|
|
427
229
|
*/
|
|
428
230
|
class DaffServerSideStorageError extends DaffStorageServiceError {
|
|
429
|
-
/**
|
|
430
|
-
* @param {?} message
|
|
431
|
-
*/
|
|
432
231
|
constructor(message) {
|
|
433
232
|
super(message);
|
|
434
233
|
this.message = message;
|
|
435
234
|
this.code = 'DAFF_SERVER_STORAGE_FAILURE';
|
|
436
235
|
}
|
|
437
236
|
}
|
|
438
|
-
if (false) {
|
|
439
|
-
/** @type {?} */
|
|
440
|
-
DaffServerSideStorageError.prototype.code;
|
|
441
|
-
/** @type {?} */
|
|
442
|
-
DaffServerSideStorageError.prototype.message;
|
|
443
|
-
}
|
|
444
237
|
|
|
445
|
-
/**
|
|
446
|
-
* @fileoverview added by tsickle
|
|
447
|
-
* Generated from: storage/server-error/server-error.service.ts
|
|
448
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
449
|
-
*/
|
|
450
238
|
/**
|
|
451
239
|
* A storage service meant to be loaded into SSR contexts.
|
|
452
|
-
* It will always throw the {
|
|
240
|
+
* It will always throw the {@link DaffServerSideStorageError}.
|
|
453
241
|
*
|
|
454
|
-
*
|
|
242
|
+
* @inheritdoc
|
|
455
243
|
*/
|
|
456
244
|
class DaffServerErrorStorageService {
|
|
457
|
-
/**
|
|
458
|
-
* @param {?} key
|
|
459
|
-
* @param {?} value
|
|
460
|
-
* @return {?}
|
|
461
|
-
*/
|
|
462
245
|
setItem(key, value) {
|
|
463
246
|
this.throwError();
|
|
464
247
|
}
|
|
465
|
-
/**
|
|
466
|
-
* @param {?} key
|
|
467
|
-
* @return {?}
|
|
468
|
-
*/
|
|
469
248
|
getItem(key) {
|
|
470
249
|
this.throwError();
|
|
471
250
|
}
|
|
472
|
-
/**
|
|
473
|
-
* @param {?} key
|
|
474
|
-
* @return {?}
|
|
475
|
-
*/
|
|
476
251
|
removeItem(key) {
|
|
477
252
|
this.throwError();
|
|
478
253
|
}
|
|
479
|
-
/**
|
|
480
|
-
* @return {?}
|
|
481
|
-
*/
|
|
482
254
|
clear() {
|
|
483
255
|
this.throwError();
|
|
484
256
|
}
|
|
485
|
-
/**
|
|
486
|
-
* @private
|
|
487
|
-
* @return {?}
|
|
488
|
-
*/
|
|
489
257
|
throwError() {
|
|
490
258
|
throw new DaffServerSideStorageError(DaffServerErrorStorageService.ERROR_MESSAGE);
|
|
491
259
|
}
|
|
492
260
|
}
|
|
493
261
|
DaffServerErrorStorageService.ERROR_MESSAGE = 'The DaffServerErrorStorageService always throws an error.';
|
|
262
|
+
/** @nocollapse */ DaffServerErrorStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffServerErrorStorageService_Factory() { return new DaffServerErrorStorageService(); }, token: DaffServerErrorStorageService, providedIn: "root" });
|
|
494
263
|
DaffServerErrorStorageService.decorators = [
|
|
495
264
|
{ type: Injectable, args: [{
|
|
496
265
|
providedIn: 'root',
|
|
497
266
|
},] }
|
|
498
267
|
];
|
|
499
|
-
/** @nocollapse */ DaffServerErrorStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffServerErrorStorageService_Factory() { return new DaffServerErrorStorageService(); }, token: DaffServerErrorStorageService, providedIn: "root" });
|
|
500
|
-
if (false) {
|
|
501
|
-
/** @type {?} */
|
|
502
|
-
DaffServerErrorStorageService.ERROR_MESSAGE;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* @fileoverview added by tsickle
|
|
507
|
-
* Generated from: storage/server-error/public_api.ts
|
|
508
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
509
|
-
*/
|
|
510
268
|
|
|
511
269
|
/**
|
|
512
|
-
* @
|
|
513
|
-
* Generated from: storage/localstorage/localstorage.service.ts
|
|
514
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
515
|
-
*/
|
|
516
|
-
/**
|
|
517
|
-
* \@inheritdoc
|
|
270
|
+
* @inheritdoc
|
|
518
271
|
*/
|
|
519
272
|
class DaffLocalStorageService {
|
|
520
|
-
/**
|
|
521
|
-
* @param {?} platformId
|
|
522
|
-
*/
|
|
523
273
|
constructor(platformId) {
|
|
524
274
|
if (!isPlatformBrowser(platformId)) {
|
|
525
275
|
throw new Error('The DaffLocalStorageService can only be instantiated in the browser.');
|
|
@@ -527,36 +277,27 @@ class DaffLocalStorageService {
|
|
|
527
277
|
}
|
|
528
278
|
/**
|
|
529
279
|
* Persist the given item into local storage.
|
|
530
|
-
* @param {?} key
|
|
531
|
-
* @param {?} value
|
|
532
|
-
* @return {?}
|
|
533
280
|
*/
|
|
534
281
|
setItem(key, value) {
|
|
535
282
|
localStorage.setItem(key, value);
|
|
536
283
|
}
|
|
537
284
|
/**
|
|
538
285
|
* Retrieve the given item from localstorage.
|
|
539
|
-
* @param {?} key
|
|
540
|
-
* @return {?}
|
|
541
286
|
*/
|
|
542
287
|
getItem(key) {
|
|
543
288
|
return localStorage.getItem(key);
|
|
544
289
|
}
|
|
545
290
|
/**
|
|
546
291
|
* Remove a given item from localstorage
|
|
547
|
-
* @param {?} key
|
|
548
|
-
* @return {?}
|
|
549
292
|
*/
|
|
550
293
|
removeItem(key) {
|
|
551
294
|
localStorage.removeItem(key);
|
|
552
295
|
}
|
|
553
|
-
/**
|
|
554
|
-
* @return {?}
|
|
555
|
-
*/
|
|
556
296
|
clear() {
|
|
557
297
|
localStorage.clear();
|
|
558
298
|
}
|
|
559
299
|
}
|
|
300
|
+
/** @nocollapse */ DaffLocalStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffLocalStorageService_Factory() { return new DaffLocalStorageService(ɵɵinject(PLATFORM_ID)); }, token: DaffLocalStorageService, providedIn: "root" });
|
|
560
301
|
DaffLocalStorageService.decorators = [
|
|
561
302
|
{ type: Injectable, args: [{
|
|
562
303
|
providedIn: 'root',
|
|
@@ -566,155 +307,51 @@ DaffLocalStorageService.decorators = [
|
|
|
566
307
|
DaffLocalStorageService.ctorParameters = () => [
|
|
567
308
|
{ type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
|
|
568
309
|
];
|
|
569
|
-
/** @nocollapse */ DaffLocalStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffLocalStorageService_Factory() { return new DaffLocalStorageService(ɵɵinject(PLATFORM_ID)); }, token: DaffLocalStorageService, providedIn: "root" });
|
|
570
310
|
|
|
571
311
|
/**
|
|
572
|
-
* @
|
|
573
|
-
* Generated from: storage/noopstorage/noopstorage.service.ts
|
|
574
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
575
|
-
*/
|
|
576
|
-
/**
|
|
577
|
-
* \@inheritdoc
|
|
312
|
+
* @inheritdoc
|
|
578
313
|
*/
|
|
579
314
|
class DaffNoopStorageService {
|
|
580
|
-
/**
|
|
581
|
-
* @param {?} key
|
|
582
|
-
* @param {?} value
|
|
583
|
-
* @return {?}
|
|
584
|
-
*/
|
|
585
315
|
setItem(key, value) { }
|
|
586
316
|
;
|
|
587
|
-
/**
|
|
588
|
-
* @param {?} key
|
|
589
|
-
* @return {?}
|
|
590
|
-
*/
|
|
591
317
|
getItem(key) { }
|
|
592
318
|
;
|
|
593
|
-
/**
|
|
594
|
-
* @return {?}
|
|
595
|
-
*/
|
|
596
319
|
clear() { }
|
|
597
320
|
;
|
|
598
|
-
/**
|
|
599
|
-
* @param {?} key
|
|
600
|
-
* @return {?}
|
|
601
|
-
*/
|
|
602
321
|
removeItem(key) { }
|
|
603
322
|
;
|
|
604
323
|
}
|
|
324
|
+
/** @nocollapse */ DaffNoopStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffNoopStorageService_Factory() { return new DaffNoopStorageService(); }, token: DaffNoopStorageService, providedIn: "root" });
|
|
605
325
|
DaffNoopStorageService.decorators = [
|
|
606
326
|
{ type: Injectable, args: [{
|
|
607
327
|
providedIn: 'root',
|
|
608
328
|
},] }
|
|
609
329
|
];
|
|
610
|
-
/** @nocollapse */ DaffNoopStorageService.ɵprov = ɵɵdefineInjectable({ factory: function DaffNoopStorageService_Factory() { return new DaffNoopStorageService(); }, token: DaffNoopStorageService, providedIn: "root" });
|
|
611
330
|
|
|
612
|
-
/**
|
|
613
|
-
* @fileoverview added by tsickle
|
|
614
|
-
* Generated from: storage/persistence.interface.ts
|
|
615
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
616
|
-
*/
|
|
617
|
-
/**
|
|
618
|
-
* @record
|
|
619
|
-
*/
|
|
620
|
-
function DaffPersistenceService() { }
|
|
621
|
-
if (false) {
|
|
622
|
-
/**
|
|
623
|
-
* @param {?} key
|
|
624
|
-
* @param {?} value
|
|
625
|
-
* @return {?}
|
|
626
|
-
*/
|
|
627
|
-
DaffPersistenceService.prototype.setItem = function (key, value) { };
|
|
628
|
-
/**
|
|
629
|
-
* @param {?} key
|
|
630
|
-
* @return {?}
|
|
631
|
-
*/
|
|
632
|
-
DaffPersistenceService.prototype.getItem = function (key) { };
|
|
633
|
-
/**
|
|
634
|
-
* @return {?}
|
|
635
|
-
*/
|
|
636
|
-
DaffPersistenceService.prototype.clear = function () { };
|
|
637
|
-
/**
|
|
638
|
-
* @param {?} key
|
|
639
|
-
* @return {?}
|
|
640
|
-
*/
|
|
641
|
-
DaffPersistenceService.prototype.removeItem = function (key) { };
|
|
642
|
-
}
|
|
643
|
-
/** @type {?} */
|
|
644
331
|
const DaffPersistenceServiceToken = new InjectionToken('DaffPersistenceService', {
|
|
645
332
|
providedIn: 'root',
|
|
646
|
-
factory: (
|
|
647
|
-
* @return {?}
|
|
648
|
-
*/
|
|
649
|
-
() => isPlatformBrowser(inject(PLATFORM_ID))
|
|
333
|
+
factory: () => isPlatformBrowser(inject(PLATFORM_ID))
|
|
650
334
|
? new DaffLocalStorageService(inject(PLATFORM_ID))
|
|
651
|
-
: new DaffServerErrorStorageService()
|
|
335
|
+
: new DaffServerErrorStorageService(),
|
|
652
336
|
});
|
|
653
337
|
|
|
654
|
-
/**
|
|
655
|
-
* @fileoverview added by tsickle
|
|
656
|
-
* Generated from: storage/public_api.ts
|
|
657
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
658
|
-
*/
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* @fileoverview added by tsickle
|
|
662
|
-
* Generated from: operators/backoff.pipe.ts
|
|
663
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
664
|
-
*/
|
|
665
338
|
/**
|
|
666
339
|
* Retries failed Observables
|
|
667
340
|
*
|
|
668
|
-
* @param
|
|
669
|
-
* @param
|
|
670
|
-
* @return {?}
|
|
341
|
+
* @param maxTries The maximum number of tries the observable will be tried
|
|
342
|
+
* @param ms The initial amount of time
|
|
671
343
|
*/
|
|
672
344
|
function backoff(maxTries, ms) {
|
|
673
|
-
return pipe(retryWhen((
|
|
674
|
-
* @param {?} attempt
|
|
675
|
-
* @return {?}
|
|
676
|
-
*/
|
|
677
|
-
attempt => attempt.pipe(mergeMap((/**
|
|
678
|
-
* @param {?} shadowedAttempt
|
|
679
|
-
* @param {?} i
|
|
680
|
-
* @return {?}
|
|
681
|
-
*/
|
|
682
|
-
(shadowedAttempt, i) => {
|
|
345
|
+
return pipe(retryWhen(attempt => attempt.pipe(mergeMap((shadowedAttempt, i) => {
|
|
683
346
|
if (i >= maxTries) {
|
|
684
347
|
return throwError(shadowedAttempt);
|
|
685
348
|
}
|
|
686
349
|
return timer(ms * Math.pow(2, i));
|
|
687
|
-
}))))
|
|
350
|
+
}))));
|
|
688
351
|
}
|
|
689
352
|
|
|
690
353
|
/**
|
|
691
|
-
*
|
|
692
|
-
* Generated from: operators/public_api.ts
|
|
693
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
694
|
-
*/
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* @fileoverview added by tsickle
|
|
698
|
-
* Generated from: types/public_api.ts
|
|
699
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
700
|
-
*/
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* @fileoverview added by tsickle
|
|
704
|
-
* Generated from: public_api.ts
|
|
705
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
706
|
-
*/
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* @fileoverview added by tsickle
|
|
710
|
-
* Generated from: index.ts
|
|
711
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
712
|
-
*/
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* @fileoverview added by tsickle
|
|
716
|
-
* Generated from: daffodil-core.ts
|
|
717
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
354
|
+
* Generated bundle index. Do not edit.
|
|
718
355
|
*/
|
|
719
356
|
|
|
720
357
|
export { DaffErrorStorageService, DaffInheritableError, DaffLocalStorageService, DaffNoopStorageService, DaffPersistenceServiceToken, DaffServerErrorStorageService, DaffServerSideStorageError, DaffStorageServiceError, backoff, daffAdd, daffArrayToDict, daffDivide, daffMultiply, daffSubtract, randomSlice, randomSubset, range, sample, shuffle };
|