@alterior/common 3.9.1 → 3.13.4

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.
Files changed (162) hide show
  1. package/dist/base64.d.ts +6 -6
  2. package/dist/base64.js +52 -52
  3. package/dist/base64.js.map +1 -1
  4. package/dist/base64.test.d.ts +1 -1
  5. package/dist/cache.d.ts +84 -84
  6. package/dist/cache.js +148 -148
  7. package/dist/cache.js.map +1 -1
  8. package/dist/cache.test.d.ts +1 -1
  9. package/dist/check-native-async.d.ts +1 -1
  10. package/dist/check-native-async.js +27 -28
  11. package/dist/check-native-async.js.map +1 -1
  12. package/dist/clone.d.ts +23 -23
  13. package/dist/clone.js +59 -60
  14. package/dist/clone.js.map +1 -1
  15. package/dist/clone.test.d.ts +1 -1
  16. package/dist/coalesce.d.ts +5 -5
  17. package/dist/coalesce.js +15 -16
  18. package/dist/coalesce.js.map +1 -1
  19. package/dist/coalesce.test.d.ts +1 -1
  20. package/dist/colors.d.ts +62 -62
  21. package/dist/colors.js +66 -66
  22. package/dist/console.d.ts +31 -31
  23. package/dist/console.d.ts.map +1 -1
  24. package/dist/console.js +65 -86
  25. package/dist/console.js.map +1 -1
  26. package/dist/constructor.d.ts +6 -6
  27. package/dist/constructor.js +2 -2
  28. package/dist/decorators.d.ts +1 -1
  29. package/dist/decorators.d.ts.map +1 -1
  30. package/dist/decorators.js +6 -7
  31. package/dist/decorators.js.map +1 -1
  32. package/dist/environment.d.ts +11 -11
  33. package/dist/environment.d.ts.map +1 -1
  34. package/dist/environment.js +27 -27
  35. package/dist/environment.js.map +1 -1
  36. package/dist/errors.d.ts +66 -66
  37. package/dist/errors.js +133 -133
  38. package/dist/errors.test.d.ts +1 -1
  39. package/dist/get-param-names.d.ts +5 -5
  40. package/dist/get-param-names.js +48 -49
  41. package/dist/get-param-names.js.map +1 -1
  42. package/dist/index.d.ts +20 -20
  43. package/dist/index.js +23 -23
  44. package/dist/is-constructor.d.ts +12 -12
  45. package/dist/is-constructor.js +28 -29
  46. package/dist/is-constructor.js.map +1 -1
  47. package/dist/is-constructor.test.d.ts +1 -1
  48. package/dist/lazy-promise.d.ts +14 -14
  49. package/dist/lazy-promise.js +32 -32
  50. package/dist/lazy-promise.js.map +1 -1
  51. package/dist/lazy-subject.d.ts +22 -22
  52. package/dist/lazy-subject.js +22 -23
  53. package/dist/lazy-subject.js.map +1 -1
  54. package/dist/locks.d.ts +23 -23
  55. package/dist/locks.js +76 -76
  56. package/dist/locks.js.map +1 -1
  57. package/dist/locks.test.d.ts +1 -1
  58. package/dist/locks.test.js.map +1 -1
  59. package/dist/padding.d.ts +22 -22
  60. package/dist/padding.js +42 -43
  61. package/dist/padding.js.map +1 -1
  62. package/dist/presentation.d.ts +49 -49
  63. package/dist/presentation.d.ts.map +1 -1
  64. package/dist/presentation.js +132 -132
  65. package/dist/presentation.js.map +1 -1
  66. package/dist/presentation.test.d.ts +1 -1
  67. package/dist/presentation.test.js.map +1 -1
  68. package/dist/serializer.d.ts +8 -8
  69. package/dist/serializer.js +23 -24
  70. package/dist/serializer.js.map +1 -1
  71. package/dist/test.d.ts +2 -2
  72. package/dist/time.d.ts +9 -9
  73. package/dist/time.js +22 -22
  74. package/dist/time.js.map +1 -1
  75. package/dist/timeout.d.ts +13 -13
  76. package/dist/timeout.js +27 -28
  77. package/dist/timeout.js.map +1 -1
  78. package/dist/zones.d.ts +46 -46
  79. package/dist/zones.js +139 -139
  80. package/dist/zones.js.map +1 -1
  81. package/dist.esm/base64.d.ts +6 -6
  82. package/dist.esm/base64.js +48 -48
  83. package/dist.esm/base64.js.map +1 -1
  84. package/dist.esm/base64.test.d.ts +1 -1
  85. package/dist.esm/cache.d.ts +84 -84
  86. package/dist.esm/cache.js +144 -144
  87. package/dist.esm/cache.js.map +1 -1
  88. package/dist.esm/cache.test.d.ts +1 -1
  89. package/dist.esm/check-native-async.d.ts +1 -1
  90. package/dist.esm/check-native-async.js +24 -24
  91. package/dist.esm/check-native-async.js.map +1 -1
  92. package/dist.esm/clone.d.ts +23 -23
  93. package/dist.esm/clone.js +53 -53
  94. package/dist.esm/clone.js.map +1 -1
  95. package/dist.esm/clone.test.d.ts +1 -1
  96. package/dist.esm/coalesce.d.ts +5 -5
  97. package/dist.esm/coalesce.js +12 -12
  98. package/dist.esm/coalesce.js.map +1 -1
  99. package/dist.esm/coalesce.test.d.ts +1 -1
  100. package/dist.esm/colors.d.ts +62 -62
  101. package/dist.esm/colors.js +63 -63
  102. package/dist.esm/console.d.ts +31 -31
  103. package/dist.esm/console.d.ts.map +1 -1
  104. package/dist.esm/console.js +60 -80
  105. package/dist.esm/console.js.map +1 -1
  106. package/dist.esm/constructor.d.ts +6 -6
  107. package/dist.esm/constructor.js +1 -1
  108. package/dist.esm/decorators.d.ts +1 -1
  109. package/dist.esm/decorators.d.ts.map +1 -1
  110. package/dist.esm/decorators.js +3 -3
  111. package/dist.esm/environment.d.ts +11 -11
  112. package/dist.esm/environment.d.ts.map +1 -1
  113. package/dist.esm/environment.js +24 -24
  114. package/dist.esm/environment.js.map +1 -1
  115. package/dist.esm/errors.d.ts +66 -66
  116. package/dist.esm/errors.js +115 -115
  117. package/dist.esm/errors.test.d.ts +1 -1
  118. package/dist.esm/get-param-names.d.ts +5 -5
  119. package/dist.esm/get-param-names.js +45 -45
  120. package/dist.esm/get-param-names.js.map +1 -1
  121. package/dist.esm/index.d.ts +20 -20
  122. package/dist.esm/index.js +20 -20
  123. package/dist.esm/is-constructor.d.ts +12 -12
  124. package/dist.esm/is-constructor.js +24 -24
  125. package/dist.esm/is-constructor.js.map +1 -1
  126. package/dist.esm/is-constructor.test.d.ts +1 -1
  127. package/dist.esm/lazy-promise.d.ts +14 -14
  128. package/dist.esm/lazy-promise.js +28 -28
  129. package/dist.esm/lazy-promise.js.map +1 -1
  130. package/dist.esm/lazy-subject.d.ts +22 -22
  131. package/dist.esm/lazy-subject.js +19 -19
  132. package/dist.esm/locks.d.ts +23 -23
  133. package/dist.esm/locks.js +71 -71
  134. package/dist.esm/locks.js.map +1 -1
  135. package/dist.esm/locks.test.d.ts +1 -1
  136. package/dist.esm/locks.test.js.map +1 -1
  137. package/dist.esm/padding.d.ts +22 -22
  138. package/dist.esm/padding.js +37 -37
  139. package/dist.esm/presentation.d.ts +49 -49
  140. package/dist.esm/presentation.d.ts.map +1 -1
  141. package/dist.esm/presentation.js +126 -126
  142. package/dist.esm/presentation.js.map +1 -1
  143. package/dist.esm/presentation.test.d.ts +1 -1
  144. package/dist.esm/presentation.test.js.map +1 -1
  145. package/dist.esm/serializer.d.ts +8 -8
  146. package/dist.esm/serializer.js +20 -20
  147. package/dist.esm/test.d.ts +2 -2
  148. package/dist.esm/time.d.ts +9 -9
  149. package/dist.esm/time.js +19 -19
  150. package/dist.esm/time.js.map +1 -1
  151. package/dist.esm/timeout.d.ts +13 -13
  152. package/dist.esm/timeout.js +23 -23
  153. package/dist.esm/tsconfig.esm.tsbuildinfo +1 -0
  154. package/dist.esm/zones.d.ts +46 -46
  155. package/dist.esm/zones.js +135 -135
  156. package/dist.esm/zones.js.map +1 -1
  157. package/package.json +11 -8
  158. package/src/console.ts +2 -22
  159. package/src/environment.ts +2 -0
  160. package/tsconfig.esm.json +0 -3
  161. package/tsconfig.json +0 -2
  162. package/tsconfig.tsbuildinfo +1 -3791
