@daffodil/core 0.39.10 → 0.39.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/base64/base64.interface.d.ts +18 -0
- package/base64/browser/browser.service.d.ts +9 -0
- package/base64/public_api.d.ts +3 -0
- package/base64/server/public_api.d.ts +1 -0
- package/base64/server/server.service.d.ts +11 -0
- package/bundles/daffodil-core-state.umd.js +2 -2
- 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.umd.js +79 -2
- package/bundles/daffodil-core.umd.js.map +1 -1
- package/bundles/daffodil-core.umd.min.js +2 -2
- package/bundles/daffodil-core.umd.min.js.map +1 -1
- package/daffodil-core.metadata.json +1 -1
- package/errors/error-map.d.ts +3 -2
- package/errors/error.interface.d.ts +10 -0
- package/errors/inheritable-error.d.ts +1 -0
- package/errors/is-error.d.ts +4 -0
- package/errors/public_api.d.ts +1 -0
- package/esm2015/base64/base64.interface.js +14 -0
- package/esm2015/base64/browser/browser.service.js +30 -0
- package/esm2015/base64/public_api.js +4 -0
- package/esm2015/base64/server/public_api.js +2 -0
- package/esm2015/base64/server/server.service.js +32 -0
- package/esm2015/errors/error-map.js +1 -1
- package/esm2015/errors/error.interface.js +1 -1
- package/esm2015/errors/inheritable-error.js +3 -2
- package/esm2015/errors/is-error.js +6 -0
- package/esm2015/errors/public_api.js +2 -1
- package/esm2015/public_api.js +2 -1
- package/esm2015/state/errors/state-error.interface.js +1 -1
- package/esm2015/state/errors/transform-error-to-state-error.js +3 -3
- package/fesm2015/daffodil-core-state.js +2 -2
- package/fesm2015/daffodil-core-state.js.map +1 -1
- package/fesm2015/daffodil-core.js +74 -2
- package/fesm2015/daffodil-core.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -0
- package/state/daffodil-core-state.metadata.json +1 -1
- package/state/errors/state-error.interface.d.ts +11 -0
- package/state/errors/transform-error-to-state-error.d.ts +1 -1
package/errors/public_api.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import { InjectionToken, inject, PLATFORM_ID, } from '@angular/core';
|
|
3
|
+
import { DaffBrowserBase64Service } from './browser/browser.service';
|
|
4
|
+
import { DaffServerBase64Service } from './server/public_api';
|
|
5
|
+
/**
|
|
6
|
+
* A token which creates a base64 service appropriate for the current environment, i.e., browser vs. server.
|
|
7
|
+
*/
|
|
8
|
+
export const DaffBase64ServiceToken = new InjectionToken('DaffBase64Service', {
|
|
9
|
+
providedIn: 'root',
|
|
10
|
+
factory: () => isPlatformBrowser(inject(PLATFORM_ID))
|
|
11
|
+
? new DaffBrowserBase64Service(inject(PLATFORM_ID))
|
|
12
|
+
: new DaffServerBase64Service(inject(PLATFORM_ID)),
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZTY0LmludGVyZmFjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvYmFzZTY0L2Jhc2U2NC5pbnRlcmZhY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDcEQsT0FBTyxFQUNMLGNBQWMsRUFDZCxNQUFNLEVBQ04sV0FBVyxHQUNaLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3JFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBZ0I5RDs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLHNCQUFzQixHQUFHLElBQUksY0F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RyOiBzdHJpbmcpOiBzdHJpbmc7XG59XG5cbi8qKlxuICogQSB0b2tlbiB3aGljaCBjcmVhdGVzIGEgYmFzZTY0IHNlcnZpY2UgYXBwcm9wcmlhdGUgZm9yIHRoZSBjdXJyZW50IGVudmlyb25tZW50LCBpLmUuLCBicm93c2VyIHZzLiBzZXJ2ZXIuXG4gKi9cbmV4cG9ydCBjb25zdCBEYWZmQmFzZTY0U2VydmljZVRva2VuID0gbmV3IEluamVjdGlvblRva2VuPERhZmZCYXNlNjRTZXJ2aWNlPignRGFmZkJhc2U2NFNlcnZpY2UnLCB7XG4gIHByb3ZpZGVkSW46ICdyb290JyxcbiAgZmFjdG9yeTogKCkgPT4gaXNQbGF0Zm9ybUJyb3dzZXIoaW5qZWN0PHN0cmluZz4oUExBVEZPUk1fSUQpKVxuICAgID8gbmV3IERhZmZCcm93c2VyQmFzZTY0U2VydmljZShpbmplY3Q8c3RyaW5nPihQTEFURk9STV9JRCkpXG4gICAgOiBuZXcgRGFmZlNlcnZlckJhc2U2NFNlcnZpY2UoaW5qZWN0PHN0cmluZz4oUExBVEZPUk1fSUQpKSxcbn0pO1xuIl19
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import { Injectable, Inject, PLATFORM_ID, } from '@angular/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* @inheritdoc
|
|
6
|
+
*/
|
|
7
|
+
export class DaffBrowserBase64Service {
|
|
8
|
+
constructor(platformId) {
|
|
9
|
+
if (!isPlatformBrowser(platformId)) {
|
|
10
|
+
throw new Error('The DaffBrowserBase64Service can only be instantiated in the browser.');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
encode(str) {
|
|
14
|
+
return btoa(str);
|
|
15
|
+
}
|
|
16
|
+
decode(str) {
|
|
17
|
+
return atob(str);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** @nocollapse */ DaffBrowserBase64Service.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffBrowserBase64Service_Factory() { return new DaffBrowserBase64Service(i0.ɵɵinject(i0.PLATFORM_ID)); }, token: DaffBrowserBase64Service, providedIn: "root" });
|
|
21
|
+
DaffBrowserBase64Service.decorators = [
|
|
22
|
+
{ type: Injectable, args: [{
|
|
23
|
+
providedIn: 'root',
|
|
24
|
+
},] }
|
|
25
|
+
];
|
|
26
|
+
/** @nocollapse */
|
|
27
|
+
DaffBrowserBase64Service.ctorParameters = () => [
|
|
28
|
+
{ type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
|
|
29
|
+
];
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnJvd3Nlci5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3NyYy9iYXNlNjQvYnJvd3Nlci9icm93c2VyLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDcEQsT0FBTyxFQUNMLFVBQVUsRUFDVixNQUFNLEVBQ04sV0FBVyxHQUNaLE1BQU0sZUFBZSxDQUFDOztBQUl2Qjs7R0FFRztBQUlILE1BQU0sT0FBTyx3QkFBd0I7SUFDbkMsWUFBaUMsVUFBa0I7UUFDakQsSUFBRyxDQUFDLGlCQUFpQixDQUFDLFVBQVUsQ0FBQyxFQUFDO1lBQ2hDLE1BQU0sSUFBSSxLQUFLLENBQUMsdUVBQXVFLENBQUMsQ0FBQztTQUMxRjtJQUNILENBQUM7SUFFRCxNQUFNLENBQUMsR0FBVztRQUNoQixPQUFPLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUNuQixDQUFDO0lBRUQsTUFBTSxDQUFDLEdBQVc7UUFDaEIsT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|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './server/public_api';
|
|
2
|
+
export { DaffBrowserBase64Service } from './browser/browser.service';
|
|
3
|
+
export { DaffBase64ServiceToken, } from './base64.interface';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvYmFzZTY0L3B1YmxpY19hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxPQUFPLEVBQUUsd0JBQXdCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNyRSxPQUFPLEVBRUwsc0JBQXNCLEdBQ3ZCLE1BQU0sb0JBQW9CLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3NlcnZlci9wdWJsaWNfYXBpJztcbmV4cG9ydCB7IERhZmZCcm93c2VyQmFzZTY0U2VydmljZSB9IGZyb20gJy4vYnJvd3Nlci9icm93c2VyLnNlcnZpY2UnO1xuZXhwb3J0IHtcbiAgRGFmZkJhc2U2NFNlcnZpY2UsXG4gIERhZmZCYXNlNjRTZXJ2aWNlVG9rZW4sXG59IGZyb20gJy4vYmFzZTY0LmludGVyZmFjZSc7XG4iXX0=
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { DaffServerBase64Service } from './server.service';
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvYmFzZTY0L3NlcnZlci9wdWJsaWNfYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxNQUFNLGtCQUFrQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgRGFmZlNlcnZlckJhc2U2NFNlcnZpY2UgfSBmcm9tICcuL3NlcnZlci5zZXJ2aWNlJztcbiJdfQ==
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import { Inject, Injectable, PLATFORM_ID, } from '@angular/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* A base64 service meant to be loaded into SSR contexts.
|
|
6
|
+
*
|
|
7
|
+
* @inheritdoc
|
|
8
|
+
*/
|
|
9
|
+
export class DaffServerBase64Service {
|
|
10
|
+
constructor(platformId) {
|
|
11
|
+
if (isPlatformBrowser(platformId)) {
|
|
12
|
+
throw new Error('The DaffBrowserBase64Service can only be instantiated on the server.');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
encode(str) {
|
|
16
|
+
return Buffer.from(str).toString('base64');
|
|
17
|
+
}
|
|
18
|
+
decode(str) {
|
|
19
|
+
return Buffer.from(str, 'base64').toString('ascii');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** @nocollapse */ DaffServerBase64Service.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffServerBase64Service_Factory() { return new DaffServerBase64Service(i0.ɵɵinject(i0.PLATFORM_ID)); }, token: DaffServerBase64Service, providedIn: "root" });
|
|
23
|
+
DaffServerBase64Service.decorators = [
|
|
24
|
+
{ type: Injectable, args: [{
|
|
25
|
+
providedIn: 'root',
|
|
26
|
+
},] }
|
|
27
|
+
];
|
|
28
|
+
/** @nocollapse */
|
|
29
|
+
DaffServerBase64Service.ctorParameters = () => [
|
|
30
|
+
{ type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
|
|
31
|
+
];
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJ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L=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3ItbWFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGlicy9jb3JlL3NyYy9lcnJvcnMvZXJyb3ItbWFwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb25zdHJ1Y3RhYmxlIH0gZnJvbSAnLi4vY29uc3RydWN0YWJsZS9jb25zdHJ1Y3RhYmxlJztcbmltcG9ydCB7IERhZmZFcnJvciB9IGZyb20gJy4vZXJyb3IuaW50ZXJmYWNlJztcblxuLyoqXG4gKiBBIHR5cGUgZm9yIGEgZGljdGlvbmFyeSBvZiBlcnJvciBjb2RlcyB0byBEYWZmb2RpbCBlcnJvcnMuXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgRGFmZkVycm9yQ29kZU1hcCB7XG5cdFt4OiBzdHJpbmddOiBDb25zdHJ1Y3RhYmxlPERhZmZFcnJvcj47XG59XG4iXX0=
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3IuaW50ZXJmYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGlicy9jb3JlL3NyYy9lcnJvcnMvZXJyb3IuaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEFuIGVycm9yIG9iamVjdCBjb250YWluaW5nIGluZm8gYWJvdXQgdGhlIGV4Y2VwdGlvbiB0aGF0IGdlbmVyYXRlZCBpdC5cbiAqL1xuZXhwb3J0IGludGVyZmFjZSBEYWZmRXJyb3IgZXh0ZW5kcyBFcnJvciB7XG4gIC8qKlxuICAgKiBBIHN0cmluZyB0aGF0IHVuaXF1ZWx5IGlkZW50aWZpZXMgdGhlIGVycm9yLlxuICAgKi9cbiAgY29kZTogc3RyaW5nO1xuICAvKipcbiAgICogQ29udGFpbnMgYWRkaXRpb25hbCByZWxldmFudCBpbmZvcm1hdGlvbiB0byB0aGUgY2F1c2UgYW5kL29yIHNvbHV0aW9uIG9mIHRoZSBlcnJvci5cbiAgICovXG4gIG1lc3NhZ2U6IHN0cmluZztcbiAgLyoqXG4gICAqIFdoZXRoZXIgdGhlIGVycm9yIGlzIG5vbi1jcml0aWNhbCBhbmQgcmVjb3ZlcmFibGUgb3IgY2F0YXN0cm9waGljIGFuZCB1bnJlY292ZXJhYmxlLlxuICAgKi9cbiAgcmVjb3ZlcmFibGU6IGJvb2xlYW47XG59XG4iXX0=
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
*/
|
|
18
18
|
export class DaffInheritableError extends Error {
|
|
19
19
|
constructor(message) {
|
|
20
|
-
const trueProto = new.target.prototype;
|
|
21
20
|
super(message);
|
|
21
|
+
this.recoverable = false;
|
|
22
|
+
const trueProto = new.target.prototype;
|
|
22
23
|
Object.setPrototypeOf(this, trueProto);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5oZXJpdGFibGUtZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2NvcmUvc3JjL2Vycm9ycy9pbmhlcml0YWJsZS1lcnJvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7OztHQWdCRztBQUNILE1BQU0sT0FBTyxvQkFBcUIsU0FBUSxLQUFLO0lBSzdDLFlBQVksT0FBZ0I7UUFDM0IsS0F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cnVjdG9yKG1lc3NhZ2U/OiBzdHJpbmcpIHtcblx0ICBzdXBlcihtZXNzYWdlKTtcblx0ICBjb25zdCB0cnVlUHJvdG8gPSBuZXcudGFyZ2V0LnByb3RvdHlwZTtcblxuXHQgIE9iamVjdC5zZXRQcm90b3R5cGVPZih0aGlzLCB0cnVlUHJvdG8pO1xuICB9XG59XG4iXX0=
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DaffInheritableError } from './inheritable-error';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the passed object is a {@link DaffError}
|
|
4
|
+
*/
|
|
5
|
+
export const daffIsError = (error) => error instanceof DaffInheritableError || !!error.code;
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtZXJyb3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL2NvcmUvc3JjL2Vycm9ycy9pcy1lcnJvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUUzRDs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLFdBQVcsR0FBRyxDQUFDLEtBQVUsRUFBVyxFQUFFLENBQ2pELEtBQUssWUFBWSxvQkFBb0IsSUFBSSxDQUFDLENBQWEsS0FBTSxDQUFDLElBQUksQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IERhZmZFcnJvciB9IGZyb20gJy4vZXJyb3IuaW50ZXJmYWNlJztcbmltcG9ydCB7IERhZmZJbmhlcml0YWJsZUVycm9yIH0gZnJvbSAnLi9pbmhlcml0YWJsZS1lcnJvcic7XG5cbi8qKlxuICogQ2hlY2tzIGlmIHRoZSBwYXNzZWQgb2JqZWN0IGlzIGEge0BsaW5rIERhZmZFcnJvcn1cbiAqL1xuZXhwb3J0IGNvbnN0IGRhZmZJc0Vycm9yID0gKGVycm9yOiBhbnkpOiBib29sZWFuID0+XG4gIGVycm9yIGluc3RhbmNlb2YgRGFmZkluaGVyaXRhYmxlRXJyb3IgfHwgISEoPERhZmZFcnJvcj5lcnJvcikuY29kZTtcbiJdfQ==
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { DaffInheritableError } from './inheritable-error';
|
|
2
|
-
|
|
2
|
+
export { daffIsError } from './is-error';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2FwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvY29yZS9zcmMvZXJyb3JzL3B1YmxpY19hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDM0QsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLFlBQVksQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCB7IERhZmZFcnJvckNvZGVNYXAgfSBmcm9tICcuL2Vycm9yLW1hcCc7XG5leHBvcnQgeyBEYWZmRXJyb3IgfSBmcm9tICcuL2Vycm9yLmludGVyZmFjZSc7XG5leHBvcnQgeyBEYWZmSW5oZXJpdGFibGVFcnJvciB9IGZyb20gJy4vaW5oZXJpdGFibGUtZXJyb3InO1xuZXhwb3J0IHsgZGFmZklzRXJyb3IgfSBmcm9tICcuL2lzLWVycm9yJztcbiJdfQ==
|
package/esm2015/public_api.js
CHANGED
|
@@ -4,4 +4,5 @@ export * from './storage/public_api';
|
|
|
4
4
|
export * from './operators/public_api';
|
|
5
5
|
export * from './types/public_api';
|
|
6
6
|
export * from './kindable/public_api';
|
|
7
|
-
|
|
7
|
+
export * from './base64/public_api';
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJma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O1xuZXhwb3J0ICogZnJvbSAnLi90eXBlcy9wdWJsaWNfYXBpJztcbmV4cG9ydCAqIGZyb20gJy4va2luZGFibGUvcHVibGljX2FwaSc7XG5leHBvcnQgKiBmcm9tICcuL2Jhc2U2NC9wdWJsaWNfYXBpJztcblxuZXhwb3J0IHsgRGFmZk9yZGVyYWJsZSB9IGZyb20gJy4vb3JkZXJhYmxlL29yZGVyYWJsZSc7XG4iXX0=
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdGUtZXJyb3IuaW50ZXJmYWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3N0YXRlL3NyYy9lcnJvcnMvc3RhdGUtZXJyb3IuaW50ZXJmYWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEFuIGVycm9yIG9iamVjdCB0aGF0IGNhbiBiZSBzZXJpYWxpemVkIGluIHN0YXRlLlxuICovXG5leHBvcnQgaW50ZXJmYWNlIERhZmZTdGF0ZUVycm9yIHtcbiAgLyoqXG4gICAqIFRoZSBlcnJvciBjb2RlIHRoYXQgdW5pcXVlbHkgaWRlbnRpZmllcyB0aGUgdHlwZSBvZiBlcnJvci5cbiAgICovXG4gIGNvZGU6IHN0cmluZztcbiAgLyoqXG4gICAqIEEgbWVzc2FnZSB0aGF0IGRlc2NyaWJlcyB0aGUgZXJyb3IuXG4gICAqL1xuICBtZXNzYWdlOiBzdHJpbmc7XG4gIC8qKlxuICAgKiBXaGV0aGVyIHRoZSBlcnJvciBpcyBub24tY3JpdGljYWwgYW5kIHJlY292ZXJhYmxlIG9yIGNhdGFzdHJvcGhpYyBhbmQgdW5yZWNvdmVyYWJsZS5cbiAgICogVGhpcyBmaWVsZCBpcyBvcHRpb25hbC4gSWYgb21pdHRlZCwgdGhlIGVycm9yIGlzIGFzc3VtZWQgdG8gYmUgdW5yZWNvdmVyYWJsZS5cbiAgICovXG4gIHJlY292ZXJhYmxlPzogYm9vbGVhbjtcbn1cbiJdfQ==
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Transforms an error instance to a state error object.
|
|
3
3
|
*/
|
|
4
|
-
export function daffTransformErrorToStateError({ code, message }) {
|
|
5
|
-
return { code, message };
|
|
4
|
+
export function daffTransformErrorToStateError({ code, message, recoverable }) {
|
|
5
|
+
return { code, message, recoverable };
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLWVycm9yLXRvLXN0YXRlLWVycm9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vbGlicy9jb3JlL3N0YXRlL3NyYy9lcnJvcnMvdHJhbnNmb3JtLWVycm9yLXRvLXN0YXRlLWVycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1BOztHQUVHO0FBQ0gsTUFBTSxVQUFVLDhCQUE4QixDQUFDLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxXQUFXLEVBQWE7SUFDdEYsT0FBTyxFQUFFLElBQUksRUFBRSxPQUFPLEVBQUUsV0FBVyxFQUFFLENBQUM7QUFDeEMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IERhZmZFcnJvciB9IGZyb20gJ0BkYWZmb2RpbC9jb3JlJztcblxuaW1wb3J0IHsgRGFmZlN0YXRlRXJyb3IgfSBmcm9tICcuL3N0YXRlLWVycm9yLmludGVyZmFjZSc7XG5cbmV4cG9ydCB0eXBlIEVycm9yVHJhbnNmb3JtZXIgPSAoRGFmZkVycm9yKSA9PiBEYWZmU3RhdGVFcnJvcjtcblxuLyoqXG4gKiBUcmFuc2Zvcm1zIGFuIGVycm9yIGluc3RhbmNlIHRvIGEgc3RhdGUgZXJyb3Igb2JqZWN0LlxuICovXG5leHBvcnQgZnVuY3Rpb24gZGFmZlRyYW5zZm9ybUVycm9yVG9TdGF0ZUVycm9yKHsgY29kZSwgbWVzc2FnZSwgcmVjb3ZlcmFibGUgfTogRGFmZkVycm9yKTogRGFmZlN0YXRlRXJyb3Ige1xuICByZXR1cm4geyBjb2RlLCBtZXNzYWdlLCByZWNvdmVyYWJsZSB9O1xufVxuIl19
|
|
@@ -45,8 +45,8 @@ const substream = (sequence, ...terminators) => {
|
|
|
45
45
|
/**
|
|
46
46
|
* Transforms an error instance to a state error object.
|
|
47
47
|
*/
|
|
48
|
-
function daffTransformErrorToStateError({ code, message }) {
|
|
49
|
-
return { code, message };
|
|
48
|
+
function daffTransformErrorToStateError({ code, message, recoverable }) {
|
|
49
|
+
return { code, message, recoverable };
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-core-state.js","sources":["../../../libs/core/state/src/operators/substream.pipe.ts","../../../libs/core/state/src/errors/transform-error-to-state-error.ts","../../../libs/core/state/src/collection/sortable.ts","../../../libs/core/state/src/reducers/create-meta.ts","../../../libs/core/state/src/daffodil-core-state.ts"],"sourcesContent":["import { Action } from '@ngrx/store';\nimport { pipe } from 'rxjs';\nimport {\n scan,\n filter,\n} from 'rxjs/operators';\n\nexport type ActionType = Action['type'];\nexport type ActionSequenceStep = ActionType | ActionType[];\nexport type ActionSequence = ActionSequenceStep[];\n\nconst compareActionSequenceStep = (step: ActionSequenceStep, action: Action): boolean => Array.isArray(step)\n ? step.reduce((acc, type) => acc || action.type === type, false)\n : action.type === step;\n\n/**\n * Watches for a particular stream of actions in the specified order and\n * emits a list of those actions once all sequence steps have been matched.\n *\n * This will find the first occurence of the substream and not necessarily the most concise or recent substream.\n * For example, substream([A, B]) encountering an action stream of [A1, A2, B1, B2] will emit [A1, B1].\n * When a substream is found and emitted, the list is reset and it will continue to listen to the action stream.\n *\n * You can indicate that a particular step in the sequence can be matched by mutiple actions by passing an array for that step.\n * For example, if the first step of the sequence could be action A or action B: substream([[A, B], C]).\n * An action stream of [A1, C1] would cause substream to emit [A1, C1].\n * An action stream of [B1, C1] would cause substream to emit [B1, C1].\n * An action stream of [A1, B1, C1] would cause substream to emit [A1, C1].\n *\n * You can optionally pass a list of terminators.\n * If a terminator is encountered in the action stream, any partially matched substream is reset.\n * For example, substream([A, B], C) would not emit anything for an action stream of [A1, C1, B1].\n *\n * @param sequence The sequence of action types that define the substream to listen for.\n * @param terminators A list of terminators, any of which interrupt and reset a partially matched substream.\n */\nexport const substream = (sequence: ActionSequence, ...terminators: ActionType[]) => {\n const isFullMatch = matchedSubstream => matchedSubstream.length === sequence.length;\n const accumulateMatchedSubstream = (matchedSubstream, action) =>\n compareActionSequenceStep(sequence[matchedSubstream.length], action)\n ? [\n ...matchedSubstream,\n action,\n ]\n : matchedSubstream;\n\n return pipe(\n scan<Action, Action[]>((matchedSubstream, action) =>\n terminators.indexOf(action.type) > -1\n // terminator found, reset the list\n ? []\n : accumulateMatchedSubstream(\n // reset the list if fully matched\n isFullMatch(matchedSubstream) ? [] : matchedSubstream,\n action,\n ),\n []),\n filter(isFullMatch),\n );\n};\n","import { DaffError } from '@daffodil/core';\n\nimport { DaffStateError } from './state-error.interface';\n\nexport type ErrorTransformer = (DaffError) => DaffStateError;\n\n/**\n * Transforms an error instance to a state error object.\n */\nexport function daffTransformErrorToStateError({ code, message }: DaffError): DaffStateError {\n return { code, message };\n}\n","/**\n * The metadata that describes the sorting behavior of a collection of elements.\n */\nexport interface DaffSortOptions {\n default: DaffSortOption['value'];\n options: DaffSortOption[];\n}\n\n\n/**\n * One particular option used to sort a collection of elements;\n */\nexport interface DaffSortOption {\n label: string;\n value: any;\n}\n\n/**\n * The direction in which to sort a list of elements, e.g. if the list was\n * sorted alphabetically, \"Ascending\" would be from \"A-Z\",\n * and \"Descending\" would be from \"Z-A\".\n */\nexport enum DaffSortDirectionEnum {\n Ascending = 'ASC',\n Descending = 'DSC'\n}\n\n/**\n * Describes the properties of a collection that make the collection able to be\n * sorted by Daffodil.\n */\nexport interface DaffSortable {\n\n /**\n * The available options by which to sort the collection.\n */\n sort_options: DaffSortOptions;\n\n /**\n * The currently applied sorting option.\n */\n applied_sort_option: DaffSortOption['value'];\n\n /**\n * The currently applied sort direction.\n */\n applied_sort_direction: DaffSortDirectionEnum;\n}\n","import {\n Action,\n ActionReducer,\n} from '@ngrx/store';\n\n/**\n * Creates and returns a composite reducer that invokes each of the passed reducers in turn.\n */\nexport function daffComposeReducers<\n T,\n V extends Action = Action\n>(reducers: ActionReducer<T, V>[]): ActionReducer<T, V> {\n return (state: T, action: V): T =>\n reducers.reduce((nextState, reducer) => reducer(nextState, action), state);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAWA,MAAM,yBAAyB,GAAG,CAAC,IAAwB,EAAE,MAAc,KAAc,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;MACxG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE,KAAK,CAAC;MAC9D,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;;AAEzB;;;;;;;;;;;;;;;;;;;;;MAqBa,SAAS,GAAG,CAAC,QAAwB,EAAE,GAAG,WAAyB;IAC9E,MAAM,WAAW,GAAG,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,CAAC;IACpF,MAAM,0BAA0B,GAAG,CAAC,gBAAgB,EAAE,MAAM,KAC1D,yBAAyB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;UAChE;YACA,GAAG,gBAAgB;YACnB,MAAM;SACP;UACC,gBAAgB,CAAC;IAEvB,OAAO,IAAI,CACT,IAAI,CAAmB,CAAC,gBAAgB,EAAE,MAAM,KAC9C,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;UAEjC,EAAE;UACF,0BAA0B;;QAE1B,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,gBAAgB,EACrD,MAAM,CACP,EACL,EAAE,CAAC,EACH,MAAM,CAAC,WAAW,CAAC,CACpB,CAAC;AACJ;;ACrDA;;;SAGgB,8BAA8B,CAAC,EAAE,IAAI,EAAE,OAAO,EAAa;
|
|
1
|
+
{"version":3,"file":"daffodil-core-state.js","sources":["../../../libs/core/state/src/operators/substream.pipe.ts","../../../libs/core/state/src/errors/transform-error-to-state-error.ts","../../../libs/core/state/src/collection/sortable.ts","../../../libs/core/state/src/reducers/create-meta.ts","../../../libs/core/state/src/daffodil-core-state.ts"],"sourcesContent":["import { Action } from '@ngrx/store';\nimport { pipe } from 'rxjs';\nimport {\n scan,\n filter,\n} from 'rxjs/operators';\n\nexport type ActionType = Action['type'];\nexport type ActionSequenceStep = ActionType | ActionType[];\nexport type ActionSequence = ActionSequenceStep[];\n\nconst compareActionSequenceStep = (step: ActionSequenceStep, action: Action): boolean => Array.isArray(step)\n ? step.reduce((acc, type) => acc || action.type === type, false)\n : action.type === step;\n\n/**\n * Watches for a particular stream of actions in the specified order and\n * emits a list of those actions once all sequence steps have been matched.\n *\n * This will find the first occurence of the substream and not necessarily the most concise or recent substream.\n * For example, substream([A, B]) encountering an action stream of [A1, A2, B1, B2] will emit [A1, B1].\n * When a substream is found and emitted, the list is reset and it will continue to listen to the action stream.\n *\n * You can indicate that a particular step in the sequence can be matched by mutiple actions by passing an array for that step.\n * For example, if the first step of the sequence could be action A or action B: substream([[A, B], C]).\n * An action stream of [A1, C1] would cause substream to emit [A1, C1].\n * An action stream of [B1, C1] would cause substream to emit [B1, C1].\n * An action stream of [A1, B1, C1] would cause substream to emit [A1, C1].\n *\n * You can optionally pass a list of terminators.\n * If a terminator is encountered in the action stream, any partially matched substream is reset.\n * For example, substream([A, B], C) would not emit anything for an action stream of [A1, C1, B1].\n *\n * @param sequence The sequence of action types that define the substream to listen for.\n * @param terminators A list of terminators, any of which interrupt and reset a partially matched substream.\n */\nexport const substream = (sequence: ActionSequence, ...terminators: ActionType[]) => {\n const isFullMatch = matchedSubstream => matchedSubstream.length === sequence.length;\n const accumulateMatchedSubstream = (matchedSubstream, action) =>\n compareActionSequenceStep(sequence[matchedSubstream.length], action)\n ? [\n ...matchedSubstream,\n action,\n ]\n : matchedSubstream;\n\n return pipe(\n scan<Action, Action[]>((matchedSubstream, action) =>\n terminators.indexOf(action.type) > -1\n // terminator found, reset the list\n ? []\n : accumulateMatchedSubstream(\n // reset the list if fully matched\n isFullMatch(matchedSubstream) ? [] : matchedSubstream,\n action,\n ),\n []),\n filter(isFullMatch),\n );\n};\n","import { DaffError } from '@daffodil/core';\n\nimport { DaffStateError } from './state-error.interface';\n\nexport type ErrorTransformer = (DaffError) => DaffStateError;\n\n/**\n * Transforms an error instance to a state error object.\n */\nexport function daffTransformErrorToStateError({ code, message, recoverable }: DaffError): DaffStateError {\n return { code, message, recoverable };\n}\n","/**\n * The metadata that describes the sorting behavior of a collection of elements.\n */\nexport interface DaffSortOptions {\n default: DaffSortOption['value'];\n options: DaffSortOption[];\n}\n\n\n/**\n * One particular option used to sort a collection of elements;\n */\nexport interface DaffSortOption {\n label: string;\n value: any;\n}\n\n/**\n * The direction in which to sort a list of elements, e.g. if the list was\n * sorted alphabetically, \"Ascending\" would be from \"A-Z\",\n * and \"Descending\" would be from \"Z-A\".\n */\nexport enum DaffSortDirectionEnum {\n Ascending = 'ASC',\n Descending = 'DSC'\n}\n\n/**\n * Describes the properties of a collection that make the collection able to be\n * sorted by Daffodil.\n */\nexport interface DaffSortable {\n\n /**\n * The available options by which to sort the collection.\n */\n sort_options: DaffSortOptions;\n\n /**\n * The currently applied sorting option.\n */\n applied_sort_option: DaffSortOption['value'];\n\n /**\n * The currently applied sort direction.\n */\n applied_sort_direction: DaffSortDirectionEnum;\n}\n","import {\n Action,\n ActionReducer,\n} from '@ngrx/store';\n\n/**\n * Creates and returns a composite reducer that invokes each of the passed reducers in turn.\n */\nexport function daffComposeReducers<\n T,\n V extends Action = Action\n>(reducers: ActionReducer<T, V>[]): ActionReducer<T, V> {\n return (state: T, action: V): T =>\n reducers.reduce((nextState, reducer) => reducer(nextState, action), state);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAWA,MAAM,yBAAyB,GAAG,CAAC,IAAwB,EAAE,MAAc,KAAc,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;MACxG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE,KAAK,CAAC;MAC9D,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC;;AAEzB;;;;;;;;;;;;;;;;;;;;;MAqBa,SAAS,GAAG,CAAC,QAAwB,EAAE,GAAG,WAAyB;IAC9E,MAAM,WAAW,GAAG,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,CAAC;IACpF,MAAM,0BAA0B,GAAG,CAAC,gBAAgB,EAAE,MAAM,KAC1D,yBAAyB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;UAChE;YACA,GAAG,gBAAgB;YACnB,MAAM;SACP;UACC,gBAAgB,CAAC;IAEvB,OAAO,IAAI,CACT,IAAI,CAAmB,CAAC,gBAAgB,EAAE,MAAM,KAC9C,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;;UAEjC,EAAE;UACF,0BAA0B;;QAE1B,WAAW,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,gBAAgB,EACrD,MAAM,CACP,EACL,EAAE,CAAC,EACH,MAAM,CAAC,WAAW,CAAC,CACpB,CAAC;AACJ;;ACrDA;;;SAGgB,8BAA8B,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAa;IACtF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACxC;;ACMA;;;;;IAKY;AAAZ,WAAY,qBAAqB;IAC/B,0CAAiB,CAAA;IACjB,2CAAkB,CAAA;AACpB,CAAC,EAHW,qBAAqB,KAArB,qBAAqB;;ACjBjC;;;SAGgB,mBAAmB,CAGjC,QAA+B;IAC/B,OAAO,CAAC,KAAQ,EAAE,MAAS,KACzB,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/E;;ACdA;;;;;;"}
|
|
@@ -191,12 +191,18 @@ const unique = (array, comparator = (a, b) => a === b) => array.filter((a, index
|
|
|
191
191
|
*/
|
|
192
192
|
class DaffInheritableError extends Error {
|
|
193
193
|
constructor(message) {
|
|
194
|
-
const trueProto = new.target.prototype;
|
|
195
194
|
super(message);
|
|
195
|
+
this.recoverable = false;
|
|
196
|
+
const trueProto = new.target.prototype;
|
|
196
197
|
Object.setPrototypeOf(this, trueProto);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Checks if the passed object is a {@link DaffError}
|
|
203
|
+
*/
|
|
204
|
+
const daffIsError = (error) => error instanceof DaffInheritableError || !!error.code;
|
|
205
|
+
|
|
200
206
|
class DaffStorageServiceError extends DaffInheritableError {
|
|
201
207
|
constructor(message) {
|
|
202
208
|
super(message);
|
|
@@ -359,9 +365,75 @@ function backoff(maxTries, ms) {
|
|
|
359
365
|
}))));
|
|
360
366
|
}
|
|
361
367
|
|
|
368
|
+
/**
|
|
369
|
+
* A base64 service meant to be loaded into SSR contexts.
|
|
370
|
+
*
|
|
371
|
+
* @inheritdoc
|
|
372
|
+
*/
|
|
373
|
+
class DaffServerBase64Service {
|
|
374
|
+
constructor(platformId) {
|
|
375
|
+
if (isPlatformBrowser(platformId)) {
|
|
376
|
+
throw new Error('The DaffBrowserBase64Service can only be instantiated on the server.');
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
encode(str) {
|
|
380
|
+
return Buffer.from(str).toString('base64');
|
|
381
|
+
}
|
|
382
|
+
decode(str) {
|
|
383
|
+
return Buffer.from(str, 'base64').toString('ascii');
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/** @nocollapse */ DaffServerBase64Service.ɵprov = ɵɵdefineInjectable({ factory: function DaffServerBase64Service_Factory() { return new DaffServerBase64Service(ɵɵinject(PLATFORM_ID)); }, token: DaffServerBase64Service, providedIn: "root" });
|
|
387
|
+
DaffServerBase64Service.decorators = [
|
|
388
|
+
{ type: Injectable, args: [{
|
|
389
|
+
providedIn: 'root',
|
|
390
|
+
},] }
|
|
391
|
+
];
|
|
392
|
+
/** @nocollapse */
|
|
393
|
+
DaffServerBase64Service.ctorParameters = () => [
|
|
394
|
+
{ type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
|
|
395
|
+
];
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* @inheritdoc
|
|
399
|
+
*/
|
|
400
|
+
class DaffBrowserBase64Service {
|
|
401
|
+
constructor(platformId) {
|
|
402
|
+
if (!isPlatformBrowser(platformId)) {
|
|
403
|
+
throw new Error('The DaffBrowserBase64Service can only be instantiated in the browser.');
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
encode(str) {
|
|
407
|
+
return btoa(str);
|
|
408
|
+
}
|
|
409
|
+
decode(str) {
|
|
410
|
+
return atob(str);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/** @nocollapse */ DaffBrowserBase64Service.ɵprov = ɵɵdefineInjectable({ factory: function DaffBrowserBase64Service_Factory() { return new DaffBrowserBase64Service(ɵɵinject(PLATFORM_ID)); }, token: DaffBrowserBase64Service, providedIn: "root" });
|
|
414
|
+
DaffBrowserBase64Service.decorators = [
|
|
415
|
+
{ type: Injectable, args: [{
|
|
416
|
+
providedIn: 'root',
|
|
417
|
+
},] }
|
|
418
|
+
];
|
|
419
|
+
/** @nocollapse */
|
|
420
|
+
DaffBrowserBase64Service.ctorParameters = () => [
|
|
421
|
+
{ type: String, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] }
|
|
422
|
+
];
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* A token which creates a base64 service appropriate for the current environment, i.e., browser vs. server.
|
|
426
|
+
*/
|
|
427
|
+
const DaffBase64ServiceToken = new InjectionToken('DaffBase64Service', {
|
|
428
|
+
providedIn: 'root',
|
|
429
|
+
factory: () => isPlatformBrowser(inject(PLATFORM_ID))
|
|
430
|
+
? new DaffBrowserBase64Service(inject(PLATFORM_ID))
|
|
431
|
+
: new DaffServerBase64Service(inject(PLATFORM_ID)),
|
|
432
|
+
});
|
|
433
|
+
|
|
362
434
|
/**
|
|
363
435
|
* Generated bundle index. Do not edit.
|
|
364
436
|
*/
|
|
365
437
|
|
|
366
|
-
export { DaffErrorStorageService, DaffInheritableError, DaffLocalStorageService, DaffNoopStorageService, DaffPersistenceServiceToken, DaffServerErrorStorageService, DaffServerSideStorageError, DaffStorageServiceError, backoff, daffAdd, daffArrayToDict, daffDivide, daffMultiply, daffSubtract, randomSlice, randomSubset, range, sample, shuffle, unique };
|
|
438
|
+
export { DaffBase64ServiceToken, DaffBrowserBase64Service, DaffErrorStorageService, DaffInheritableError, DaffLocalStorageService, DaffNoopStorageService, DaffPersistenceServiceToken, DaffServerBase64Service, DaffServerErrorStorageService, DaffServerSideStorageError, DaffStorageServiceError, backoff, daffAdd, daffArrayToDict, daffDivide, daffIsError, daffMultiply, daffSubtract, randomSlice, randomSubset, range, sample, shuffle, unique };
|
|
367
439
|
//# sourceMappingURL=daffodil-core.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-core.js","sources":["../../../libs/core/src/utils/long-arithmetic.ts","../../../libs/core/src/utils/range.ts","../../../libs/core/src/utils/shuffle.ts","../../../libs/core/src/utils/random-subset.ts","../../../libs/core/src/utils/random-slice.ts","../../../libs/core/src/utils/array-to-dict.ts","../../../libs/core/src/utils/sample.ts","../../../libs/core/src/utils/unique.ts","../../../libs/core/src/errors/inheritable-error.ts","../../../libs/core/src/storage/error/error.ts","../../../libs/core/src/storage/error/error.service.ts","../../../libs/core/src/storage/server-error/server-error.ts","../../../libs/core/src/storage/server-error/server-error.service.ts","../../../libs/core/src/storage/localstorage/localstorage.service.ts","../../../libs/core/src/storage/noopstorage/noopstorage.service.ts","../../../libs/core/src/storage/persistence.interface.ts","../../../libs/core/src/operators/backoff.pipe.ts","../../../libs/core/src/daffodil-core.ts"],"sourcesContent":["/**\n * A helper function to get the number of decimal significant figures of a number.\n * This function will fail if the given number has more than 16 significant figures or\n * the value of the number is greater than 10^11\n *\n * @param number\n */\nfunction daffPrecision(number: number): number {\n let p = 10000;\n if(number === undefined || number === null) {\n return p;\n }\n while (Math.round(number * p) / p !== number) {\n p *= 10;\n }\n return p;\n}\n\n/**\n * A function to add long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are less than\n * 16 significant figures and less than 10^11\n *\n * @param numbers\n */\nexport function daffAdd(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffAdd.');\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.reduce((acc, number) => acc + Math.round(number*precision), 0) / precision;\n}\n\n/**\n * A function to subtract long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are each less than\n * 16 significant figures and less than 10^11\n *\n * @param numbers\n */\nexport function daffSubtract(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffSubtract.');\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.slice(1).reduce(\n (acc, number) => acc - Math.round(number*precision),\n Math.round(numbers[0]*precision),\n ) / precision;\n}\n\n/**\n * A function to multiply long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures\n * and less than 10^11\n *\n * @param numbers\n */\nexport function daffMultiply(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffMultiply.');\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.reduce(\n (acc, number) => acc * Math.round(number*precision),\n 1,\n ) / Math.pow(precision, numbers.length);\n}\n\n/**\n * A function to divide long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures\n * and less than 10^11\n *\n * Returns NaN when attempting to use NaN as an input.\n * Returns NaN when attempting to divide by 0 or null.\n *\n * @param numbers\n */\nexport function daffDivide(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffDivide.');\n }\n // TODO(griest024): use better condition after IE support is dropped\n const illegalOperation = numbers.filter(isNaN).length > 0\n || numbers.slice(1).filter(n => n === 0 || n === null).length > 0;\n if (illegalOperation) {\n return NaN;\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.slice(1).reduce(\n (acc, number) => acc / Math.round(number*precision),\n Math.round(numbers[0]*precision),\n ) * Math.pow(precision, numbers.length - 2);\n}\n","/**\n * Range\n *\n * Range accepts two inputs, a `start` and an `end`\n * and returns an array filled with numbers from\n * `start` to `end`.\n *\n * @param start\n * @param end\n * @returns number\n */\nexport const range = (start: number, end: number): Array<number> =>\n Array.apply(null, Array(end - start + 1)).map((val, index) => index + start);\n\n","/**\n * Immutable Fisher-Yates Shuffle\n * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\n */\nexport const shuffle = <T>(array: T[]): T[] => {\n const result = [];\n array.forEach((el, i) => {\n const s = Math.floor(Math.random() * i);\n if( s !== i ){\n result[i] = result[s];\n }\n result[s] = el;\n });\n return result;\n};\n","import { shuffle } from './shuffle';\n\n/**\n * Returns a random subset of an array in a random order.\n *\n * @param array\n * @param length\n */\nexport const randomSubset = <T>(array: T[], length?: number): T[] => {\n if(length > array.length){\n throw new Error('Requested length is longer than array length.');\n }\n length = length ? length : Math.floor(Math.random() * array.length);\n return shuffle(array).slice(0, length);\n};\n","/**\n * Returns a random slice of an array.\n * An optional length may be specified.\n *\n * @param array\n */\nexport const randomSlice = <T>(array: T[], length?: number): T[] => {\n if(array.length === 0) {\n return [];\n };\n if(length > array.length) {\n throw new Error('Requested length is longer than array length.');\n }\n const arrayLength = length || Math.floor(Math.random() * array.length);\n const start = Math.floor(Math.random() * (array.length - arrayLength + 1));\n const end = start + arrayLength;\n return array.slice(start, end);\n};\n","import { Dict } from '../types/public_api';\n\n/**\n * Converts an array into a dictionary.\n * Dictionary values are keyed by the return of the specified getKey, or `'key'` by default.\n */\nexport const daffArrayToDict = <T>(array: T[], getKey = (val: T) => (<any>val).key): Dict<T> =>\n array.reduce(\n (dict, val) => {\n dict[getKey(val)] = val;\n return dict;\n },\n {},\n );\n","import { randomSlice } from './random-slice';\n\n/**\n * Returns a random element of an array.\n */\nexport const sample = <T>(array: T[]): T => randomSlice(array, 1)[0];\n","/**\n * Filters an array of elements, removing duplicates.\n * Does not guarantee order of filtered elements.\n *\n * An optional comparator function may be passed for arbitrary comparison behavior.\n * The default is a strict equality comparison: `a === b`.\n */\nexport const unique = <T>(array: T[], comparator: (a: T, b: T) => boolean = (a, b) => a === b): T[] =>\n array.filter((a, index) => array.slice(index + 1).filter(b => comparator(a, b)).length === 0);\n","/**\n * A class which allows you to appropriately check the inheritance of an error.\n *\n * In typescript, when you try to extend an error with a specialized error class,\n * if you try to call something like:\n *\n * ```ts\n * class MyError extends Error {}\n *\n * let myError = new MyError();\n *\n * myError instanceof MyError; // returns false\n * ```\n *\n * You will see unexpected things. This class fixes that issue as described here\n * https://github.com/microsoft/TypeScript/issues/13965\n */\nexport class DaffInheritableError extends Error {\n\t__proto__: Error;\n\n\tconstructor(message?: string) {\n\t const trueProto = new.target.prototype;\n\t super(message);\n\n\t Object.setPrototypeOf(this, trueProto);\n\t}\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '../../errors/public_api';\n\nexport class DaffStorageServiceError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_STORAGE_FAILURE';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\nimport { DaffStorageServiceError } from './error';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffErrorStorageService implements DaffPersistenceService {\n static readonly ERROR_MESSAGE = 'The DaffErrorStorageService always throws an error.';\n\n setItem(key: string, value: any): void {\n this.throwError();\n }\n\n getItem(key: string): any {\n this.throwError();\n }\n\n removeItem(key: string): any {\n this.throwError();\n }\n\n clear(){\n this.throwError();\n }\n\n private throwError() {\n throw new DaffStorageServiceError(DaffErrorStorageService.ERROR_MESSAGE);\n }\n}\n","import { DaffError } from '../../errors/public_api';\nimport { DaffStorageServiceError } from '../error/error';\n\n/**\n * An error thrown when there is an attempt to access storage on the server and none is available.\n */\nexport class DaffServerSideStorageError extends DaffStorageServiceError implements DaffError {\n public readonly code: string = 'DAFF_SERVER_STORAGE_FAILURE';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\nimport { DaffServerSideStorageError } from './server-error';\n\n/**\n * A storage service meant to be loaded into SSR contexts.\n * It will always throw the {@link DaffServerSideStorageError}.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffServerErrorStorageService implements DaffPersistenceService {\n static readonly ERROR_MESSAGE = 'The DaffServerErrorStorageService always throws an error.';\n\n setItem(key: string, value: any): void {\n this.throwError();\n }\n\n getItem(key: string): any {\n this.throwError();\n }\n\n removeItem(key: string): any {\n this.throwError();\n }\n\n clear(){\n this.throwError();\n }\n\n private throwError() {\n throw new DaffServerSideStorageError(DaffServerErrorStorageService.ERROR_MESSAGE);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Injectable,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffLocalStorageService implements DaffPersistenceService {\n constructor(@Inject(PLATFORM_ID) platformId: string){\n if(!isPlatformBrowser(platformId)){\n throw new Error('The DaffLocalStorageService can only be instantiated in the browser.');\n }\n }\n\n /**\n * Persist the given item into local storage.\n */\n setItem(key: string, value: any): void {\n localStorage.setItem(key, value);\n }\n\n /**\n * Retrieve the given item from localstorage.\n */\n getItem(key: string): any {\n return localStorage.getItem(key);\n }\n\n /**\n * Remove a given item from localstorage\n */\n removeItem(key: string): any {\n localStorage.removeItem(key);\n }\n\n clear(){\n localStorage.clear();\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffNoopStorageService implements DaffPersistenceService {\n setItem(key: string, value: any): void {};\n getItem(key: string): any {};\n clear(): void {};\n removeItem(key: string): void {};\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n InjectionToken,\n inject,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffLocalStorageService } from './localstorage/localstorage.service';\nimport { DaffServerErrorStorageService } from './server-error/public_api';\n\nexport interface DaffPersistenceService {\n setItem(key: string, value: any): void;\n getItem(key: string): any;\n clear(): void;\n removeItem(key: string): void;\n}\n\nexport const DaffPersistenceServiceToken = new InjectionToken<DaffPersistenceService>('DaffPersistenceService', {\n providedIn: 'root',\n factory: () => isPlatformBrowser(inject<string>(PLATFORM_ID))\n ? new DaffLocalStorageService(inject<string>(PLATFORM_ID))\n : new DaffServerErrorStorageService(),\n});\n","import {\n pipe,\n timer,\n throwError,\n} from 'rxjs';\nimport {\n retryWhen,\n mergeMap,\n} from 'rxjs/operators';\n\n/**\n * Retries failed Observables\n *\n * @param maxTries The maximum number of tries the observable will be tried\n * @param ms The initial amount of time\n */\nexport function backoff(maxTries: number, ms: number) {\n return pipe(\n retryWhen(attempt => attempt.pipe(\n mergeMap((shadowedAttempt: Error, i) => {\n if(i >= maxTries) {\n return throwError(shadowedAttempt);\n }\n return timer(ms*Math.pow(2,i));\n }),\n )),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;AAOA,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,IAAG,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE;QAC1C,OAAO,CAAC,CAAC;KACV;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE;QAC5C,CAAC,IAAI,EAAE,CAAC;KACT;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;SAOgB,OAAO,CAAC,GAAG,OAAiB;IAC1C,IAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;AAC5F,CAAC;AAED;;;;;;;SAOgB,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AjCF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;yCAEc,MAAM,SAAC,WAAW;;;ACZjC;;;MAMa,sBAAsB;IACjC,OAAO,CAAC,GAAW,EAAE,KAAU,KAAU;;IACzC,OAAO,CAAC,GAAW,KAAS;;IAC5B,KAAK,MAAW;;IAChB,UAAU,CAAC,GAAW,KAAU;;;;;YAPjC,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;MCQY,2BAA2B,GAAG,IAAI,cAAc,CAAyB,wBAAwB,EAAE;IAC9G,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM,iBAAiB,CAAC,MAAM,CAAS,WAAW,CAAC,CAAC;UACzD,IAAI,uBAAuB,CAAC,MAAM,CAAS,WAAW,CAAC,CAAC;UACxD,IAAI,6BAA6B,EAAE;CACxC;;ACZD;;;;;;SAMgB,OAAO,CAAC,QAAgB,EAAE,EAAU;IAClD,OAAO,IAAI,CACT,SAAS,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAC/B,QAAQ,CAAC,CAAC,eAAsB,EAAE,CAAC;QACjC,IAAG,CAAC,IAAI,QAAQ,EAAE;YAChB,OAAO,UAAU,CAAC,eAAe,CAAC,CAAC;SACpC;QACD,OAAO,KAAK,CAAC,EAAE,GAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC;KAChC,CAAC,CACH,CAAC,CACH,CAAC;AACJ;;AC3BA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-core.js","sources":["../../../libs/core/src/utils/long-arithmetic.ts","../../../libs/core/src/utils/range.ts","../../../libs/core/src/utils/shuffle.ts","../../../libs/core/src/utils/random-subset.ts","../../../libs/core/src/utils/random-slice.ts","../../../libs/core/src/utils/array-to-dict.ts","../../../libs/core/src/utils/sample.ts","../../../libs/core/src/utils/unique.ts","../../../libs/core/src/errors/inheritable-error.ts","../../../libs/core/src/errors/is-error.ts","../../../libs/core/src/storage/error/error.ts","../../../libs/core/src/storage/error/error.service.ts","../../../libs/core/src/storage/server-error/server-error.ts","../../../libs/core/src/storage/server-error/server-error.service.ts","../../../libs/core/src/storage/localstorage/localstorage.service.ts","../../../libs/core/src/storage/noopstorage/noopstorage.service.ts","../../../libs/core/src/storage/persistence.interface.ts","../../../libs/core/src/operators/backoff.pipe.ts","../../../libs/core/src/base64/server/server.service.ts","../../../libs/core/src/base64/browser/browser.service.ts","../../../libs/core/src/base64/base64.interface.ts","../../../libs/core/src/daffodil-core.ts"],"sourcesContent":["/**\n * A helper function to get the number of decimal significant figures of a number.\n * This function will fail if the given number has more than 16 significant figures or\n * the value of the number is greater than 10^11\n *\n * @param number\n */\nfunction daffPrecision(number: number): number {\n let p = 10000;\n if(number === undefined || number === null) {\n return p;\n }\n while (Math.round(number * p) / p !== number) {\n p *= 10;\n }\n return p;\n}\n\n/**\n * A function to add long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are less than\n * 16 significant figures and less than 10^11\n *\n * @param numbers\n */\nexport function daffAdd(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffAdd.');\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.reduce((acc, number) => acc + Math.round(number*precision), 0) / precision;\n}\n\n/**\n * A function to subtract long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are each less than\n * 16 significant figures and less than 10^11\n *\n * @param numbers\n */\nexport function daffSubtract(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffSubtract.');\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.slice(1).reduce(\n (acc, number) => acc - Math.round(number*precision),\n Math.round(numbers[0]*precision),\n ) / precision;\n}\n\n/**\n * A function to multiply long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures\n * and less than 10^11\n *\n * @param numbers\n */\nexport function daffMultiply(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffMultiply.');\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.reduce(\n (acc, number) => acc * Math.round(number*precision),\n 1,\n ) / Math.pow(precision, numbers.length);\n}\n\n/**\n * A function to divide long numbers accurately with conversions and integer math.\n * This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures\n * and less than 10^11\n *\n * Returns NaN when attempting to use NaN as an input.\n * Returns NaN when attempting to divide by 0 or null.\n *\n * @param numbers\n */\nexport function daffDivide(...numbers: number[]): number {\n if(numbers.length < 2) {\n throw new Error('Provide at least 2 numbers for daffDivide.');\n }\n // TODO(griest024): use better condition after IE support is dropped\n const illegalOperation = numbers.filter(isNaN).length > 0\n || numbers.slice(1).filter(n => n === 0 || n === null).length > 0;\n if (illegalOperation) {\n return NaN;\n }\n const precision = Math.max(...numbers.map(daffPrecision));\n return numbers.slice(1).reduce(\n (acc, number) => acc / Math.round(number*precision),\n Math.round(numbers[0]*precision),\n ) * Math.pow(precision, numbers.length - 2);\n}\n","/**\n * Range\n *\n * Range accepts two inputs, a `start` and an `end`\n * and returns an array filled with numbers from\n * `start` to `end`.\n *\n * @param start\n * @param end\n * @returns number\n */\nexport const range = (start: number, end: number): Array<number> =>\n Array.apply(null, Array(end - start + 1)).map((val, index) => index + start);\n\n","/**\n * Immutable Fisher-Yates Shuffle\n * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\n */\nexport const shuffle = <T>(array: T[]): T[] => {\n const result = [];\n array.forEach((el, i) => {\n const s = Math.floor(Math.random() * i);\n if( s !== i ){\n result[i] = result[s];\n }\n result[s] = el;\n });\n return result;\n};\n","import { shuffle } from './shuffle';\n\n/**\n * Returns a random subset of an array in a random order.\n *\n * @param array\n * @param length\n */\nexport const randomSubset = <T>(array: T[], length?: number): T[] => {\n if(length > array.length){\n throw new Error('Requested length is longer than array length.');\n }\n length = length ? length : Math.floor(Math.random() * array.length);\n return shuffle(array).slice(0, length);\n};\n","/**\n * Returns a random slice of an array.\n * An optional length may be specified.\n *\n * @param array\n */\nexport const randomSlice = <T>(array: T[], length?: number): T[] => {\n if(array.length === 0) {\n return [];\n };\n if(length > array.length) {\n throw new Error('Requested length is longer than array length.');\n }\n const arrayLength = length || Math.floor(Math.random() * array.length);\n const start = Math.floor(Math.random() * (array.length - arrayLength + 1));\n const end = start + arrayLength;\n return array.slice(start, end);\n};\n","import { Dict } from '../types/public_api';\n\n/**\n * Converts an array into a dictionary.\n * Dictionary values are keyed by the return of the specified getKey, or `'key'` by default.\n */\nexport const daffArrayToDict = <T>(array: T[], getKey = (val: T) => (<any>val).key): Dict<T> =>\n array.reduce(\n (dict, val) => {\n dict[getKey(val)] = val;\n return dict;\n },\n {},\n );\n","import { randomSlice } from './random-slice';\n\n/**\n * Returns a random element of an array.\n */\nexport const sample = <T>(array: T[]): T => randomSlice(array, 1)[0];\n","/**\n * Filters an array of elements, removing duplicates.\n * Does not guarantee order of filtered elements.\n *\n * An optional comparator function may be passed for arbitrary comparison behavior.\n * The default is a strict equality comparison: `a === b`.\n */\nexport const unique = <T>(array: T[], comparator: (a: T, b: T) => boolean = (a, b) => a === b): T[] =>\n array.filter((a, index) => array.slice(index + 1).filter(b => comparator(a, b)).length === 0);\n","/**\n * A class which allows you to appropriately check the inheritance of an error.\n *\n * In typescript, when you try to extend an error with a specialized error class,\n * if you try to call something like:\n *\n * ```ts\n * class MyError extends Error {}\n *\n * let myError = new MyError();\n *\n * myError instanceof MyError; // returns false\n * ```\n *\n * You will see unexpected things. This class fixes that issue as described here\n * https://github.com/microsoft/TypeScript/issues/13965\n */\nexport class DaffInheritableError extends Error {\n\t__proto__: Error;\n\n recoverable = false;\n\n constructor(message?: string) {\n\t super(message);\n\t const trueProto = new.target.prototype;\n\n\t Object.setPrototypeOf(this, trueProto);\n }\n}\n","import { DaffError } from './error.interface';\nimport { DaffInheritableError } from './inheritable-error';\n\n/**\n * Checks if the passed object is a {@link DaffError}\n */\nexport const daffIsError = (error: any): boolean =>\n error instanceof DaffInheritableError || !!(<DaffError>error).code;\n","import {\n DaffError,\n DaffInheritableError,\n} from '../../errors/public_api';\n\nexport class DaffStorageServiceError extends DaffInheritableError implements DaffError {\n public readonly code: string = 'DAFF_STORAGE_FAILURE';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\nimport { DaffStorageServiceError } from './error';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffErrorStorageService implements DaffPersistenceService {\n static readonly ERROR_MESSAGE = 'The DaffErrorStorageService always throws an error.';\n\n setItem(key: string, value: any): void {\n this.throwError();\n }\n\n getItem(key: string): any {\n this.throwError();\n }\n\n removeItem(key: string): any {\n this.throwError();\n }\n\n clear(){\n this.throwError();\n }\n\n private throwError() {\n throw new DaffStorageServiceError(DaffErrorStorageService.ERROR_MESSAGE);\n }\n}\n","import { DaffError } from '../../errors/public_api';\nimport { DaffStorageServiceError } from '../error/error';\n\n/**\n * An error thrown when there is an attempt to access storage on the server and none is available.\n */\nexport class DaffServerSideStorageError extends DaffStorageServiceError implements DaffError {\n public readonly code: string = 'DAFF_SERVER_STORAGE_FAILURE';\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\nimport { DaffServerSideStorageError } from './server-error';\n\n/**\n * A storage service meant to be loaded into SSR contexts.\n * It will always throw the {@link DaffServerSideStorageError}.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffServerErrorStorageService implements DaffPersistenceService {\n static readonly ERROR_MESSAGE = 'The DaffServerErrorStorageService always throws an error.';\n\n setItem(key: string, value: any): void {\n this.throwError();\n }\n\n getItem(key: string): any {\n this.throwError();\n }\n\n removeItem(key: string): any {\n this.throwError();\n }\n\n clear(){\n this.throwError();\n }\n\n private throwError() {\n throw new DaffServerSideStorageError(DaffServerErrorStorageService.ERROR_MESSAGE);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Injectable,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffLocalStorageService implements DaffPersistenceService {\n constructor(@Inject(PLATFORM_ID) platformId: string){\n if(!isPlatformBrowser(platformId)){\n throw new Error('The DaffLocalStorageService can only be instantiated in the browser.');\n }\n }\n\n /**\n * Persist the given item into local storage.\n */\n setItem(key: string, value: any): void {\n localStorage.setItem(key, value);\n }\n\n /**\n * Retrieve the given item from localstorage.\n */\n getItem(key: string): any {\n return localStorage.getItem(key);\n }\n\n /**\n * Remove a given item from localstorage\n */\n removeItem(key: string): any {\n localStorage.removeItem(key);\n }\n\n clear(){\n localStorage.clear();\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DaffPersistenceService } from '../persistence.interface';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffNoopStorageService implements DaffPersistenceService {\n setItem(key: string, value: any): void {};\n getItem(key: string): any {};\n clear(): void {};\n removeItem(key: string): void {};\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n InjectionToken,\n inject,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffLocalStorageService } from './localstorage/localstorage.service';\nimport { DaffServerErrorStorageService } from './server-error/public_api';\n\nexport interface DaffPersistenceService {\n setItem(key: string, value: any): void;\n getItem(key: string): any;\n clear(): void;\n removeItem(key: string): void;\n}\n\nexport const DaffPersistenceServiceToken = new InjectionToken<DaffPersistenceService>('DaffPersistenceService', {\n providedIn: 'root',\n factory: () => isPlatformBrowser(inject<string>(PLATFORM_ID))\n ? new DaffLocalStorageService(inject<string>(PLATFORM_ID))\n : new DaffServerErrorStorageService(),\n});\n","import {\n pipe,\n timer,\n throwError,\n} from 'rxjs';\nimport {\n retryWhen,\n mergeMap,\n} from 'rxjs/operators';\n\n/**\n * Retries failed Observables\n *\n * @param maxTries The maximum number of tries the observable will be tried\n * @param ms The initial amount of time\n */\nexport function backoff(maxTries: number, ms: number) {\n return pipe(\n retryWhen(attempt => attempt.pipe(\n mergeMap((shadowedAttempt: Error, i) => {\n if(i >= maxTries) {\n return throwError(shadowedAttempt);\n }\n return timer(ms*Math.pow(2,i));\n }),\n )),\n );\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Inject,\n Injectable,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffBase64Service } from '../base64.interface';\n\ndeclare const Buffer;\n\n/**\n * A base64 service meant to be loaded into SSR contexts.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffServerBase64Service implements DaffBase64Service {\n constructor(@Inject(PLATFORM_ID) platformId: string){\n if (isPlatformBrowser(platformId)){\n throw new Error('The DaffBrowserBase64Service can only be instantiated on the server.');\n }\n }\n\n encode(str: string): string {\n return Buffer.from(str).toString('base64');\n }\n\n decode(str: string): string {\n return Buffer.from(str, 'base64').toString('ascii');\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n Injectable,\n Inject,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffBase64Service } from '../base64.interface';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffBrowserBase64Service implements DaffBase64Service {\n constructor(@Inject(PLATFORM_ID) platformId: string){\n if(!isPlatformBrowser(platformId)){\n throw new Error('The DaffBrowserBase64Service can only be instantiated in the browser.');\n }\n }\n\n encode(str: string): string {\n return btoa(str);\n }\n\n decode(str: string): string {\n return atob(str);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n InjectionToken,\n inject,\n PLATFORM_ID,\n} from '@angular/core';\n\nimport { DaffBrowserBase64Service } from './browser/browser.service';\nimport { DaffServerBase64Service } from './server/public_api';\n\n/**\n * A service for encoding and decoding base64 strings.\n */\nexport interface DaffBase64Service {\n /**\n * Encodes an ASCII string to base64.\n */\n encode(str: string): string;\n /**\n * Decodes a base64 string to ASCII.\n */\n decode(str: string): string;\n}\n\n/**\n * A token which creates a base64 service appropriate for the current environment, i.e., browser vs. server.\n */\nexport const DaffBase64ServiceToken = new InjectionToken<DaffBase64Service>('DaffBase64Service', {\n providedIn: 'root',\n factory: () => isPlatformBrowser(inject<string>(PLATFORM_ID))\n ? new DaffBrowserBase64Service(inject<string>(PLATFORM_ID))\n : new DaffServerBase64Service(inject<string>(PLATFORM_ID)),\n});\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;;;;;AAOA,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,IAAG,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE;QAC1C,OAAO,CAAC,CAAC;KACV;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE;QAC5C,CAAC,IAAI,EAAE,CAAC;KACT;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;SAOgB,OAAO,CAAC,GAAG,OAAiB;IAC1C,IAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1D,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;AAC5F,CAAC;AAED;;;;;;;SAOgB,YAAY,CAAC,GAAG,OAAiB;IAC/C,IAAG,OAAO,CAA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AAQ,CAAC,CAAC;KAC5C;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;KACrD;;;;YAhBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;yCAEc,MAAM,SAAC,WAAW;;;ACXjC;;;MAMa,wBAAwB;IACnC,YAAiC,UAAkB;QACjD,IAAG,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAC;YAChC,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;SAC1F;KACF;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;KAClB;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;KAClB;;;;YAhBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;yCAEc,MAAM,SAAC,WAAW;;;ACQjC;;;MAGa,sBAAsB,GAAG,IAAI,cAAc,CAAoB,mBAAmB,EAAE;IAC/F,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM,iBAAiB,CAAC,MAAM,CAAS,WAAW,CAAC,CAAC;UACzD,IAAI,wBAAwB,CAAC,MAAM,CAAS,WAAW,CAAC,CAAC;UACzD,IAAI,uBAAuB,CAAC,MAAM,CAAS,WAAW,CAAC,CAAC;CAC7D;;AChCD;;;;;;"}
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"ActionType":{"__symbolic":"interface"},"ActionSequenceStep":{"__symbolic":"interface"},"ActionSequence":{"__symbolic":"interface"},"substream":{"__symbolic":"error","message":"Lambda not supported","line":36,"character":25,"module":"./operators/substream.pipe"},"DaffState":{"Stable":"Stable","Resolving":"Resolving","Adding":"Adding","Added":"Added","Mutating":"Mutating","Mutated":"Mutated","Deleting":"Deleting","Complete":"Stable"},"DaffMutableLoadingState":{"__symbolic":"interface"},"DaffLoadingState":{"__symbolic":"interface"},"DaffStateable":{"__symbolic":"interface"},"DaffStateError":{"__symbolic":"interface"},"daffTransformErrorToStateError":{"__symbolic":"function","parameters":["code","message"],"value":{"code":{"__symbolic":"reference","name":"code"},"message":{"__symbolic":"reference","name":"message"}}},"ErrorTransformer":{"__symbolic":"interface"},"DaffNumericallyPaginable":{"__symbolic":"interface"},"DaffSortOptions":{"__symbolic":"interface"},"DaffSortOption":{"__symbolic":"interface"},"DaffSortDirectionEnum":{"Ascending":"ASC","Descending":"DSC"},"DaffSortable":{"__symbolic":"interface"},"daffComposeReducers":{"__symbolic":"function","parameters":["reducers"],"value":{"__symbolic":"error","message":"Lambda not supported","line":12,"character":9,"module":"./reducers/create-meta"}},"DaffStoreFacade":{"__symbolic":"interface"}},"origins":{"ActionType":"./operators/substream.pipe","ActionSequenceStep":"./operators/substream.pipe","ActionSequence":"./operators/substream.pipe","substream":"./operators/substream.pipe","DaffState":"./states/state.enum","DaffMutableLoadingState":"./states/mutable-loading","DaffLoadingState":"./states/loading","DaffStateable":"./states/stateable.interface","DaffStateError":"./errors/state-error.interface","daffTransformErrorToStateError":"./errors/transform-error-to-state-error","ErrorTransformer":"./errors/transform-error-to-state-error","DaffNumericallyPaginable":"./collection/paginable","DaffSortOptions":"./collection/sortable","DaffSortOption":"./collection/sortable","DaffSortDirectionEnum":"./collection/sortable","DaffSortable":"./collection/sortable","daffComposeReducers":"./reducers/create-meta","DaffStoreFacade":"./store/facade"},"importAs":"@daffodil/core/state"}
|
|
1
|
+
{"__symbolic":"module","version":4,"metadata":{"ActionType":{"__symbolic":"interface"},"ActionSequenceStep":{"__symbolic":"interface"},"ActionSequence":{"__symbolic":"interface"},"substream":{"__symbolic":"error","message":"Lambda not supported","line":36,"character":25,"module":"./operators/substream.pipe"},"DaffState":{"Stable":"Stable","Resolving":"Resolving","Adding":"Adding","Added":"Added","Mutating":"Mutating","Mutated":"Mutated","Deleting":"Deleting","Complete":"Stable"},"DaffMutableLoadingState":{"__symbolic":"interface"},"DaffLoadingState":{"__symbolic":"interface"},"DaffStateable":{"__symbolic":"interface"},"DaffStateError":{"__symbolic":"interface"},"daffTransformErrorToStateError":{"__symbolic":"function","parameters":["code","message","recoverable"],"value":{"code":{"__symbolic":"reference","name":"code"},"message":{"__symbolic":"reference","name":"message"},"recoverable":{"__symbolic":"reference","name":"recoverable"}}},"ErrorTransformer":{"__symbolic":"interface"},"DaffNumericallyPaginable":{"__symbolic":"interface"},"DaffSortOptions":{"__symbolic":"interface"},"DaffSortOption":{"__symbolic":"interface"},"DaffSortDirectionEnum":{"Ascending":"ASC","Descending":"DSC"},"DaffSortable":{"__symbolic":"interface"},"daffComposeReducers":{"__symbolic":"function","parameters":["reducers"],"value":{"__symbolic":"error","message":"Lambda not supported","line":12,"character":9,"module":"./reducers/create-meta"}},"DaffStoreFacade":{"__symbolic":"interface"}},"origins":{"ActionType":"./operators/substream.pipe","ActionSequenceStep":"./operators/substream.pipe","ActionSequence":"./operators/substream.pipe","substream":"./operators/substream.pipe","DaffState":"./states/state.enum","DaffMutableLoadingState":"./states/mutable-loading","DaffLoadingState":"./states/loading","DaffStateable":"./states/stateable.interface","DaffStateError":"./errors/state-error.interface","daffTransformErrorToStateError":"./errors/transform-error-to-state-error","ErrorTransformer":"./errors/transform-error-to-state-error","DaffNumericallyPaginable":"./collection/paginable","DaffSortOptions":"./collection/sortable","DaffSortOption":"./collection/sortable","DaffSortDirectionEnum":"./collection/sortable","DaffSortable":"./collection/sortable","daffComposeReducers":"./reducers/create-meta","DaffStoreFacade":"./store/facade"},"importAs":"@daffodil/core/state"}
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
* An error object that can be serialized in state.
|
|
3
3
|
*/
|
|
4
4
|
export interface DaffStateError {
|
|
5
|
+
/**
|
|
6
|
+
* The error code that uniquely identifies the type of error.
|
|
7
|
+
*/
|
|
5
8
|
code: string;
|
|
9
|
+
/**
|
|
10
|
+
* A message that describes the error.
|
|
11
|
+
*/
|
|
6
12
|
message: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the error is non-critical and recoverable or catastrophic and unrecoverable.
|
|
15
|
+
* This field is optional. If omitted, the error is assumed to be unrecoverable.
|
|
16
|
+
*/
|
|
17
|
+
recoverable?: boolean;
|
|
7
18
|
}
|
|
@@ -4,4 +4,4 @@ export declare type ErrorTransformer = (DaffError: any) => DaffStateError;
|
|
|
4
4
|
/**
|
|
5
5
|
* Transforms an error instance to a state error object.
|
|
6
6
|
*/
|
|
7
|
-
export declare function daffTransformErrorToStateError({ code, message }: DaffError): DaffStateError;
|
|
7
|
+
export declare function daffTransformErrorToStateError({ code, message, recoverable }: DaffError): DaffStateError;
|