@oscarpalmer/atoms 0.222.0 → 0.223.0
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/dist/array/difference.mjs +1 -1
- package/dist/array/exists.mjs +10 -4
- package/dist/array/filter.mjs +14 -4
- package/dist/array/find.mjs +8 -3
- package/dist/array/first.mjs +9 -3
- package/dist/array/index.d.mts +4 -4
- package/dist/array/insert.mjs +1 -1
- package/dist/array/intersection.mjs +1 -1
- package/dist/array/last.mjs +11 -3
- package/dist/array/partition.mjs +23 -3
- package/dist/array/push.mjs +1 -1
- package/dist/array/select.mjs +39 -7
- package/dist/array/single.mjs +8 -5
- package/dist/array/sort.mjs +1 -1
- package/dist/array/splice.mjs +1 -1
- package/dist/array/swap.mjs +1 -1
- package/dist/array/union.mjs +1 -1
- package/dist/array/unique.mjs +17 -3
- package/dist/beacon.d.mts +3 -11
- package/dist/beacon.mjs +10 -20
- package/dist/color/constants.d.mts +1 -5
- package/dist/color/constants.mjs +2 -9
- package/dist/color/index.mjs +3 -3
- package/dist/color/instance.mjs +4 -6
- package/dist/color/misc/get.mjs +1 -1
- package/dist/color/misc/is.d.mts +0 -8
- package/dist/color/misc/is.mjs +3 -14
- package/dist/color/misc/state.mjs +3 -3
- package/dist/color/space/hex.mjs +1 -1
- package/dist/color/space/hsl.mjs +1 -1
- package/dist/color/space/hwb.mjs +2 -2
- package/dist/function/limit.d.mts +1 -1
- package/dist/function/limit.mjs +1 -1
- package/dist/function/once.d.mts +1 -1
- package/dist/function/once.mjs +7 -7
- package/dist/function/retry.d.mts +1 -1
- package/dist/function/retry.mjs +10 -10
- package/dist/herald.d.mts +2 -2
- package/dist/herald.mjs +1 -1
- package/dist/index.d.mts +80 -91
- package/dist/index.mjs +352 -334
- package/dist/internal/array/callbacks.d.mts +1 -1
- package/dist/internal/array/find.d.mts +2 -6
- package/dist/internal/array/find.mjs +30 -122
- package/dist/internal/array/index-of.mjs +9 -3
- package/dist/internal/array/insert.mjs +1 -1
- package/dist/internal/array/match.d.mts +1 -1
- package/dist/internal/array/match.mjs +1 -1
- package/dist/internal/array/sets.mjs +4 -4
- package/dist/internal/function/assert.d.mts +1 -1
- package/dist/internal/function/limit.d.mts +1 -1
- package/dist/internal/function/limit.mjs +7 -7
- package/dist/internal/function/memoize.d.mts +1 -1
- package/dist/internal/function/memoize.mjs +3 -3
- package/dist/internal/function/work.d.mts +1 -1
- package/dist/internal/function/work.mjs +1 -1
- package/dist/internal/herald.d.mts +2 -10
- package/dist/internal/herald.mjs +8 -31
- package/dist/internal/math/aggregate.mjs +1 -1
- package/dist/internal/number.mjs +1 -1
- package/dist/internal/plan/index.mjs +1 -1
- package/dist/internal/plan/plan.generate.mjs +67 -21
- package/dist/internal/sized/map.d.mts +3 -0
- package/dist/internal/sized/map.mjs +3 -0
- package/dist/internal/string/case.mjs +2 -2
- package/dist/internal/string/misc.mjs +1 -1
- package/dist/internal/subscription.mjs +15 -27
- package/dist/internal/value/compare.mjs +1 -1
- package/dist/internal/value/equal.d.mts +1 -1
- package/dist/internal/value/equal.mjs +2 -2
- package/dist/internal/value/set.mjs +1 -1
- package/dist/is.mjs +1 -1
- package/dist/logger.mjs +6 -5
- package/dist/math.mjs +1 -1
- package/dist/models/array/array.misc.model.d.mts +12 -1
- package/dist/models/array/array.misc.model.mjs +2 -1
- package/dist/models/beacon.model.d.mts +4 -4
- package/dist/models/beacon.model.mjs +2 -8
- package/dist/models/color.model.d.mts +2 -2
- package/dist/models/function/limiter.model.d.mts +1 -1
- package/dist/models/function/limiter.model.mjs +1 -2
- package/dist/models/function/memoize.model.d.mts +1 -1
- package/dist/models/function/once.model.d.mts +0 -1
- package/dist/models/function/once.model.mjs +2 -3
- package/dist/models/function/work.model.d.mts +1 -1
- package/dist/models/herald.model.d.mts +8 -5
- package/dist/models/herald.model.mjs +2 -8
- package/dist/models/logger.model.d.mts +0 -1
- package/dist/models/logger.model.mjs +2 -3
- package/dist/models/plan.model.d.mts +35 -35
- package/dist/models/promise.model.d.mts +7 -7
- package/dist/models/promise.model.mjs +3 -3
- package/dist/models/queue.model.d.mts +0 -1
- package/dist/models/queue.model.mjs +2 -3
- package/dist/models/string/string.fuzzy.model.d.mts +0 -1
- package/dist/models/string/string.fuzzy.model.mjs +2 -3
- package/dist/models/subscription.model.d.mts +3 -20
- package/dist/models/subscription.model.mjs +2 -3
- package/dist/plan/index.mjs +1 -1
- package/dist/plan/misc.mjs +1 -1
- package/dist/plan/models.d.mts +2 -2
- package/dist/plan/result.d.mts +7 -7
- package/dist/plan/result.mjs +1 -1
- package/dist/plan/run.d.mts +7 -7
- package/dist/plan/run.mjs +1 -1
- package/dist/plan/use.mjs +13 -7
- package/dist/promise/delay.mjs +1 -1
- package/dist/promise/helpers.mjs +1 -1
- package/dist/promise/index.mjs +4 -4
- package/dist/promise/misc.d.mts +1 -1
- package/dist/promise/misc.mjs +1 -1
- package/dist/promise/models.d.mts +2 -2
- package/dist/promise/models.mjs +1 -1
- package/dist/promise/timed.mjs +3 -3
- package/dist/query.mjs +1 -1
- package/dist/queue.mjs +10 -10
- package/dist/random.mjs +1 -1
- package/dist/result/work/flow.mjs +1 -1
- package/dist/result/work/pipe.mjs +1 -1
- package/dist/sized/set.d.mts +3 -0
- package/dist/sized/set.mjs +3 -0
- package/dist/string/fuzzy.mjs +4 -5
- package/dist/string/index.mjs +1 -1
- package/dist/string/match.mjs +1 -1
- package/dist/string/normalize.mjs +2 -2
- package/dist/subscription.d.mts +2 -2
- package/dist/value/clone.d.mts +1 -1
- package/dist/value/clone.mjs +1 -1
- package/dist/value/freeze.mjs +1 -1
- package/dist/value/handle.mjs +1 -1
- package/dist/value/smush.mjs +1 -1
- package/package.json +6 -6
- package/dist/models/array/array.find.model.d.mts +0 -46
- package/dist/models/array/array.find.model.mjs +0 -7
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SUBSCRIPTION_DISALLOWED_KEY, SUBSCRIPTION_INVALID_KEY, SUBSCRIPTION_INVALID_VALUE, SUBSCRIPTION_NAME, SUBSCRIPTION_PROPERTY, SUBSCRIPTION_STORE, SUBSCRIPTION_SYMBOL } from "../models/subscription.model.mjs";
|
|
1
|
+
import { SUBSCRIPTION_DISALLOWED_KEY, SUBSCRIPTION_INVALID_KEY, SUBSCRIPTION_INVALID_VALUE, SUBSCRIPTION_NAME, SUBSCRIPTION_STORE, SUBSCRIPTION_SYMBOL } from "../models/subscription.model.mjs";
|
|
3
2
|
import { createAborter } from "./aborter.mjs";
|
|
3
|
+
import { isKey, isPlainObject } from "./is.mjs";
|
|
4
4
|
// src/internal/subscription.ts
|
|
5
|
-
function Subscription(state,
|
|
5
|
+
function Subscription(state, parameters) {
|
|
6
6
|
this[SUBSCRIPTION_SYMBOL] = state;
|
|
7
|
-
this[property.key] = property.value;
|
|
8
7
|
state.aborter = createAborter(parameters.signal, () => this.unsubscribe(subscriptions, this, state));
|
|
9
8
|
addSubscription(this);
|
|
10
9
|
}
|
|
11
|
-
Subscription.prototype[SUBSCRIPTION_PROPERTY] = SUBSCRIPTION_NAME;
|
|
12
10
|
Subscription.prototype.unsubscribe = removeSubscription;
|
|
13
11
|
Object.defineProperty(Subscription.prototype, "active", {
|
|
14
12
|
enumerable: true,
|
|
15
13
|
get: getSubscriptionActive
|
|
16
14
|
});
|
|
17
15
|
function Subscriptions(parameters) {
|
|
18
|
-
const { keys
|
|
19
|
-
this[SUBSCRIPTION_SYMBOL] = createSubscriptionsState(
|
|
16
|
+
const { keys } = createSubscriptionsParameters(parameters);
|
|
17
|
+
this[SUBSCRIPTION_SYMBOL] = createSubscriptionsState(keys);
|
|
20
18
|
}
|
|
21
|
-
Subscriptions.prototype[SUBSCRIPTION_PROPERTY] = SUBSCRIPTION_STORE;
|
|
22
19
|
Subscriptions.prototype.clear = clearSubscriptions;
|
|
23
20
|
Subscriptions.prototype.create = createSubscription;
|
|
24
21
|
Object.defineProperties(Subscriptions.prototype, {
|
|
@@ -74,7 +71,8 @@ function createSubscription(params) {
|
|
|
74
71
|
const state = {
|
|
75
72
|
parameters,
|
|
76
73
|
subscriptions,
|
|
77
|
-
active: true
|
|
74
|
+
active: true,
|
|
75
|
+
name: SUBSCRIPTION_NAME
|
|
78
76
|
};
|
|
79
77
|
const existing = getExistingSubscription(subscriptions, state);
|
|
80
78
|
if (existing != null) return [existing, true];
|
|
@@ -82,7 +80,7 @@ function createSubscription(params) {
|
|
|
82
80
|
if (subscriptions.keys === false) throw new Error(SUBSCRIPTION_DISALLOWED_KEY);
|
|
83
81
|
else if (subscriptions.keys !== true && !subscriptions.keys.has(parameters.key)) throw new Error(SUBSCRIPTION_INVALID_KEY);
|
|
84
82
|
}
|
|
85
|
-
return [new Subscription(state,
|
|
83
|
+
return [new Subscription(state, parameters), false];
|
|
86
84
|
}
|
|
87
85
|
function getExistingSubscription(subscriptions, state) {
|
|
88
86
|
const { values } = subscriptions;
|
|
@@ -114,26 +112,16 @@ function createSubscriptionsParameters(input) {
|
|
|
114
112
|
let keys;
|
|
115
113
|
if (values.keys instanceof Set) keys = values.keys;
|
|
116
114
|
else keys = typeof values.keys === "boolean" ? values.keys : false;
|
|
117
|
-
return {
|
|
118
|
-
keys,
|
|
119
|
-
property: createSubscriptionsProperty(values.property)
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
function createSubscriptionsProperty(input) {
|
|
123
|
-
const values = isPlainObject(input) ? input : {};
|
|
124
|
-
return {
|
|
125
|
-
key: typeof values.key === "string" ? values.key : SUBSCRIPTION_PROPERTY,
|
|
126
|
-
value: values.value ?? "subscription"
|
|
127
|
-
};
|
|
115
|
+
return { keys };
|
|
128
116
|
}
|
|
129
|
-
function createSubscriptionsState(
|
|
117
|
+
function createSubscriptionsState(keys) {
|
|
130
118
|
return {
|
|
131
119
|
keys,
|
|
132
|
-
property,
|
|
133
120
|
items: {
|
|
134
121
|
any: /* @__PURE__ */ new Set(),
|
|
135
122
|
keyed: keys === false ? void 0 : /* @__PURE__ */ new Map()
|
|
136
123
|
},
|
|
124
|
+
name: SUBSCRIPTION_STORE,
|
|
137
125
|
values: {
|
|
138
126
|
from: {
|
|
139
127
|
any: /* @__PURE__ */ new Map(),
|
|
@@ -153,10 +141,10 @@ function createSubscriptionsState(property, keys) {
|
|
|
153
141
|
* @returns `true` if the value is a subscription, otherwise `false`
|
|
154
142
|
*/
|
|
155
143
|
function isSubscription(value) {
|
|
156
|
-
return isSubscriptionInstance(
|
|
144
|
+
return isSubscriptionInstance(SUBSCRIPTION_NAME, value);
|
|
157
145
|
}
|
|
158
|
-
function isSubscriptionInstance(
|
|
159
|
-
return typeof value === "object" && value !== null &&
|
|
146
|
+
function isSubscriptionInstance(type, value) {
|
|
147
|
+
return typeof value === "object" && value !== null && SUBSCRIPTION_SYMBOL in value && value[SUBSCRIPTION_SYMBOL].name === type;
|
|
160
148
|
}
|
|
161
149
|
/**
|
|
162
150
|
* Is the value a subscriptions store?
|
|
@@ -165,7 +153,7 @@ function isSubscriptionInstance(value, name) {
|
|
|
165
153
|
* @returns `true` if the value is a subscriptions store, otherwise `false`
|
|
166
154
|
*/
|
|
167
155
|
function isSubscriptions(value) {
|
|
168
|
-
return isSubscriptionInstance(
|
|
156
|
+
return isSubscriptionInstance(SUBSCRIPTION_STORE, value);
|
|
169
157
|
}
|
|
170
158
|
function removeFromStore(items, values, subscription, value, key) {
|
|
171
159
|
items.delete(subscription);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { max } from "../math/aggregate.mjs";
|
|
2
1
|
import { COMPARE_NAME } from "../../models/value/value.misc.model.mjs";
|
|
2
|
+
import { max } from "../math/aggregate.mjs";
|
|
3
3
|
import { getString, words } from "../string/misc.mjs";
|
|
4
4
|
import { createCompareHandler } from "./handlers.mjs";
|
|
5
5
|
// src/internal/value/compare.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Constructor } from "../../models/index.mjs";
|
|
2
|
-
import { CompareHandler } from "../../models/value/value.handler.model.mjs";
|
|
3
2
|
import { EqualOptions, Equalizer, EqualizerOptions } from "../../models/value/value.equal.model.mjs";
|
|
3
|
+
import { CompareHandler } from "../../models/value/value.handler.model.mjs";
|
|
4
4
|
declare function Equalizer(this: any, options: EqualizerOptions): void;
|
|
5
5
|
/**
|
|
6
6
|
* Deregister a equality comparison handler for a specific class
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { EQUAL_ERROR_PROPERTIES, EQUAL_EXPRESSION_PROPERTIES, EQUAL_SYMBOL } from "../../models/value/value.equal.model.mjs";
|
|
1
2
|
import { isNonPlainObject, isPlainObject, isPrimitive, isTypedArray } from "../is.mjs";
|
|
2
|
-
import { round } from "../math/misc.mjs";
|
|
3
3
|
import { min } from "../math/aggregate.mjs";
|
|
4
|
+
import { round } from "../math/misc.mjs";
|
|
4
5
|
import { createCompareHandler } from "./handlers.mjs";
|
|
5
|
-
import { EQUAL_ERROR_PROPERTIES, EQUAL_EXPRESSION_PROPERTIES, EQUAL_SYMBOL } from "../../models/value/value.equal.model.mjs";
|
|
6
6
|
// src/internal/value/equal.ts
|
|
7
7
|
function Equalizer(options) {
|
|
8
8
|
this[EQUAL_SYMBOL] = options;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { EXPRESSION_INTEGER } from "../../models/misc.model.mjs";
|
|
1
2
|
import { unwrap } from "../result/misc.mjs";
|
|
2
3
|
import { getPaths, handleValue } from "./misc.mjs";
|
|
3
|
-
import { EXPRESSION_INTEGER } from "../../models/misc.model.mjs";
|
|
4
4
|
// src/internal/value/set.ts
|
|
5
5
|
function setValue(data, path, value, ignoreCase) {
|
|
6
6
|
if (typeof data !== "object" || data === null || typeof path !== "string" || path.trim().length === 0) return data;
|
package/dist/is.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTemplateStringsArray, isTypedArray } from "./internal/is.mjs";
|
|
2
1
|
import { getArray } from "./internal/array/get.mjs";
|
|
2
|
+
import { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTemplateStringsArray, isTypedArray } from "./internal/is.mjs";
|
|
3
3
|
import { getString } from "./internal/string/misc.mjs";
|
|
4
4
|
import { EXPRESSION_WHITESPACE_ONLY } from "./models/misc.model.mjs";
|
|
5
5
|
// src/is.ts
|
package/dist/logger.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { noop } from "./internal/function/misc.mjs";
|
|
2
2
|
import { getString } from "./internal/string/misc.mjs";
|
|
3
|
-
import { LOGGER_NAME, LOGGER_NAME_TIMED,
|
|
3
|
+
import { LOGGER_NAME, LOGGER_NAME_TIMED, LOGGER_SYMBOL } from "./models/logger.model.mjs";
|
|
4
4
|
// src/logger.ts
|
|
5
|
-
function Lumberjack() {
|
|
6
|
-
|
|
5
|
+
function Lumberjack() {
|
|
6
|
+
this[LOGGER_SYMBOL] = { name: LOGGER_NAME };
|
|
7
|
+
}
|
|
7
8
|
Lumberjack.prototype.time = getTimeLogger;
|
|
8
9
|
Object.defineProperties(Lumberjack.prototype, {
|
|
9
10
|
debug: { get: getLoggerCallback.bind("debug") },
|
|
@@ -23,6 +24,7 @@ Object.defineProperties(Lumberjack.prototype, {
|
|
|
23
24
|
function TimeLogger(label) {
|
|
24
25
|
this[LOGGER_SYMBOL] = {
|
|
25
26
|
label,
|
|
27
|
+
name: LOGGER_NAME_TIMED,
|
|
26
28
|
started: enabled,
|
|
27
29
|
stopped: false
|
|
28
30
|
};
|
|
@@ -31,7 +33,6 @@ function TimeLogger(label) {
|
|
|
31
33
|
};
|
|
32
34
|
if (this[LOGGER_SYMBOL].started) console.time(label);
|
|
33
35
|
}
|
|
34
|
-
TimeLogger.prototype[LOGGER_PROPERTY] = LOGGER_NAME_TIMED;
|
|
35
36
|
Object.defineProperties(TimeLogger.prototype, {
|
|
36
37
|
active: {
|
|
37
38
|
enumerable: true,
|
|
@@ -74,7 +75,7 @@ function isLogger(value) {
|
|
|
74
75
|
return isLoggerInstance(LOGGER_NAME, value);
|
|
75
76
|
}
|
|
76
77
|
function isLoggerInstance(name, value) {
|
|
77
|
-
return typeof value === "object" && value !== null &&
|
|
78
|
+
return typeof value === "object" && value !== null && LOGGER_SYMBOL in value && value[LOGGER_SYMBOL].name === name;
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
81
|
* Is the value a _TimeLogger_?
|
package/dist/math.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNumber } from "./internal/is.mjs";
|
|
2
|
+
import { aggregate, getAggregateCallback, getAggregated, max, min } from "./internal/math/aggregate.mjs";
|
|
2
3
|
import { floor, round, roundNumber } from "./internal/math/misc.mjs";
|
|
3
4
|
import { AGGREGATION_AVERAGE } from "./models/math.model.mjs";
|
|
4
|
-
import { aggregate, getAggregateCallback, getAggregated, max, min } from "./internal/math/aggregate.mjs";
|
|
5
5
|
// src/math.ts
|
|
6
6
|
function average(array, key) {
|
|
7
7
|
const aggregated = aggregate(AGGREGATION_AVERAGE, array, key);
|
|
@@ -5,6 +5,16 @@ export type ArrayCompareSetsType = "difference" | "intersection" | "union";
|
|
|
5
5
|
*/
|
|
6
6
|
export type ArrayComparison = "end" | "inside" | "invalid" | "outside" | "same" | "start";
|
|
7
7
|
export type ArrayExtractType = "drop" | "take";
|
|
8
|
+
export type ArrayFindParameters = {
|
|
9
|
+
bare?: boolean;
|
|
10
|
+
indiced?: boolean;
|
|
11
|
+
input: unknown[];
|
|
12
|
+
limit?: number;
|
|
13
|
+
reverse?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type ArrayFindResult = {
|
|
16
|
+
values: unknown[];
|
|
17
|
+
};
|
|
8
18
|
export type ArrayFlattened<Value> = Value extends ReadonlyArray<infer Inner> ? Inner : Value;
|
|
9
19
|
export type ArrayGetCallbacks = {
|
|
10
20
|
bool?: GenericCallback;
|
|
@@ -29,4 +39,5 @@ export declare const ARRAY_SETS_COMPARE_DIFFERENCE: ArrayCompareSetsType;
|
|
|
29
39
|
export declare const ARRAY_SETS_COMPARE_INTERSECTION: ArrayCompareSetsType;
|
|
30
40
|
export declare const ARRAY_SETS_COMPARE_UNION: ArrayCompareSetsType;
|
|
31
41
|
export declare const ARRAY_SLICE_DROP: ArrayExtractType;
|
|
32
|
-
export declare const ARRAY_SLICE_TAKE: ArrayExtractType;
|
|
42
|
+
export declare const ARRAY_SLICE_TAKE: ArrayExtractType;
|
|
43
|
+
export declare const ARRAY_UNIQUE_THRESHOLD = 100;
|
|
@@ -8,4 +8,5 @@ const ARRAY_SETS_COMPARE_INTERSECTION = "intersection";
|
|
|
8
8
|
const ARRAY_SETS_COMPARE_UNION = "union";
|
|
9
9
|
const ARRAY_SLICE_DROP = "drop";
|
|
10
10
|
const ARRAY_SLICE_TAKE = "take";
|
|
11
|
-
|
|
11
|
+
const ARRAY_UNIQUE_THRESHOLD = 100;
|
|
12
|
+
export { ARRAY_CHUNK_MAX_SIZE, ARRAY_INSERT_TYPE_INSERT, ARRAY_INSERT_TYPE_PUSH, ARRAY_INSERT_TYPE_SPLICE, ARRAY_SETS_COMPARE_DIFFERENCE, ARRAY_SETS_COMPARE_INTERSECTION, ARRAY_SETS_COMPARE_UNION, ARRAY_SLICE_DROP, ARRAY_SLICE_TAKE, ARRAY_UNIQUE_THRESHOLD };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Subscription,
|
|
1
|
+
import { Subscription, Subscriptions } from "./subscription.model.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* A beacon is a lighthouse, holding an observable value that can be subscribed to and emitted from
|
|
4
4
|
*/
|
|
@@ -54,6 +54,7 @@ export type BeaconState<Value> = {
|
|
|
54
54
|
observable?: Observable<Value>;
|
|
55
55
|
options: Required<BeaconOptions<Value>>;
|
|
56
56
|
subscriptions?: Subscriptions<Observer<unknown>>;
|
|
57
|
+
name: typeof BEACON_NAME;
|
|
57
58
|
value: Value;
|
|
58
59
|
};
|
|
59
60
|
export type InternalBeacon = {
|
|
@@ -91,6 +92,7 @@ export type Observable<Value> = {
|
|
|
91
92
|
export type ObservableState<Value> = {
|
|
92
93
|
active: boolean;
|
|
93
94
|
beacon: BeaconState<Value>;
|
|
95
|
+
name: typeof BEACON_OBSERVABLE;
|
|
94
96
|
};
|
|
95
97
|
export type Observer<Value> = {
|
|
96
98
|
/**
|
|
@@ -108,10 +110,8 @@ export type Observer<Value> = {
|
|
|
108
110
|
};
|
|
109
111
|
export declare const BEACON_MESSAGE_RETRIEVE = "Cannot retrieve observable from a closed beacon";
|
|
110
112
|
export declare const BEACON_MESSAGE_SUBSCRIBE = "Cannot subscribe to a closed observable";
|
|
111
|
-
export declare const BEACON_PROPERTY = "$beacon";
|
|
112
113
|
export declare const BEACON_NAME = "beacon";
|
|
113
114
|
export declare const BEACON_OBSERVABLE = "observable";
|
|
114
115
|
export declare const BEACON_SYMBOL: unique symbol;
|
|
115
116
|
export declare const BEACON_TYPE_ERROR = "error";
|
|
116
|
-
export declare const BEACON_TYPE_NEXT = "next";
|
|
117
|
-
export declare const beaconSubscription: SubscriptionProperty;
|
|
117
|
+
export declare const BEACON_TYPE_NEXT = "next";
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { SUBSCRIPTION_NAME } from "./subscription.model.mjs";
|
|
2
1
|
// src/models/beacon.model.ts
|
|
3
2
|
const BEACON_MESSAGE_RETRIEVE = "Cannot retrieve observable from a closed beacon";
|
|
4
3
|
const BEACON_MESSAGE_SUBSCRIBE = "Cannot subscribe to a closed observable";
|
|
5
|
-
const BEACON_PROPERTY = "$beacon";
|
|
6
4
|
const BEACON_NAME = "beacon";
|
|
7
5
|
const BEACON_OBSERVABLE = "observable";
|
|
8
|
-
const BEACON_SYMBOL = Symbol(
|
|
6
|
+
const BEACON_SYMBOL = Symbol("beacon");
|
|
9
7
|
const BEACON_TYPE_ERROR = "error";
|
|
10
8
|
const BEACON_TYPE_NEXT = "next";
|
|
11
|
-
|
|
12
|
-
key: BEACON_PROPERTY,
|
|
13
|
-
value: SUBSCRIPTION_NAME
|
|
14
|
-
};
|
|
15
|
-
export { BEACON_MESSAGE_RETRIEVE, BEACON_MESSAGE_SUBSCRIBE, BEACON_NAME, BEACON_OBSERVABLE, BEACON_PROPERTY, BEACON_SYMBOL, BEACON_TYPE_ERROR, BEACON_TYPE_NEXT, beaconSubscription };
|
|
9
|
+
export { BEACON_MESSAGE_RETRIEVE, BEACON_MESSAGE_SUBSCRIBE, BEACON_NAME, BEACON_OBSERVABLE, BEACON_SYMBOL, BEACON_TYPE_ERROR, BEACON_TYPE_NEXT };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Subscription } from "./subscription.model.mjs";
|
|
2
|
-
import { Herald, HeraldEvents } from "./herald.model.mjs";
|
|
3
1
|
import { COLOR_SYMBOL } from "../color/constants.mjs";
|
|
2
|
+
import { Herald, HeraldEvents } from "./herald.model.mjs";
|
|
3
|
+
import { Subscription } from "./subscription.model.mjs";
|
|
4
4
|
export type Alpha = {
|
|
5
5
|
hex: string;
|
|
6
6
|
value: number;
|
|
@@ -50,6 +50,7 @@ export type Limiter<Callback extends GenericCallback> = {
|
|
|
50
50
|
export type LimiterState<Callback = GenericCallback> = {
|
|
51
51
|
callback: Callback;
|
|
52
52
|
interval: number;
|
|
53
|
+
name: string;
|
|
53
54
|
parameters: unknown[];
|
|
54
55
|
start?: number;
|
|
55
56
|
throttle: boolean;
|
|
@@ -60,7 +61,6 @@ export type LimiterType = "debounce" | "throttle" | "wait";
|
|
|
60
61
|
export declare const LIMITER_DEBOUNCE: LimiterType;
|
|
61
62
|
export declare const LIMITER_NAME_ASYNC = "asyncLimiter";
|
|
62
63
|
export declare const LIMITER_NAME_SYNC = "limiter";
|
|
63
|
-
export declare const LIMITER_PROPERTY = "$limiter";
|
|
64
64
|
export declare const LIMITER_OFFSET = 5;
|
|
65
65
|
export declare const LIMITER_SYMBOL: unique symbol;
|
|
66
66
|
export declare const LIMITER_THROTTLE: LimiterType;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
const LIMITER_DEBOUNCE = "debounce";
|
|
3
3
|
const LIMITER_NAME_ASYNC = "asyncLimiter";
|
|
4
4
|
const LIMITER_NAME_SYNC = "limiter";
|
|
5
|
-
const LIMITER_PROPERTY = "$limiter";
|
|
6
5
|
const LIMITER_OFFSET = 5;
|
|
7
6
|
const LIMITER_SYMBOL = Symbol("limiter");
|
|
8
7
|
const LIMITER_THROTTLE = "throttle";
|
|
@@ -11,4 +10,4 @@ const LIMITER_WAIT = "wait";
|
|
|
11
10
|
const clearTimer = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : clearTimeout;
|
|
12
11
|
// istanbul ignore next
|
|
13
12
|
const startTimer = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout;
|
|
14
|
-
export { LIMITER_DEBOUNCE, LIMITER_NAME_ASYNC, LIMITER_NAME_SYNC, LIMITER_OFFSET,
|
|
13
|
+
export { LIMITER_DEBOUNCE, LIMITER_NAME_ASYNC, LIMITER_NAME_SYNC, LIMITER_OFFSET, LIMITER_SYMBOL, LIMITER_THROTTLE, LIMITER_WAIT, clearTimer, startTimer };
|
|
@@ -68,7 +68,6 @@ export type OnceState<Value, Callback = GenericCallback> = {
|
|
|
68
68
|
};
|
|
69
69
|
export declare const ONCE_NAME_ASYNC = "asyncOnce";
|
|
70
70
|
export declare const ONCE_NAME_SYNC = "once";
|
|
71
|
-
export declare const ONCE_PROPERTY = "$once";
|
|
72
71
|
export declare const ONCE_MESSAGE_CLEARED = "Once has been cleared";
|
|
73
72
|
export declare const ONCE_MESSAGE_EXPECTATION = "Once expected a function";
|
|
74
73
|
export declare const ONCE_SYMBOL: unique symbol;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// src/models/function/once.model.ts
|
|
2
2
|
const ONCE_NAME_ASYNC = "asyncOnce";
|
|
3
3
|
const ONCE_NAME_SYNC = "once";
|
|
4
|
-
const ONCE_PROPERTY = "$once";
|
|
5
4
|
const ONCE_MESSAGE_CLEARED = "Once has been cleared";
|
|
6
5
|
const ONCE_MESSAGE_EXPECTATION = "Once expected a function";
|
|
7
|
-
const ONCE_SYMBOL = Symbol(
|
|
8
|
-
export { ONCE_MESSAGE_CLEARED, ONCE_MESSAGE_EXPECTATION, ONCE_NAME_ASYNC, ONCE_NAME_SYNC,
|
|
6
|
+
const ONCE_SYMBOL = Symbol("once");
|
|
7
|
+
export { ONCE_MESSAGE_CLEARED, ONCE_MESSAGE_EXPECTATION, ONCE_NAME_ASYNC, ONCE_NAME_SYNC, ONCE_SYMBOL };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GenericCallback } from "../index.mjs";
|
|
2
|
-
import { Asserter } from "./assert.model.mjs";
|
|
3
2
|
import { UnwrapValue } from "../result.model.mjs";
|
|
3
|
+
import { Asserter } from "./assert.model.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* An asynchronous _Flow_, a function that pipes a value through a series of functions
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GenericCallback } from "./index.mjs";
|
|
2
|
-
import { Subscription,
|
|
2
|
+
import { Subscription, Subscriptions } from "./subscription.model.mjs";
|
|
3
3
|
export type Herald<Events extends Record<string, GenericCallback>> = {
|
|
4
4
|
readonly events: HeraldEvents<Events>;
|
|
5
5
|
/**
|
|
@@ -34,7 +34,6 @@ export type HeraldEvents<Events extends Record<string, GenericCallback>> = { [Ke
|
|
|
34
34
|
export type HeraldOnCreate<Events extends Record<string, GenericCallback>> = <Event extends keyof Events>(event: Event, callback: Events[Event], subscription: Subscription) => void;
|
|
35
35
|
export type HeraldOptions<Events extends Record<string, GenericCallback>> = {
|
|
36
36
|
names: Array<keyof Events>;
|
|
37
|
-
property?: SubscriptionProperty;
|
|
38
37
|
onCreate?: HeraldOnCreate<Events>;
|
|
39
38
|
};
|
|
40
39
|
export type HeraldState = {
|
|
@@ -45,14 +44,18 @@ export type HeraldState = {
|
|
|
45
44
|
export type InternalHerald = {
|
|
46
45
|
[HERALD_SYMBOL]: {
|
|
47
46
|
events: HeraldEvents<Record<string, GenericCallback>>;
|
|
47
|
+
name: typeof HERALD_NAME_HERALD;
|
|
48
48
|
state: HeraldState;
|
|
49
49
|
};
|
|
50
50
|
} & Herald<Record<string, GenericCallback>>;
|
|
51
|
+
export type InternalHeraldEvents = {
|
|
52
|
+
[HERALD_SYMBOL]: {
|
|
53
|
+
name: typeof HERALD_NAME_EVENTS;
|
|
54
|
+
};
|
|
55
|
+
} & HeraldEvents<Record<string, GenericCallback>>;
|
|
51
56
|
export declare const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
52
57
|
export declare const HERALD_MESSAGE_ONCREATE = "Herald requires a valid onCreate callback for subscription creation";
|
|
53
58
|
export declare const HERALD_MESSAGE_PROPERTY = "Herald requires valid property information for subscription identification";
|
|
54
59
|
export declare const HERALD_NAME_EVENTS = "events";
|
|
55
60
|
export declare const HERALD_NAME_HERALD = "herald";
|
|
56
|
-
export declare const
|
|
57
|
-
export declare const HERALD_SYMBOL: unique symbol;
|
|
58
|
-
export declare const heraldSubscription: SubscriptionProperty;
|
|
61
|
+
export declare const HERALD_SYMBOL: unique symbol;
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { SUBSCRIPTION_NAME } from "./subscription.model.mjs";
|
|
2
1
|
// src/models/herald.model.ts
|
|
3
2
|
const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
4
3
|
const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
|
|
5
4
|
const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
|
|
6
5
|
const HERALD_NAME_EVENTS = "events";
|
|
7
6
|
const HERALD_NAME_HERALD = "herald";
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const heraldSubscription = {
|
|
11
|
-
key: HERALD_PROPERTY,
|
|
12
|
-
value: SUBSCRIPTION_NAME
|
|
13
|
-
};
|
|
14
|
-
export { HERALD_MESSAGE_ARRAY, HERALD_MESSAGE_ONCREATE, HERALD_MESSAGE_PROPERTY, HERALD_NAME_EVENTS, HERALD_NAME_HERALD, HERALD_PROPERTY, HERALD_SYMBOL, heraldSubscription };
|
|
7
|
+
const HERALD_SYMBOL = Symbol("herald");
|
|
8
|
+
export { HERALD_MESSAGE_ARRAY, HERALD_MESSAGE_ONCREATE, HERALD_MESSAGE_PROPERTY, HERALD_NAME_EVENTS, HERALD_NAME_HERALD, HERALD_SYMBOL };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/models/logger.model.ts
|
|
2
2
|
const LOGGER_NAME = "Logger";
|
|
3
3
|
const LOGGER_NAME_TIMED = "TimedLogger";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
export { LOGGER_NAME, LOGGER_NAME_TIMED, LOGGER_PROPERTY, LOGGER_SYMBOL };
|
|
4
|
+
const LOGGER_SYMBOL = Symbol("logger");
|
|
5
|
+
export { LOGGER_NAME, LOGGER_NAME_TIMED, LOGGER_SYMBOL };
|
|
@@ -10,6 +10,10 @@ export type AsyncFailure<Value> = {
|
|
|
10
10
|
*/
|
|
11
11
|
[Symbol.asyncIterator]: () => AsyncGenerator<Err<Value>, never>;
|
|
12
12
|
};
|
|
13
|
+
export type AsyncImmediateState = {
|
|
14
|
+
generator: () => AsyncGenerator;
|
|
15
|
+
type: typeof PLAN_FAILURE_ASYNC | typeof PLAN_SUCCESS_ASYNC;
|
|
16
|
+
};
|
|
13
17
|
/**
|
|
14
18
|
* An asynchronous plan of execution that can yield intermediate results and eventually return a result
|
|
15
19
|
*/
|
|
@@ -27,23 +31,19 @@ export type AsyncPlan<Yielded, Returned, Parameters extends unknown[]> = {
|
|
|
27
31
|
*
|
|
28
32
|
* @returns Attempted result
|
|
29
33
|
*/
|
|
30
|
-
attempt: Parameters extends [infer _, ...(infer _)[]] ? (parameters: Parameters, signal?: AbortSignal) => Promise<Result<
|
|
34
|
+
attempt: Parameters extends [infer _, ...(infer _)[]] ? (parameters: Parameters, signal?: AbortSignal) => Promise<Result<PlannedOk<Returned>, PlannedError<Yielded, Returned>>> : (signal?: AbortSignal) => Promise<Result<PlannedOk<Returned>, PlannedError<Yielded, Returned>>>;
|
|
31
35
|
/**
|
|
32
36
|
* Run the plan to completion
|
|
33
37
|
*
|
|
34
|
-
* @throws {
|
|
38
|
+
* @throws {PlannedError<Yielded, Returned>}
|
|
35
39
|
* @returns Result
|
|
36
40
|
*/
|
|
37
|
-
run: Parameters extends [infer _, ...(infer _)[]] ? (parameters: Parameters, signal?: AbortSignal) => Promise<
|
|
41
|
+
run: Parameters extends [infer _, ...(infer _)[]] ? (parameters: Parameters, signal?: AbortSignal) => Promise<PlannedReturned<Returned>> : (signal?: AbortSignal) => Promise<PlannedReturned<Returned>>;
|
|
38
42
|
};
|
|
39
43
|
/**
|
|
40
44
|
* An immediately succeeding or failing asynchronous plan
|
|
41
45
|
*/
|
|
42
|
-
export type
|
|
43
|
-
export type AsyncPlannedState = {
|
|
44
|
-
generator: () => AsyncGenerator;
|
|
45
|
-
type: typeof PLAN_FAILURE_ASYNC | typeof PLAN_SUCCESS_ASYNC;
|
|
46
|
-
};
|
|
46
|
+
export type AsyncImmediate<Value, Error> = AsyncSuccess<Value> | AsyncFailure<Error>;
|
|
47
47
|
export type AsyncPlanState = {
|
|
48
48
|
generator(...parameters: unknown[]): AsyncGenerator;
|
|
49
49
|
type: typeof PLAN_TYPE_ASYNC;
|
|
@@ -101,10 +101,19 @@ export type GenericPlanItem = {
|
|
|
101
101
|
};
|
|
102
102
|
export type GenericPlanItemState = {
|
|
103
103
|
generator: () => AsyncGenerator | Generator;
|
|
104
|
-
type: PlanType |
|
|
104
|
+
type: PlanType | ImmediateType | StepType;
|
|
105
105
|
};
|
|
106
|
+
/**
|
|
107
|
+
* An immediately succeeding or failing plan
|
|
108
|
+
*/
|
|
109
|
+
export type Immediate<Value, Error> = Success<Value> | Failure<Error>;
|
|
110
|
+
export type ImmediateState = {
|
|
111
|
+
generator: () => Generator;
|
|
112
|
+
type: typeof PLAN_FAILURE_SYNC | typeof PLAN_SUCCESS_SYNC;
|
|
113
|
+
};
|
|
114
|
+
export type ImmediateType = "asyncFailure" | "asyncSuccess" | "failure" | "success";
|
|
106
115
|
export type InternalAsyncFailure = {
|
|
107
|
-
[PLAN_SYMBOL]:
|
|
116
|
+
[PLAN_SYMBOL]: AsyncImmediateState;
|
|
108
117
|
} & AsyncFailure<never>;
|
|
109
118
|
export type InternalAsyncPlan = {
|
|
110
119
|
[PLAN_SYMBOL]: AsyncPlanState;
|
|
@@ -113,16 +122,16 @@ export type InternalAsyncStep = {
|
|
|
113
122
|
[PLAN_SYMBOL]: AsyncStepState;
|
|
114
123
|
} & AsyncStep<never>;
|
|
115
124
|
export type InternalAsyncSuccess = {
|
|
116
|
-
[PLAN_SYMBOL]:
|
|
125
|
+
[PLAN_SYMBOL]: AsyncImmediateState;
|
|
117
126
|
} & AsyncSuccess<never>;
|
|
118
127
|
export type InternalFailure = {
|
|
119
|
-
[PLAN_SYMBOL]:
|
|
128
|
+
[PLAN_SYMBOL]: ImmediateState;
|
|
120
129
|
} & Failure<never>;
|
|
121
130
|
export type InternalPlan = {
|
|
122
131
|
[PLAN_SYMBOL]: PlanState;
|
|
123
132
|
} & Plan<never, never, unknown[]>;
|
|
124
133
|
export type InternalSuccess = {
|
|
125
|
-
[PLAN_SYMBOL]:
|
|
134
|
+
[PLAN_SYMBOL]: ImmediateState;
|
|
126
135
|
} & Success<never>;
|
|
127
136
|
export type InternalStep = {
|
|
128
137
|
[PLAN_SYMBOL]: StepState;
|
|
@@ -153,42 +162,33 @@ export type Plan<Yielded, Returned, Parameters extends unknown[]> = {
|
|
|
153
162
|
*
|
|
154
163
|
* @returns Attempted result
|
|
155
164
|
*/
|
|
156
|
-
attempt(...parameters: Parameters): Result<
|
|
165
|
+
attempt(...parameters: Parameters): Result<PlannedOk<Returned>, PlannedError<Yielded, Returned>>;
|
|
157
166
|
/**
|
|
158
167
|
* Run the plan to completion
|
|
159
168
|
*
|
|
160
|
-
* @throws {
|
|
169
|
+
* @throws {PlannedError<Yielded, Returned>}
|
|
161
170
|
* @returns Result
|
|
162
171
|
*/
|
|
163
|
-
run(...parameters: Parameters):
|
|
172
|
+
run(...parameters: Parameters): PlannedReturned<Returned>;
|
|
173
|
+
};
|
|
174
|
+
export type PlanState = {
|
|
175
|
+
generator(...parameters: unknown[]): Generator;
|
|
176
|
+
type: typeof PLAN_TYPE_SYNC;
|
|
164
177
|
};
|
|
165
|
-
/**
|
|
166
|
-
* An OK result of a plan execution
|
|
167
|
-
*/
|
|
168
|
-
export type PlanOk<Returned> = Returned extends Error ? never : Returned extends Err<infer _> ? never : Returned extends Ok<infer Value> ? Value : Returned;
|
|
169
|
-
type PlanErrors<Yielded, Returned> = PlanErrorValues<Yielded> | PlanErrorValues<Returned>;
|
|
170
178
|
/**
|
|
171
179
|
* An error result of a plan execution
|
|
172
180
|
*/
|
|
173
|
-
export type
|
|
181
|
+
export type PlannedError<Yielded, Returned> = [PlannedErrors<Yielded, Returned>] extends [never] ? Error : PlanErrorValues<Yielded> | PlanErrorValues<Returned>;
|
|
182
|
+
type PlannedErrors<Yielded, Returned> = PlanErrorValues<Yielded> | PlanErrorValues<Returned>;
|
|
174
183
|
type PlanErrorValues<Original> = Original extends Error ? Original : Original extends Err<infer E> ? E : Original extends Failure<infer E> ? E : never;
|
|
175
184
|
/**
|
|
176
|
-
*
|
|
185
|
+
* An OK result of a plan execution
|
|
177
186
|
*/
|
|
178
|
-
export type
|
|
187
|
+
export type PlannedOk<Returned> = Returned extends Error ? never : Returned extends Err<infer _> ? never : Returned extends Ok<infer Value> ? Value : Returned;
|
|
179
188
|
/**
|
|
180
|
-
*
|
|
189
|
+
* The returned result of a plan execution _(excluding errors, which are thrown)_
|
|
181
190
|
*/
|
|
182
|
-
export type
|
|
183
|
-
export type PlannedState = {
|
|
184
|
-
generator: () => Generator;
|
|
185
|
-
type: typeof PLAN_FAILURE_SYNC | typeof PLAN_SUCCESS_SYNC;
|
|
186
|
-
};
|
|
187
|
-
export type PlannedType = "asyncFailure" | "asyncSuccess" | "failure" | "success";
|
|
188
|
-
export type PlanState = {
|
|
189
|
-
generator(...parameters: unknown[]): Generator;
|
|
190
|
-
type: typeof PLAN_TYPE_SYNC;
|
|
191
|
-
};
|
|
191
|
+
export type PlannedReturned<Returned> = Returned extends Error ? never : Returned extends Err<infer _> ? never : Returned;
|
|
192
192
|
/**
|
|
193
193
|
* A single step within a plan of execution
|
|
194
194
|
*/
|
|
@@ -64,12 +64,6 @@ export type PromiseParameters = {
|
|
|
64
64
|
* - `first`: rejects on the first rejected _Promise_, and returns an array of values
|
|
65
65
|
*/
|
|
66
66
|
export type PromiseStrategy = "complete" | "first";
|
|
67
|
-
/**
|
|
68
|
-
* An error thrown when a promise times out
|
|
69
|
-
*/
|
|
70
|
-
export declare class PromiseTimeoutError extends Error {
|
|
71
|
-
constructor();
|
|
72
|
-
}
|
|
73
67
|
export type PromisesItems<Items extends ArrayOrPlainObject> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Promise<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Promise<Value> : Promise<Items[ItemsKey]>; };
|
|
74
68
|
/**
|
|
75
69
|
* Options for handling multiple _Promises_
|
|
@@ -101,11 +95,17 @@ export type RejectedPromise = {
|
|
|
101
95
|
*/
|
|
102
96
|
reason: unknown;
|
|
103
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* An error thrown when a promise times out
|
|
100
|
+
*/
|
|
101
|
+
export declare class TimedError extends Error {
|
|
102
|
+
constructor();
|
|
103
|
+
}
|
|
104
104
|
export declare const PROMISE_ABORT_EVENT = "abort";
|
|
105
105
|
export declare const PROMISE_ABORT_OPTIONS: {
|
|
106
106
|
once: boolean;
|
|
107
107
|
};
|
|
108
|
-
export declare const PROMISE_ERROR_NAME = "
|
|
108
|
+
export declare const PROMISE_ERROR_NAME = "TimedError";
|
|
109
109
|
export declare const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
|
|
110
110
|
export declare const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
|
|
111
111
|
export declare const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
|
|
@@ -25,7 +25,7 @@ var CancelablePromise = class extends Promise {
|
|
|
25
25
|
/**
|
|
26
26
|
* An error thrown when a promise times out
|
|
27
27
|
*/
|
|
28
|
-
var
|
|
28
|
+
var TimedError = class extends Error {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(PROMISE_MESSAGE_TIMEOUT);
|
|
31
31
|
this.name = PROMISE_ERROR_NAME;
|
|
@@ -33,7 +33,7 @@ var PromiseTimeoutError = class extends Error {
|
|
|
33
33
|
};
|
|
34
34
|
const PROMISE_ABORT_EVENT = "abort";
|
|
35
35
|
const PROMISE_ABORT_OPTIONS = { once: true };
|
|
36
|
-
const PROMISE_ERROR_NAME = "
|
|
36
|
+
const PROMISE_ERROR_NAME = "TimedError";
|
|
37
37
|
const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
|
|
38
38
|
const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
|
|
39
39
|
const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
|
|
@@ -43,4 +43,4 @@ const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
|
|
|
43
43
|
const PROMISE_STRATEGY_DEFAULT = "complete";
|
|
44
44
|
const PROMISE_TYPE_FULFILLED = "fulfilled";
|
|
45
45
|
const PROMISE_TYPE_REJECTED = "rejected";
|
|
46
|
-
export { CancelablePromise, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED,
|
|
46
|
+
export { CancelablePromise, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, TimedError };
|
|
@@ -241,7 +241,6 @@ export declare const QUEUE_MESSAGE_MAXIMUM = "Queue has reached its maximum size
|
|
|
241
241
|
export declare const QUEUE_MESSAGE_REMOVE = "Item removed from queue";
|
|
242
242
|
export declare const QUEUE_NAME_KEYED = "keyedQueue";
|
|
243
243
|
export declare const QUEUE_NAME_QUEUE = "queue";
|
|
244
|
-
export declare const QUEUE_PROPERTY = "$queue";
|
|
245
244
|
export declare const QUEUE_STATUS_ACTIVE: QueueStatusKey;
|
|
246
245
|
export declare const QUEUE_STATUS_EMPTY: QueueStatusKey;
|
|
247
246
|
export declare const QUEUE_STATUS_FULL: QueueStatusKey;
|