@@ -1,7 +1,7 @@
1
- /**
2
- * Represents a constructor. Useful for type gymnastics.
3
- */
4
- export interface Constructor<T> {
5
- new (...args: any[]): T;
6
- }
1
+ /**
2
+ * Represents a constructor. Useful for type gymnastics.
3
+ */
4
+ export interface Constructor<T> {
5
+ new (...args: any[]): T;
6
+ }
7
7
  //# sourceMappingURL=constructor.d.ts.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=constructor.js.map
@@ -1,2 +1,2 @@
1
- export declare function Injectable(): (target: any) => void;
1
+ export declare function Injectable(): (target: any) => void;
2
2
  //# sourceMappingURL=decorators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,0BAEzB"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,KACf,WAAM,UAChB"}
@@ -1,4 +1,4 @@
1
- export function Injectable() {
2
- return target => { };
3
- }
1
+ export function Injectable() {
2
+ return target => { };
3
+ }
4
4
  //# sourceMappingURL=decorators.js.map
@@ -1,12 +1,12 @@
1
- /**
2
- * Access the environment variables of the current process.
3
- */
4
- export declare class Environment {
5
- constructor();
6
- private defaults;
7
- private env;
8
- get raw(): any;
9
- setup<T>(defaults: Partial<T>): void;
10
- get<T = any>(): T;
11
- }
1
+ /**
2
+ * Access the environment variables of the current process.
3
+ */
4
+ export declare class Environment {
5
+ constructor();
6
+ private defaults;
7
+ private env;
8
+ get raw(): any;
9
+ setup<T>(defaults: Partial<T>): void;
10
+ get<T = any>(): T;
11
+ }
12
12
  //# sourceMappingURL=environment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBACa,WAAW;;IAKpB,OAAO,CAAC,QAAQ,CAAO;IACvB,OAAO,CAAC,GAAG,CAAO;IAElB,IAAI,GAAG,IAAI,GAAG,CAEb;IAED,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAG,OAAO,CAAC,CAAC,CAAC;IAI9B,GAAG,CAAC,CAAC,GAAG,GAAG,KAAM,CAAC;CAOrB"}
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,qBACa,WAAW;;IAKpB,OAAO,CAAC,QAAQ,CAAO;IACvB,OAAO,CAAC,GAAG,CAAO;IAElB,IAAI,GAAG,IAAI,GAAG,CAEb;IAED,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAG,OAAO,CAAC,CAAC,CAAC;IAI9B,GAAG,CAAC,CAAC,GAAG,GAAG,KAAM,CAAC;CAOrB"}
@@ -1,25 +1,25 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { Injectable } from './decorators';
3
- /**
4
- * Access the environment variables of the current process.
5
- */
6
- let Environment = class Environment {
7
- constructor() {
8
- this.env = typeof process !== 'undefined' ? process.env : {};
9
- }
10
- get raw() {
11
- return this.env;
12
- }
13
- setup(defaults) {
14
- this.defaults = defaults;
15
- }
16
- get() {
17
- return Object.assign({}, this.defaults, (typeof process !== 'undefined' ? process.env : null) || {});
18
- }
19
- };
20
- Environment = __decorate([
21
- Injectable(),
22
- __metadata("design:paramtypes", [])
23
- ], Environment);
24
- export { Environment };
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Injectable } from './decorators';
3
+ /**
4
+ * Access the environment variables of the current process.
5
+ */
6
+ let Environment = class Environment {
7
+ constructor() {
8
+ this.env = typeof process !== 'undefined' ? process.env : {};
9
+ }
10
+ get raw() {
11
+ return this.env;
12
+ }
13
+ setup(defaults) {
14
+ this.defaults = defaults;
15
+ }
16
+ get() {
17
+ return Object.assign({}, this.defaults, (typeof process !== 'undefined' ? process.env : null) || {});
18
+ }
19
+ };
20
+ Environment = __decorate([
21
+ Injectable(),
22
+ __metadata("design:paramtypes", [])
23
+ ], Environment);
24
+ export { Environment };
25
25
  //# sourceMappingURL=environment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;IACpB;QACI,IAAI,CAAC,GAAG,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC;IAKD,IAAI,GAAG;QACH,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,KAAK,CAAI,QAAqB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,GAAG;QACC,OAAO,MAAM,CAAC,MAAM,CAChB,EAAE,EACF,IAAI,CAAC,QAAQ,EACb,CAAC,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CACrE,CAAC;IACN,CAAC;CACJ,CAAA;AAvBY,WAAW;IADvB,UAAU,EAAE;;GACA,WAAW,CAuBvB;SAvBY,WAAW"}
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C;;GAEG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;IACpB;QACI,IAAI,CAAC,GAAG,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACjE,CAAC;IAKD,IAAI,GAAG;QACH,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,KAAK,CAAI,QAAqB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,GAAG;QACC,OAAO,MAAM,CAAC,MAAM,CAChB,EAAE,EACF,IAAI,CAAC,QAAQ,EACb,CAAC,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CACrE,CAAC;IACN,CAAC;CACJ,CAAA;AAvBY,WAAW;IADvB,UAAU,EAAE;;GACA,WAAW,CAuBvB"}
@@ -1,67 +1,67 @@
1
- export declare class BaseError extends Error {
2
- constructor(message: string, options?: any);
3
- static serializer: (instance: any) => any;
4
- static setJSONSerializer(serializer: (instance: any) => any): void;
5
- asJSON(): any;
6
- }
7
- /**
8
- * Base class for errors thrown by the system or framework
9
- */
10
- export declare class SystemError extends BaseError {
11
- }
12
- /**
13
- * Base class for errors thrown by your application
14
- */
15
- export declare class ApplicationError extends BaseError {
16
- }
17
- export declare class ArgumentError<ValueT = any> extends SystemError {
18
- constructor(argumentName: string, message?: string);
19
- private _argumentName;
20
- private _value;
21
- /**
22
- * The invalid value passed for the given argument
23
- */
24
- get value(): ValueT;
25
- withValue(value: ValueT): this;
26
- /**
27
- * The name of the argument
28
- */
29
- get argumentName(): string;
30
- }
31
- export declare class ArgumentNullError<ValueT = any> extends ArgumentError<ValueT> {
32
- constructor(argumentName: string, message?: string);
33
- }
34
- export declare class ArgumentOutOfRangeError<ValueT = any> extends ArgumentError<ValueT> {
35
- constructor(argumentName: string, message?: string);
36
- }
37
- export declare class NotSupportedError extends SystemError {
38
- constructor(message?: string);
39
- }
40
- export declare class NotImplementedError extends SystemError {
41
- constructor(message?: string);
42
- }
43
- export declare class OperationCanceledError extends SystemError {
44
- constructor(message?: string);
45
- }
46
- export declare class TimeoutError extends SystemError {
47
- constructor(message?: string);
48
- }
49
- export declare class IOError extends SystemError {
50
- constructor(message?: string);
51
- }
52
- export declare class FormatError extends SystemError {
53
- constructor(message?: string);
54
- }
55
- export declare class InvalidOperationError extends SystemError {
56
- constructor(message?: string);
57
- }
58
- export declare class AccessDeniedError extends SystemError {
59
- constructor(message?: string);
60
- }
61
- export declare class HttpError extends Error {
62
- statusCode: number;
63
- body: any;
64
- headers: string[][];
65
- constructor(statusCode: number, body: any, headers?: string[][]);
66
- }
1
+ export declare class BaseError extends Error {
2
+ constructor(message: string, options?: any);
3
+ static serializer: (instance: any) => any;
4
+ static setJSONSerializer(serializer: (instance: any) => any): void;
5
+ asJSON(): any;
6
+ }
7
+ /**
8
+ * Base class for errors thrown by the system or framework
9
+ */
10
+ export declare class SystemError extends BaseError {
11
+ }
12
+ /**
13
+ * Base class for errors thrown by your application
14
+ */
15
+ export declare class ApplicationError extends BaseError {
16
+ }
17
+ export declare class ArgumentError<ValueT = any> extends SystemError {
18
+ constructor(argumentName: string, message?: string);
19
+ private _argumentName;
20
+ private _value;
21
+ /**
22
+ * The invalid value passed for the given argument
23
+ */
24
+ get value(): ValueT;
25
+ withValue(value: ValueT): this;
26
+ /**
27
+ * The name of the argument
28
+ */
29
+ get argumentName(): string;
30
+ }
31
+ export declare class ArgumentNullError<ValueT = any> extends ArgumentError<ValueT> {
32
+ constructor(argumentName: string, message?: string);
33
+ }
34
+ export declare class ArgumentOutOfRangeError<ValueT = any> extends ArgumentError<ValueT> {
35
+ constructor(argumentName: string, message?: string);
36
+ }
37
+ export declare class NotSupportedError extends SystemError {
38
+ constructor(message?: string);
39
+ }
40
+ export declare class NotImplementedError extends SystemError {
41
+ constructor(message?: string);
42
+ }
43
+ export declare class OperationCanceledError extends SystemError {
44
+ constructor(message?: string);
45
+ }
46
+ export declare class TimeoutError extends SystemError {
47
+ constructor(message?: string);
48
+ }
49
+ export declare class IOError extends SystemError {
50
+ constructor(message?: string);
51
+ }
52
+ export declare class FormatError extends SystemError {
53
+ constructor(message?: string);
54
+ }
55
+ export declare class InvalidOperationError extends SystemError {
56
+ constructor(message?: string);
57
+ }
58
+ export declare class AccessDeniedError extends SystemError {
59
+ constructor(message?: string);
60
+ }
61
+ export declare class HttpError extends Error {
62
+ statusCode: number;
63
+ body: any;
64
+ headers: string[][];
65
+ constructor(statusCode: number, body: any, headers?: string[][]);
66
+ }
67
67
  //# sourceMappingURL=errors.d.ts.map
@@ -1,116 +1,116 @@
1
- export class BaseError extends Error {
2
- constructor(message, options) {
3
- super(message, options);
4
- }
5
- static setJSONSerializer(serializer) {
6
- this.serializer = serializer;
7
- }
8
- asJSON() {
9
- if (BaseError.serializer)
10
- return BaseError.serializer(this);
11
- let ownKeys = Object.getOwnPropertyNames(this);
12
- let repr = {
13
- $type: this.constructor.name,
14
- error: true,
15
- message: this.message,
16
- stack: this['stack']
17
- };
18
- let includedData = ownKeys
19
- .filter(x => !x.startsWith('_'))
20
- .filter(x => typeof this[x] !== 'function')
21
- .map(x => [x, this[x]])
22
- .reduce((pv, cv) => pv[cv[0]] = cv[1], {});
23
- return Object.assign({}, repr, includedData);
24
- }
25
- }
26
- /**
27
- * Base class for errors thrown by the system or framework
28
- */
29
- export class SystemError extends BaseError {
30
- }
31
- /**
32
- * Base class for errors thrown by your application
33
- */
34
- export class ApplicationError extends BaseError {
35
- }
36
- export class ArgumentError extends SystemError {
37
- constructor(argumentName, message) {
38
- super(message || `Invalid value for argument ${argumentName}`);
39
- this._argumentName = argumentName;
40
- }
41
- /**
42
- * The invalid value passed for the given argument
43
- */
44
- get value() {
45
- return this._value;
46
- }
47
- withValue(value) {
48
- this._value = value;
49
- return this;
50
- }
51
- /**
52
- * The name of the argument
53
- */
54
- get argumentName() {
55
- return this._argumentName;
56
- }
57
- }
58
- export class ArgumentNullError extends ArgumentError {
59
- constructor(argumentName, message) {
60
- super(argumentName, message || `Argument ${argumentName} cannot be null`);
61
- }
62
- }
63
- export class ArgumentOutOfRangeError extends ArgumentError {
64
- constructor(argumentName, message) {
65
- super(argumentName, message || `Argument ${argumentName} is out of range`);
66
- }
67
- }
68
- export class NotSupportedError extends SystemError {
69
- constructor(message) {
70
- super(message || `The requested operation is not supported.`);
71
- }
72
- }
73
- export class NotImplementedError extends SystemError {
74
- constructor(message) {
75
- super(message || `The requested operation is not implemented.`);
76
- }
77
- }
78
- export class OperationCanceledError extends SystemError {
79
- constructor(message) {
80
- super(message || `The requested operation is not implemented.`);
81
- }
82
- }
83
- export class TimeoutError extends SystemError {
84
- constructor(message) {
85
- super(message || `The operation has timed out.`);
86
- }
87
- }
88
- export class IOError extends SystemError {
89
- constructor(message) {
90
- super(message || `An I/O error has occurred.`);
91
- }
92
- }
93
- export class FormatError extends SystemError {
94
- constructor(message) {
95
- super(message || `Invalid format.`);
96
- }
97
- }
98
- export class InvalidOperationError extends SystemError {
99
- constructor(message) {
100
- super(message || `Invalid format.`);
101
- }
102
- }
103
- export class AccessDeniedError extends SystemError {
104
- constructor(message) {
105
- super(message || `Invalid format.`);
106
- }
107
- }
108
- export class HttpError extends Error {
109
- constructor(statusCode, body, headers = []) {
110
- super(`HttpError statusCode=${statusCode} [are you sure you meant to catch this?]`);
111
- this.statusCode = statusCode;
112
- this.body = body;
113
- this.headers = headers;
114
- }
115
- }
1
+ export class BaseError extends Error {
2
+ constructor(message, options) {
3
+ super(message, options);
4
+ }
5
+ static setJSONSerializer(serializer) {
6
+ this.serializer = serializer;
7
+ }
8
+ asJSON() {
9
+ if (BaseError.serializer)
10
+ return BaseError.serializer(this);
11
+ let ownKeys = Object.getOwnPropertyNames(this);
12
+ let repr = {
13
+ $type: this.constructor.name,
14
+ error: true,
15
+ message: this.message,
16
+ stack: this['stack']
17
+ };
18
+ let includedData = ownKeys
19
+ .filter(x => !x.startsWith('_'))
20
+ .filter(x => typeof this[x] !== 'function')
21
+ .map(x => [x, this[x]])
22
+ .reduce((pv, cv) => pv[cv[0]] = cv[1], {});
23
+ return Object.assign({}, repr, includedData);
24
+ }
25
+ }
26
+ /**
27
+ * Base class for errors thrown by the system or framework
28
+ */
29
+ export class SystemError extends BaseError {
30
+ }
31
+ /**
32
+ * Base class for errors thrown by your application
33
+ */
34
+ export class ApplicationError extends BaseError {
35
+ }
36
+ export class ArgumentError extends SystemError {
37
+ constructor(argumentName, message) {
38
+ super(message || `Invalid value for argument ${argumentName}`);
39
+ this._argumentName = argumentName;
40
+ }
41
+ /**
42
+ * The invalid value passed for the given argument
43
+ */
44
+ get value() {
45
+ return this._value;
46
+ }
47
+ withValue(value) {
48
+ this._value = value;
49
+ return this;
50
+ }
51
+ /**
52
+ * The name of the argument
53
+ */
54
+ get argumentName() {
55
+ return this._argumentName;
56
+ }
57
+ }
58
+ export class ArgumentNullError extends ArgumentError {
59
+ constructor(argumentName, message) {
60
+ super(argumentName, message || `Argument ${argumentName} cannot be null`);
61
+ }
62
+ }
63
+ export class ArgumentOutOfRangeError extends ArgumentError {
64
+ constructor(argumentName, message) {
65
+ super(argumentName, message || `Argument ${argumentName} is out of range`);
66
+ }
67
+ }
68
+ export class NotSupportedError extends SystemError {
69
+ constructor(message) {
70
+ super(message || `The requested operation is not supported.`);
71
+ }
72
+ }
73
+ export class NotImplementedError extends SystemError {
74
+ constructor(message) {
75
+ super(message || `The requested operation is not implemented.`);
76
+ }
77
+ }
78
+ export class OperationCanceledError extends SystemError {
79
+ constructor(message) {
80
+ super(message || `The requested operation is not implemented.`);
81
+ }
82
+ }
83
+ export class TimeoutError extends SystemError {
84
+ constructor(message) {
85
+ super(message || `The operation has timed out.`);
86
+ }
87
+ }
88
+ export class IOError extends SystemError {
89
+ constructor(message) {
90
+ super(message || `An I/O error has occurred.`);
91
+ }
92
+ }
93
+ export class FormatError extends SystemError {
94
+ constructor(message) {
95
+ super(message || `Invalid format.`);
96
+ }
97
+ }
98
+ export class InvalidOperationError extends SystemError {
99
+ constructor(message) {
100
+ super(message || `Invalid format.`);
101
+ }
102
+ }
103
+ export class AccessDeniedError extends SystemError {
104
+ constructor(message) {
105
+ super(message || `Invalid format.`);
106
+ }
107
+ }
108
+ export class HttpError extends Error {
109
+ constructor(statusCode, body, headers = []) {
110
+ super(`HttpError statusCode=${statusCode} [are you sure you meant to catch this?]`);
111
+ this.statusCode = statusCode;
112
+ this.body = body;
113
+ this.headers = headers;
114
+ }
115
+ }
116
116
  //# sourceMappingURL=errors.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=errors.test.d.ts.map
@@ -1,6 +1,6 @@
1
- /**
2
- * Get the names of the parameters of the given function.
3
- * @param fn
4
- */
5
- export declare function getParameterNames(fn: Function): string[];
1
+ /**
2
+ * Get the names of the parameters of the given function.
3
+ * @param fn
4
+ */
5
+ export declare function getParameterNames(fn: Function): string[];
6
6
  //# sourceMappingURL=get-param-names.d.ts.map
@@ -1,46 +1,46 @@
1
- // Originally from https://github.com/goatslacker/get-parameter-names
2
- /**
3
- * @hidden
4
- */
5
- let COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
6
- /**
7
- * @hidden
8
- */
9
- let DEFAULT_PARAMS = /=[^,)]+/mg;
10
- /**
11
- * @hidden
12
- */
13
- let FAT_ARROWS = /=>.*$/mg;
14
- /**
15
- * @hidden
16
- */
17
- let SPACES = /\s/mg;
18
- /**
19
- * @hidden
20
- */
21
- let BEFORE_OPENING_PAREN = /^[^(]*\(/mg;
22
- /**
23
- * @hidden
24
- */
25
- let AFTER_CLOSING_PAREN = /^([^)]*)\).*$/mg;
26
- /**
27
- * Get the names of the parameters of the given function.
28
- * @param fn
29
- */
30
- export function getParameterNames(fn) {
31
- // Sometimes the user may want to transform or replace a function, which may cause us to lose access to
32
- // the parameter names. To provide an escape hatch for that use case, we'll check if the given function
33
- // has been annotated with parameter names already.
34
- if ('__parameterNames' in fn) {
35
- return fn['__parameterNames'];
36
- }
37
- let code = fn.toString()
38
- .replace(SPACES, '')
39
- .replace(COMMENTS, '')
40
- .replace(FAT_ARROWS, '')
41
- .replace(DEFAULT_PARAMS, '')
42
- .replace(BEFORE_OPENING_PAREN, '')
43
- .replace(AFTER_CLOSING_PAREN, '$1');
44
- return code ? code.split(',') : [];
45
- }
1
+ // Originally from https://github.com/goatslacker/get-parameter-names
2
+ /**
3
+ * @hidden
4
+ */
5
+ let COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
6
+ /**
7
+ * @hidden
8
+ */
9
+ let DEFAULT_PARAMS = /=[^,)]+/mg;
10
+ /**
11
+ * @hidden
12
+ */
13
+ let FAT_ARROWS = /=>.*$/mg;
14
+ /**
15
+ * @hidden
16
+ */
17
+ let SPACES = /\s/mg;
18
+ /**
19
+ * @hidden
20
+ */
21
+ let BEFORE_OPENING_PAREN = /^[^(]*\(/mg;
22
+ /**
23
+ * @hidden
24
+ */
25
+ let AFTER_CLOSING_PAREN = /^([^)]*)\).*$/mg;
26
+ /**
27
+ * Get the names of the parameters of the given function.
28
+ * @param fn
29
+ */
30
+ export function getParameterNames(fn) {
31
+ // Sometimes the user may want to transform or replace a function, which may cause us to lose access to
32
+ // the parameter names. To provide an escape hatch for that use case, we'll check if the given function
33
+ // has been annotated with parameter names already.
34
+ if ('__parameterNames' in fn) {
35
+ return fn['__parameterNames'];
36
+ }
37
+ let code = fn.toString()
38
+ .replace(SPACES, '')
39
+ .replace(COMMENTS, '')
40
+ .replace(FAT_ARROWS, '')
41
+ .replace(DEFAULT_PARAMS, '')
42
+ .replace(BEFORE_OPENING_PAREN, '')
43
+ .replace(AFTER_CLOSING_PAREN, '$1');
44
+ return code ? code.split(',') : [];
45
+ }
46
46
  //# sourceMappingURL=get-param-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-param-names.js","sourceRoot":"","sources":["../src/get-param-names.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE;;GAEG;AACH,IAAI,QAAQ,GAAG,kCAAkC,CAAC;AAClD;;GAEG;AACH,IAAI,cAAc,GAAG,WAAW,CAAC;AACjC;;GAEG;AACH,IAAI,UAAU,GAAG,SAAS,CAAC;AAC3B;;GAEG;AACH,IAAI,MAAM,GAAG,MAAM,CAAC;AACpB;;GAEG;AACH,IAAI,oBAAoB,GAAG,YAAY,CAAC;AACtC;;GAEG;AACL,IAAI,mBAAmB,GAAG,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAY;IAE5C,wGAAwG;IACxG,uGAAuG;IACvG,mDAAmD;IAEnD,IAAI,kBAAkB,IAAI,EAAE,EAAE;QAC5B,OAAO,EAAE,CAAC,kBAAkB,CAAa,CAAC;KAC3C;IAED,IAAI,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE;SACrB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC;SACjC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC"}
1
+ {"version":3,"file":"get-param-names.js","sourceRoot":"","sources":["../src/get-param-names.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE;;GAEG;AACH,IAAI,QAAQ,GAAG,kCAAkC,CAAC;AAClD;;GAEG;AACH,IAAI,cAAc,GAAG,WAAW,CAAC;AACjC;;GAEG;AACH,IAAI,UAAU,GAAG,SAAS,CAAC;AAC3B;;GAEG;AACH,IAAI,MAAM,GAAG,MAAM,CAAC;AACpB;;GAEG;AACH,IAAI,oBAAoB,GAAG,YAAY,CAAC;AACtC;;GAEG;AACL,IAAI,mBAAmB,GAAG,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAY;IAE5C,wGAAwG;IACxG,uGAAuG;IACvG,mDAAmD;IAEnD,IAAI,kBAAkB,IAAI,EAAE,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAa,CAAC;IAC5C,CAAC;IAED,IAAI,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE;SACrB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC3B,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC;SACjC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACrC,CAAC"}
@@ -1,21 +1,21 @@
1
- export * from './zones';
2
- export * from './clone';
3
- export * from './coalesce';
4
- export * from './colors';
5
- export * from './console';
6
- export * from './environment';
7
- export * from './errors';
8
- export * from './timeout';
9
- export * from './base64';
10
- export * from './cache';
11
- export * from './serializer';
12
- export * from './lazy-promise';
13
- export * from './locks';
14
- export * from './presentation';
15
- export * from './time';
16
- export * from './get-param-names';
17
- export * from './lazy-subject';
18
- export * from './check-native-async';
19
- export * from './is-constructor';
20
- export * from './padding';
1
+ export * from './zones';
2
+ export * from './clone';
3
+ export * from './coalesce';
4
+ export * from './colors';
5
+ export * from './console';
6
+ export * from './environment';
7
+ export * from './errors';
8
+ export * from './timeout';
9
+ export * from './base64';
10
+ export * from './cache';
11
+ export * from './serializer';
12
+ export * from './lazy-promise';
13
+ export * from './locks';
14
+ export * from './presentation';
15
+ export * from './time';
16
+ export * from './get-param-names';
17
+ export * from './lazy-subject';
18
+ export * from './check-native-async';
19
+ export * from './is-constructor';
20
+ export * from './padding';
21
21
  //# sourceMappingURL=index.d.ts.map