@oscarpalmer/atoms 0.210.0 → 0.212.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/sort.d.mts +1 -1
- package/dist/color/models.d.mts +11 -11
- package/dist/herald.d.mts +2 -1
- package/dist/index.d.mts +142 -78
- package/dist/index.mjs +90 -52
- package/dist/internal/aborter.d.mts +1 -1
- package/dist/internal/herald.d.mts +2 -38
- package/dist/internal/herald.mjs +4 -14
- package/dist/internal/models/herald.model.d.mts +60 -0
- package/dist/internal/models/herald.model.mjs +15 -0
- package/dist/internal/models/plan.model.d.mts +27 -10
- package/dist/internal/models/result.model.d.mts +2 -2
- package/dist/internal/plan.d.mts +4 -4
- package/dist/internal/plan.mjs +2 -0
- package/dist/internal/subscription.d.mts +2 -2
- package/dist/internal/value/handlers.d.mts +3 -3
- package/dist/internal/value/set.mjs +1 -1
- package/dist/models.d.mts +3 -3
- package/dist/plan/generate.d.mts +4 -0
- package/dist/plan/generate.mjs +50 -0
- package/dist/plan/index.d.mts +7 -32
- package/dist/plan/index.mjs +7 -59
- package/dist/plan/result.d.mts +41 -0
- package/dist/plan/result.mjs +24 -0
- package/dist/plan/run.d.mts +41 -0
- package/dist/plan/run.mjs +26 -0
- package/dist/promise/models.d.mts +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2737,7 +2737,7 @@ function setValue(data, path, value, ignoreCase) {
|
|
|
2737
2737
|
let next = unwrap(handleValue(target, currentPath, null, true, shouldIgnoreCase), void 0);
|
|
2738
2738
|
if (typeof next !== "object" || next === null) {
|
|
2739
2739
|
const nextPath = paths[index + 1];
|
|
2740
|
-
if (SET_EXPRESSION_INDEX.test(nextPath)) next = Array.from({ length:
|
|
2740
|
+
if (SET_EXPRESSION_INDEX.test(nextPath)) next = Array.from({ length: +nextPath + 1 }, () => void 0);
|
|
2741
2741
|
else next = {};
|
|
2742
2742
|
target[currentPath] = next;
|
|
2743
2743
|
}
|
|
@@ -2765,6 +2765,7 @@ const PLAN_TYPE_PLAN_SYNC = "plan";
|
|
|
2765
2765
|
*/
|
|
2766
2766
|
function fail(reason) {
|
|
2767
2767
|
return (function* () {
|
|
2768
|
+
yield;
|
|
2768
2769
|
throw reason;
|
|
2769
2770
|
})();
|
|
2770
2771
|
}
|
|
@@ -2818,33 +2819,14 @@ function isPlanInstance(type, value) {
|
|
|
2818
2819
|
*/
|
|
2819
2820
|
function succeed(value) {
|
|
2820
2821
|
return (function* () {
|
|
2822
|
+
yield;
|
|
2821
2823
|
return value;
|
|
2822
2824
|
})();
|
|
2823
2825
|
}
|
|
2824
2826
|
//#endregion
|
|
2825
|
-
//#region src/plan/
|
|
2826
|
-
function
|
|
2827
|
-
|
|
2828
|
-
generator,
|
|
2829
|
-
type: PLAN_TYPE_PLAN_ASYNC
|
|
2830
|
-
};
|
|
2831
|
-
}
|
|
2832
|
-
AsyncPlan.prototype[Symbol.asyncIterator] = function() {
|
|
2833
|
-
return this[PLAN_SYMBOL].generator();
|
|
2834
|
-
};
|
|
2835
|
-
AsyncPlan.prototype.run = runAsyncPlan;
|
|
2836
|
-
function Plan(generator) {
|
|
2837
|
-
this[PLAN_SYMBOL] = {
|
|
2838
|
-
generator,
|
|
2839
|
-
type: PLAN_TYPE_PLAN_SYNC
|
|
2840
|
-
};
|
|
2841
|
-
}
|
|
2842
|
-
Plan.prototype[Symbol.iterator] = function() {
|
|
2843
|
-
return this[PLAN_SYMBOL].generator();
|
|
2844
|
-
};
|
|
2845
|
-
Plan.prototype.run = runPlan;
|
|
2846
|
-
async function asyncExecute(callback) {
|
|
2847
|
-
const generator = callback();
|
|
2827
|
+
//#region src/plan/generate.ts
|
|
2828
|
+
async function asyncGenerate(callback, parameters) {
|
|
2829
|
+
const generator = callback(...parameters);
|
|
2848
2830
|
let success = true;
|
|
2849
2831
|
let lastValue;
|
|
2850
2832
|
try {
|
|
@@ -2853,6 +2835,7 @@ async function asyncExecute(callback) {
|
|
|
2853
2835
|
const { done } = next;
|
|
2854
2836
|
let { value } = next;
|
|
2855
2837
|
if (value instanceof Error) throw value;
|
|
2838
|
+
if (isError(value)) throw value.error;
|
|
2856
2839
|
lastValue = value;
|
|
2857
2840
|
if (done === true) break;
|
|
2858
2841
|
}
|
|
@@ -2860,21 +2843,22 @@ async function asyncExecute(callback) {
|
|
|
2860
2843
|
lastValue = error;
|
|
2861
2844
|
success = false;
|
|
2862
2845
|
} finally {
|
|
2863
|
-
generator?.return(lastValue);
|
|
2846
|
+
await generator?.return(lastValue);
|
|
2864
2847
|
}
|
|
2865
2848
|
if (success) return lastValue;
|
|
2866
2849
|
throw lastValue;
|
|
2867
2850
|
}
|
|
2868
|
-
function
|
|
2869
|
-
const generator = callback();
|
|
2851
|
+
function generate(callback, parameters) {
|
|
2852
|
+
const generator = callback(...parameters);
|
|
2870
2853
|
let success = true;
|
|
2871
2854
|
let lastValue;
|
|
2872
2855
|
try {
|
|
2873
2856
|
while (true) {
|
|
2874
2857
|
const next = generator.next(lastValue);
|
|
2875
2858
|
const done = next.done === true;
|
|
2876
|
-
|
|
2859
|
+
const { value } = next;
|
|
2877
2860
|
if (value instanceof Error) throw value;
|
|
2861
|
+
if (isError(value)) throw value.error;
|
|
2878
2862
|
lastValue = value;
|
|
2879
2863
|
if (done) break;
|
|
2880
2864
|
}
|
|
@@ -2887,22 +2871,74 @@ function execute(callback) {
|
|
|
2887
2871
|
if (success) return lastValue;
|
|
2888
2872
|
throw lastValue;
|
|
2889
2873
|
}
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2874
|
+
//#endregion
|
|
2875
|
+
//#region src/plan/result.ts
|
|
2876
|
+
function asyncAttemptRun(input, ...parameters) {
|
|
2877
|
+
if (isAsyncPlan(input)) return input.attempt(...parameters);
|
|
2878
|
+
if (isAsyncGenerator(input)) return asyncAttempt(() => asyncGenerate(input, parameters));
|
|
2879
|
+
throw new Error(PLAN_MESSAGE_RUN_INPUT);
|
|
2894
2880
|
}
|
|
2895
|
-
function
|
|
2896
|
-
if (
|
|
2897
|
-
if (
|
|
2898
|
-
if (isGenerator(input)) return execute(input);
|
|
2881
|
+
function attemptRun(input, ...parameters) {
|
|
2882
|
+
if (isPlan(input)) return input.attempt(...parameters);
|
|
2883
|
+
if (isGenerator(input)) return attempt(() => generate(input, parameters));
|
|
2899
2884
|
throw new Error(PLAN_MESSAGE_RUN_INPUT);
|
|
2900
2885
|
}
|
|
2901
|
-
function
|
|
2902
|
-
return
|
|
2886
|
+
function attemptRunAsyncPlan(...parameters) {
|
|
2887
|
+
return asyncAttempt(() => this.run(...parameters));
|
|
2903
2888
|
}
|
|
2904
|
-
function
|
|
2905
|
-
return
|
|
2889
|
+
function attemptRunPlan(...parameters) {
|
|
2890
|
+
return attempt(() => this.run(...parameters));
|
|
2891
|
+
}
|
|
2892
|
+
attemptRun.async = asyncAttemptRun;
|
|
2893
|
+
//#endregion
|
|
2894
|
+
//#region src/plan/run.ts
|
|
2895
|
+
function asyncRun(input, ...parameters) {
|
|
2896
|
+
if (isAsyncPlan(input)) return input.run(...parameters);
|
|
2897
|
+
if (isAsyncGenerator(input)) return asyncGenerate(input, parameters);
|
|
2898
|
+
throw new Error(PLAN_MESSAGE_RUN_INPUT);
|
|
2899
|
+
}
|
|
2900
|
+
function run(input, ...parameters) {
|
|
2901
|
+
if (isPlan(input)) return input.run(...parameters);
|
|
2902
|
+
if (isGenerator(input)) return generate(input, parameters);
|
|
2903
|
+
throw new Error(PLAN_MESSAGE_RUN_INPUT);
|
|
2904
|
+
}
|
|
2905
|
+
function runAsyncPlan(...parameters) {
|
|
2906
|
+
return asyncGenerate(this[PLAN_SYMBOL].generator, parameters);
|
|
2907
|
+
}
|
|
2908
|
+
function runPlan(...parameters) {
|
|
2909
|
+
return generate(this[PLAN_SYMBOL].generator, parameters);
|
|
2910
|
+
}
|
|
2911
|
+
asyncRun.attempt = asyncAttemptRun;
|
|
2912
|
+
run.async = asyncRun;
|
|
2913
|
+
run.attempt = attemptRun;
|
|
2914
|
+
//#endregion
|
|
2915
|
+
//#region src/plan/index.ts
|
|
2916
|
+
function AsyncPlan(generator) {
|
|
2917
|
+
this[PLAN_SYMBOL] = {
|
|
2918
|
+
generator,
|
|
2919
|
+
type: PLAN_TYPE_PLAN_ASYNC
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
AsyncPlan.prototype[Symbol.asyncIterator] = function() {
|
|
2923
|
+
return this[PLAN_SYMBOL].generator();
|
|
2924
|
+
};
|
|
2925
|
+
AsyncPlan.prototype.attempt = attemptRunAsyncPlan;
|
|
2926
|
+
AsyncPlan.prototype.run = runAsyncPlan;
|
|
2927
|
+
function Plan(generator) {
|
|
2928
|
+
this[PLAN_SYMBOL] = {
|
|
2929
|
+
generator,
|
|
2930
|
+
type: PLAN_TYPE_PLAN_SYNC
|
|
2931
|
+
};
|
|
2932
|
+
}
|
|
2933
|
+
Plan.prototype[Symbol.iterator] = function() {
|
|
2934
|
+
return this[PLAN_SYMBOL].generator();
|
|
2935
|
+
};
|
|
2936
|
+
Plan.prototype.attempt = attemptRunPlan;
|
|
2937
|
+
Plan.prototype.run = runPlan;
|
|
2938
|
+
function plan(generator) {
|
|
2939
|
+
if (isAsyncGenerator(generator)) return new AsyncPlan(generator);
|
|
2940
|
+
if (isGenerator(generator)) return new Plan(generator);
|
|
2941
|
+
throw new Error(PLAN_MESSAGE_PLAN_INPUT);
|
|
2906
2942
|
}
|
|
2907
2943
|
//#endregion
|
|
2908
2944
|
//#region src/internal/aborter.ts
|
|
@@ -4811,10 +4847,20 @@ const beaconSubscription = {
|
|
|
4811
4847
|
value: SUBSCRIPTION_NAME
|
|
4812
4848
|
};
|
|
4813
4849
|
//#endregion
|
|
4814
|
-
//#region src/internal/herald.ts
|
|
4850
|
+
//#region src/internal/models/herald.model.ts
|
|
4851
|
+
const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
4852
|
+
const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
|
|
4853
|
+
const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
|
|
4815
4854
|
const HERALD_NAME_EVENTS = "events";
|
|
4816
4855
|
const HERALD_NAME_HERALD = "herald";
|
|
4817
4856
|
const HERALD_PROPERTY = "$herald";
|
|
4857
|
+
const HERALD_SYMBOL = Symbol(HERALD_PROPERTY);
|
|
4858
|
+
const heraldSubscription = {
|
|
4859
|
+
key: HERALD_PROPERTY,
|
|
4860
|
+
value: SUBSCRIPTION_NAME
|
|
4861
|
+
};
|
|
4862
|
+
//#endregion
|
|
4863
|
+
//#region src/internal/herald.ts
|
|
4818
4864
|
function Events(herald, state) {
|
|
4819
4865
|
for (const key of state.keys) Object.defineProperty(this, key, { value: (callback, signal) => herald.subscribe(key, callback, signal) });
|
|
4820
4866
|
}
|
|
@@ -4901,7 +4947,7 @@ function isHeraldEvents(value) {
|
|
|
4901
4947
|
return isHeraldInstance(HERALD_NAME_EVENTS, value);
|
|
4902
4948
|
}
|
|
4903
4949
|
function isHeraldInstance(name, value) {
|
|
4904
|
-
return typeof value === "object" && value !== null &&
|
|
4950
|
+
return typeof value === "object" && value !== null && "$herald" in value && value["$herald"] === name;
|
|
4905
4951
|
}
|
|
4906
4952
|
/**
|
|
4907
4953
|
* Is the value a herald subscription?
|
|
@@ -4910,7 +4956,7 @@ function isHeraldInstance(name, value) {
|
|
|
4910
4956
|
* @returns `true` if the value is a herald subscription, otherwise `false`
|
|
4911
4957
|
*/
|
|
4912
4958
|
function isHeraldSubscription(value) {
|
|
4913
|
-
return isSubscription(value) &&
|
|
4959
|
+
return isSubscription(value) && "$herald" in value && value["$herald"] === "subscription";
|
|
4914
4960
|
}
|
|
4915
4961
|
function subscribeToHerald(key, callback, signal) {
|
|
4916
4962
|
const { state } = this[HERALD_SYMBOL];
|
|
@@ -4922,14 +4968,6 @@ function subscribeToHerald(key, callback, signal) {
|
|
|
4922
4968
|
if (!existing) state.onCreate?.(key, callback, subscription);
|
|
4923
4969
|
return subscription;
|
|
4924
4970
|
}
|
|
4925
|
-
const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
4926
|
-
const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
|
|
4927
|
-
const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
|
|
4928
|
-
const HERALD_SYMBOL = Symbol(HERALD_PROPERTY);
|
|
4929
|
-
const heraldSubscription = {
|
|
4930
|
-
key: HERALD_PROPERTY,
|
|
4931
|
-
value: SUBSCRIPTION_NAME
|
|
4932
|
-
};
|
|
4933
4971
|
//#endregion
|
|
4934
4972
|
//#region src/color/constants.ts
|
|
4935
4973
|
const COLOR_ALPHA = {
|
|
@@ -7005,4 +7043,4 @@ var SizedSet = class extends Set {
|
|
|
7005
7043
|
}
|
|
7006
7044
|
};
|
|
7007
7045
|
//#endregion
|
|
7008
|
-
export { CancelablePromise, Logger, PromiseTimeoutError, QueueError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, push as append, push, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, fail, filter, filterAndMap, filterAndMap as select, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeCloner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isAsyncGenerator, isAsyncOnce, isAsyncPlan, isBeacon, isBeaconSubscription, isColor, isConstructor, isEmpty, isError, isFrozen, isFulfilled, isFuzzy, isGenerator, isHerald, isHeraldEvents, isHeraldSubscription, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isInstanceOf, isKey, isKeyedQueue, isLogger, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isObservable, isOk, isOnce, isPlainObject, isPlan, isPrimitive, isQueue, isQueueInstance, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isSubscription, isSubscriptions, isTemplateStringsArray, isTimeLogger, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, mapAndFilter, mapAndFilter as reverseSelect, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, plan, promises, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, round, run, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, subscriptions, succeed, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|
|
7046
|
+
export { CancelablePromise, Logger, PromiseTimeoutError, QueueError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, push as append, push, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncAttemptRun, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncRun, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, attemptRun, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, fail, filter, filterAndMap, filterAndMap as select, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeCloner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isAsyncGenerator, isAsyncOnce, isAsyncPlan, isBeacon, isBeaconSubscription, isColor, isConstructor, isEmpty, isError, isFrozen, isFulfilled, isFuzzy, isGenerator, isHerald, isHeraldEvents, isHeraldSubscription, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isInstanceOf, isKey, isKeyedQueue, isLogger, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isObservable, isOk, isOnce, isPlainObject, isPlan, isPrimitive, isQueue, isQueueInstance, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isSubscription, isSubscriptions, isTemplateStringsArray, isTimeLogger, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, mapAndFilter, mapAndFilter as reverseSelect, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, plan, promises, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, round, run, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, subscriptions, succeed, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|
|
@@ -2,8 +2,8 @@ import { GenericCallback } from "../models.mjs";
|
|
|
2
2
|
//#region src/internal/aborter.d.ts
|
|
3
3
|
export type Aborter = {
|
|
4
4
|
callback: GenericCallback;
|
|
5
|
+
cancel(): void;
|
|
5
6
|
signal: AbortSignal;
|
|
6
|
-
cancel: () => void;
|
|
7
7
|
};
|
|
8
8
|
export declare function createAborter(value: unknown, onAbort: () => void): Aborter | undefined;
|
|
9
9
|
//#endregion
|
|
@@ -1,43 +1,7 @@
|
|
|
1
1
|
import { GenericCallback } from "../models.mjs";
|
|
2
|
-
import { Subscription
|
|
2
|
+
import { Subscription } from "./subscription.mjs";
|
|
3
|
+
import { Herald, HeraldEvents, HeraldOptions } from "./models/herald.model.mjs";
|
|
3
4
|
//#region src/internal/herald.d.ts
|
|
4
|
-
export type Herald<Events extends Record<string, GenericCallback>> = {
|
|
5
|
-
readonly events: HeraldEvents<Events>;
|
|
6
|
-
/**
|
|
7
|
-
* Remove all event subscribers
|
|
8
|
-
*/
|
|
9
|
-
clear(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Emit an event with parameters
|
|
12
|
-
*
|
|
13
|
-
* @param event Event name
|
|
14
|
-
* @param parameters Event parameters
|
|
15
|
-
*/
|
|
16
|
-
emit<Event extends keyof Events>(event: Event, ...parameters: Parameters<Events[Event]>): void;
|
|
17
|
-
/**
|
|
18
|
-
* Is the event observed by any subscribers?
|
|
19
|
-
*
|
|
20
|
-
* @param event Event name
|
|
21
|
-
* @returns `true` if the event is observed, otherwise `false`
|
|
22
|
-
*/
|
|
23
|
-
observed<Event extends keyof Events>(event: Event): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Subscribe to an event with a callback
|
|
26
|
-
*
|
|
27
|
-
* @param event Event name
|
|
28
|
-
* @param callback Callback function
|
|
29
|
-
* @param signal Optional abort signal to cancel the subscription
|
|
30
|
-
* @returns Subscription instance
|
|
31
|
-
*/
|
|
32
|
-
subscribe<Event extends keyof Events>(event: Event, callback: Events[Event], signal?: AbortSignal): Subscription;
|
|
33
|
-
};
|
|
34
|
-
export type HeraldEvents<Events extends Record<string, GenericCallback>> = { [Key in keyof Events]: Key extends "*" ? never : (callback: Events[Key], signal?: AbortSignal) => void; };
|
|
35
|
-
type HeraldOnCreate<Events extends Record<string, GenericCallback>> = <Event extends keyof Events>(event: Event, callback: Events[Event], subscription: Subscription) => void;
|
|
36
|
-
export type HeraldOptions<Events extends Record<string, GenericCallback>> = {
|
|
37
|
-
names: Array<keyof Events>;
|
|
38
|
-
property?: SubscriptionProperty;
|
|
39
|
-
onCreate?: HeraldOnCreate<Events>;
|
|
40
|
-
};
|
|
41
5
|
/**
|
|
42
6
|
* Create a _Herald_ for announcing named events
|
|
43
7
|
*
|
package/dist/internal/herald.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { isPlainObject } from "./is.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { isSubscription, subscriptions } from "./subscription.mjs";
|
|
3
|
+
import { HERALD_MESSAGE_ARRAY, HERALD_MESSAGE_ONCREATE, HERALD_MESSAGE_PROPERTY, HERALD_NAME_EVENTS, HERALD_NAME_HERALD, HERALD_PROPERTY, HERALD_SYMBOL, heraldSubscription } from "./models/herald.model.mjs";
|
|
3
4
|
//#region src/internal/herald.ts
|
|
4
|
-
const HERALD_NAME_EVENTS = "events";
|
|
5
|
-
const HERALD_NAME_HERALD = "herald";
|
|
6
|
-
const HERALD_PROPERTY = "$herald";
|
|
7
5
|
function Events(herald, state) {
|
|
8
6
|
for (const key of state.keys) Object.defineProperty(this, key, { value: (callback, signal) => herald.subscribe(key, callback, signal) });
|
|
9
7
|
}
|
|
@@ -91,7 +89,7 @@ function isHeraldEvents(value) {
|
|
|
91
89
|
return isHeraldInstance(HERALD_NAME_EVENTS, value);
|
|
92
90
|
}
|
|
93
91
|
function isHeraldInstance(name, value) {
|
|
94
|
-
return typeof value === "object" && value !== null &&
|
|
92
|
+
return typeof value === "object" && value !== null && "$herald" in value && value["$herald"] === name;
|
|
95
93
|
}
|
|
96
94
|
/**
|
|
97
95
|
* Is the value a herald subscription?
|
|
@@ -100,7 +98,7 @@ function isHeraldInstance(name, value) {
|
|
|
100
98
|
* @returns `true` if the value is a herald subscription, otherwise `false`
|
|
101
99
|
*/
|
|
102
100
|
function isHeraldSubscription(value) {
|
|
103
|
-
return isSubscription(value) &&
|
|
101
|
+
return isSubscription(value) && "$herald" in value && value["$herald"] === "subscription";
|
|
104
102
|
}
|
|
105
103
|
function subscribeToHerald(key, callback, signal) {
|
|
106
104
|
const { state } = this[HERALD_SYMBOL];
|
|
@@ -112,13 +110,5 @@ function subscribeToHerald(key, callback, signal) {
|
|
|
112
110
|
if (!existing) state.onCreate?.(key, callback, subscription);
|
|
113
111
|
return subscription;
|
|
114
112
|
}
|
|
115
|
-
const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
116
|
-
const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
|
|
117
|
-
const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
|
|
118
|
-
const HERALD_SYMBOL = Symbol(HERALD_PROPERTY);
|
|
119
|
-
const heraldSubscription = {
|
|
120
|
-
key: HERALD_PROPERTY,
|
|
121
|
-
value: SUBSCRIPTION_NAME
|
|
122
|
-
};
|
|
123
113
|
//#endregion
|
|
124
114
|
export { herald, isHerald, isHeraldEvents, isHeraldSubscription };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { GenericCallback } from "../../models.mjs";
|
|
2
|
+
import { Subscription, SubscriptionProperty, Subscriptions } from "../subscription.mjs";
|
|
3
|
+
//#region src/internal/models/herald.model.d.ts
|
|
4
|
+
export type Herald<Events extends Record<string, GenericCallback>> = {
|
|
5
|
+
readonly events: HeraldEvents<Events>;
|
|
6
|
+
/**
|
|
7
|
+
* Remove all event subscribers
|
|
8
|
+
*/
|
|
9
|
+
clear(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Emit an event with parameters
|
|
12
|
+
*
|
|
13
|
+
* @param event Event name
|
|
14
|
+
* @param parameters Event parameters
|
|
15
|
+
*/
|
|
16
|
+
emit<Event extends keyof Events>(event: Event, ...parameters: Parameters<Events[Event]>): void;
|
|
17
|
+
/**
|
|
18
|
+
* Is the event observed by any subscribers?
|
|
19
|
+
*
|
|
20
|
+
* @param event Event name
|
|
21
|
+
* @returns `true` if the event is observed, otherwise `false`
|
|
22
|
+
*/
|
|
23
|
+
observed<Event extends keyof Events>(event: Event): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Subscribe to an event with a callback
|
|
26
|
+
*
|
|
27
|
+
* @param event Event name
|
|
28
|
+
* @param callback Callback function
|
|
29
|
+
* @param signal Optional abort signal to cancel the subscription
|
|
30
|
+
* @returns Subscription instance
|
|
31
|
+
*/
|
|
32
|
+
subscribe<Event extends keyof Events>(event: Event, callback: Events[Event], signal?: AbortSignal): Subscription;
|
|
33
|
+
};
|
|
34
|
+
export type HeraldEvents<Events extends Record<string, GenericCallback>> = { [Key in keyof Events]: Key extends "*" ? never : (callback: Events[Key], signal?: AbortSignal) => void; };
|
|
35
|
+
export type HeraldOnCreate<Events extends Record<string, GenericCallback>> = <Event extends keyof Events>(event: Event, callback: Events[Event], subscription: Subscription) => void;
|
|
36
|
+
export type HeraldOptions<Events extends Record<string, GenericCallback>> = {
|
|
37
|
+
names: Array<keyof Events>;
|
|
38
|
+
property?: SubscriptionProperty;
|
|
39
|
+
onCreate?: HeraldOnCreate<Events>;
|
|
40
|
+
};
|
|
41
|
+
export type HeraldState = {
|
|
42
|
+
keys: Set<string>;
|
|
43
|
+
store: Subscriptions<GenericCallback>;
|
|
44
|
+
onCreate?: HeraldOnCreate<Record<string, GenericCallback>>;
|
|
45
|
+
};
|
|
46
|
+
export type InternalHerald = {
|
|
47
|
+
[HERALD_SYMBOL]: {
|
|
48
|
+
events: HeraldEvents<Record<string, GenericCallback>>;
|
|
49
|
+
state: HeraldState;
|
|
50
|
+
};
|
|
51
|
+
} & Herald<Record<string, GenericCallback>>;
|
|
52
|
+
export declare const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
53
|
+
export declare const HERALD_MESSAGE_ONCREATE = "Herald requires a valid onCreate callback for subscription creation";
|
|
54
|
+
export declare const HERALD_MESSAGE_PROPERTY = "Herald requires valid property information for subscription identification";
|
|
55
|
+
export declare const HERALD_NAME_EVENTS = "events";
|
|
56
|
+
export declare const HERALD_NAME_HERALD = "herald";
|
|
57
|
+
export declare const HERALD_PROPERTY = "$herald";
|
|
58
|
+
export declare const HERALD_SYMBOL: unique symbol;
|
|
59
|
+
export declare const heraldSubscription: SubscriptionProperty;
|
|
60
|
+
//#endregion
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SUBSCRIPTION_NAME } from "../subscription.mjs";
|
|
2
|
+
//#region src/internal/models/herald.model.ts
|
|
3
|
+
const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
4
|
+
const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
|
|
5
|
+
const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
|
|
6
|
+
const HERALD_NAME_EVENTS = "events";
|
|
7
|
+
const HERALD_NAME_HERALD = "herald";
|
|
8
|
+
const HERALD_PROPERTY = "$herald";
|
|
9
|
+
const HERALD_SYMBOL = Symbol(HERALD_PROPERTY);
|
|
10
|
+
const heraldSubscription = {
|
|
11
|
+
key: HERALD_PROPERTY,
|
|
12
|
+
value: SUBSCRIPTION_NAME
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { HERALD_MESSAGE_ARRAY, HERALD_MESSAGE_ONCREATE, HERALD_MESSAGE_PROPERTY, HERALD_NAME_EVENTS, HERALD_NAME_HERALD, HERALD_PROPERTY, HERALD_SYMBOL, heraldSubscription };
|
|
@@ -1,57 +1,74 @@
|
|
|
1
|
+
import { Err, Ok, Result } from "./result.model.mjs";
|
|
1
2
|
//#region src/internal/models/plan.model.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* An asynchronous plan of execution that can yield intermediate results and eventually return a result
|
|
4
5
|
*/
|
|
5
|
-
export type AsyncPlan<Yielded, Returned> = {
|
|
6
|
+
export type AsyncPlan<Yielded, Returned, Parameters extends unknown[]> = {
|
|
6
7
|
/**
|
|
7
8
|
* Get the asynchronous generator for the plan
|
|
8
9
|
*
|
|
9
10
|
* @returns Asynchronous generator
|
|
10
11
|
*/
|
|
11
12
|
[Symbol.asyncIterator]: () => AsyncGenerator<Yielded, Returned, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Attempt to run the plan to completion
|
|
15
|
+
*
|
|
16
|
+
* _Returns a promised {@link Result} instead of a raw value or throwing an error_
|
|
17
|
+
*
|
|
18
|
+
* @returns Promised result
|
|
19
|
+
*/
|
|
20
|
+
attempt(...parameters: Parameters): Promise<Result<PlanResult<Returned>, PlanError<Yielded, Returned>>>;
|
|
12
21
|
/**
|
|
13
22
|
* Run the plan to completion
|
|
14
23
|
*
|
|
15
24
|
* @throws {PlanError<Yielded, Returned>}
|
|
16
25
|
* @returns Result
|
|
17
26
|
*/
|
|
18
|
-
run:
|
|
27
|
+
run(...parameters: Parameters): Promise<PlanResult<Returned>>;
|
|
19
28
|
};
|
|
20
29
|
type AsyncPlanState = {
|
|
21
|
-
generator:
|
|
30
|
+
generator(...parameters: unknown[]): AsyncGenerator;
|
|
22
31
|
} & BaseState<typeof PLAN_TYPE_PLAN_ASYNC>;
|
|
23
32
|
type BaseState<Type extends PlanType> = {
|
|
24
33
|
type: Type;
|
|
25
34
|
};
|
|
26
35
|
export type InternalAsyncPlan = {
|
|
27
36
|
[PLAN_SYMBOL]: AsyncPlanState;
|
|
28
|
-
} & AsyncPlan<never, never>;
|
|
37
|
+
} & AsyncPlan<never, never, unknown[]>;
|
|
29
38
|
export type InternalPlan = {
|
|
30
39
|
[PLAN_SYMBOL]: PlanState;
|
|
31
|
-
} & Plan<never, never>;
|
|
40
|
+
} & Plan<never, never, unknown[]>;
|
|
32
41
|
/**
|
|
33
42
|
* A plan of execution that can yield intermediate results and eventually return a result
|
|
34
43
|
*/
|
|
35
|
-
export type Plan<Yielded, Returned> = {
|
|
44
|
+
export type Plan<Yielded, Returned, Parameters extends unknown[]> = {
|
|
36
45
|
/**
|
|
37
46
|
* Get the generator for the plan
|
|
38
47
|
*
|
|
39
48
|
* @returns Generator
|
|
40
49
|
*/
|
|
41
50
|
[Symbol.iterator]: () => Generator<Yielded, Returned, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Attempt to run the plan to completion
|
|
53
|
+
*
|
|
54
|
+
* _Returns a {@link Result} instead of a raw value or throwing an error_
|
|
55
|
+
*
|
|
56
|
+
* @returns Result
|
|
57
|
+
*/
|
|
58
|
+
attempt(...parameters: Parameters): Result<PlanResult<Returned>, PlanError<Yielded, Returned>>;
|
|
42
59
|
/**
|
|
43
60
|
* Run the plan to completion
|
|
44
61
|
*
|
|
45
62
|
* @throws {PlanError<Yielded, Returned>}
|
|
46
63
|
* @returns Result
|
|
47
64
|
*/
|
|
48
|
-
run:
|
|
65
|
+
run(...parameters: Parameters): PlanResult<Returned>;
|
|
49
66
|
};
|
|
50
|
-
type PlanErrorValues<Original> = Original extends Error ? Original : never;
|
|
67
|
+
type PlanErrorValues<Original> = Original extends Error ? Original : Original extends Err<infer Error> ? Error : Original extends Result<infer _, infer Error> ? Error : never;
|
|
51
68
|
export type PlanError<Yielded, Returned> = PlanErrorValues<Yielded> | PlanErrorValues<Returned> | Error;
|
|
52
|
-
export type PlanResult<Returned> = Returned extends Error ? never : Returned;
|
|
69
|
+
export type PlanResult<Returned> = Returned extends Error ? never : Returned extends Err<infer _> ? never : Returned extends Ok<infer Value> ? Value : Returned extends Result<infer Value, infer _> ? Value : Returned;
|
|
53
70
|
type PlanState = {
|
|
54
|
-
generator:
|
|
71
|
+
generator(...parameters: unknown[]): Generator;
|
|
55
72
|
} & BaseState<typeof PLAN_TYPE_PLAN_SYNC>;
|
|
56
73
|
export type PlanType = "asyncPlan" | "plan" | "stop";
|
|
57
74
|
export declare const GENERATOR_NAME_ASYNC = "AsyncGeneratorFunction";
|
|
@@ -43,14 +43,14 @@ export type ResultMatch<Value, Returned, E = Error> = {
|
|
|
43
43
|
* @param original Original error, if available
|
|
44
44
|
* @returns Value to return
|
|
45
45
|
*/
|
|
46
|
-
error
|
|
46
|
+
error(error: E, original?: Error): Returned;
|
|
47
47
|
/**
|
|
48
48
|
* Callback for ok result
|
|
49
49
|
*
|
|
50
50
|
* @param value Ok value
|
|
51
51
|
* @returns Value to return
|
|
52
52
|
*/
|
|
53
|
-
ok
|
|
53
|
+
ok(value: Value): Returned;
|
|
54
54
|
};
|
|
55
55
|
/**
|
|
56
56
|
* Unwrap a result value
|
package/dist/internal/plan.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { AsyncPlan, Plan } from "./models/plan.model.mjs";
|
|
|
6
6
|
* @param reason Failure reason
|
|
7
7
|
* @returns Failing generator
|
|
8
8
|
*/
|
|
9
|
-
export declare function fail<Reason>(reason: Reason): Generator<
|
|
9
|
+
export declare function fail<Reason>(reason: Reason): Generator<unknown, never>;
|
|
10
10
|
/**
|
|
11
11
|
* Is the value an asynchronous generator function?
|
|
12
12
|
*
|
|
@@ -20,7 +20,7 @@ export declare function isAsyncGenerator(value: unknown): value is () => AsyncGe
|
|
|
20
20
|
* @param value Value to check
|
|
21
21
|
* @returns `true` if the value is an asynchronous plan, otherwise `false`
|
|
22
22
|
*/
|
|
23
|
-
export declare function isAsyncPlan<Yielded = unknown, Returned = unknown>(value: unknown): value is AsyncPlan<Yielded, Returned>;
|
|
23
|
+
export declare function isAsyncPlan<Yielded = unknown, Returned = unknown, Parameters extends unknown[] = unknown[]>(value: unknown): value is AsyncPlan<Yielded, Returned, Parameters>;
|
|
24
24
|
/**
|
|
25
25
|
* Is the value a generator function?
|
|
26
26
|
*
|
|
@@ -34,12 +34,12 @@ export declare function isGenerator(value: unknown): value is () => Generator;
|
|
|
34
34
|
* @param value Value to check
|
|
35
35
|
* @returns `true` if the value is a plan, otherwise `false`
|
|
36
36
|
*/
|
|
37
|
-
export declare function isPlan<Yielded = unknown, Returned = unknown>(value: unknown): value is Plan<Yielded, Returned>;
|
|
37
|
+
export declare function isPlan<Yielded = unknown, Returned = unknown, Parameters extends unknown[] = unknown[]>(value: unknown): value is Plan<Yielded, Returned, Parameters>;
|
|
38
38
|
/**
|
|
39
39
|
* Create an immediately succeeding generator
|
|
40
40
|
*
|
|
41
41
|
* @param value Success value
|
|
42
42
|
* @returns Succeeding generator
|
|
43
43
|
*/
|
|
44
|
-
export declare function succeed<Value>(value: Value): Generator<
|
|
44
|
+
export declare function succeed<Value>(value: Value): Generator<unknown, Value>;
|
|
45
45
|
//#endregion
|
package/dist/internal/plan.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { GENERATOR_NAME_ASYNC, GENERATOR_NAME_SYNC, PLAN_SYMBOL, PLAN_TYPE_PLAN_
|
|
|
8
8
|
*/
|
|
9
9
|
function fail(reason) {
|
|
10
10
|
return (function* () {
|
|
11
|
+
yield;
|
|
11
12
|
throw reason;
|
|
12
13
|
})();
|
|
13
14
|
}
|
|
@@ -61,6 +62,7 @@ function isPlanInstance(type, value) {
|
|
|
61
62
|
*/
|
|
62
63
|
function succeed(value) {
|
|
63
64
|
return (function* () {
|
|
65
|
+
yield;
|
|
64
66
|
return value;
|
|
65
67
|
})();
|
|
66
68
|
}
|
|
@@ -65,14 +65,14 @@ export type Subscriptions<Value = unknown> = {
|
|
|
65
65
|
/**
|
|
66
66
|
* Clear all subscriptions
|
|
67
67
|
*/
|
|
68
|
-
clear
|
|
68
|
+
clear(): void;
|
|
69
69
|
/**
|
|
70
70
|
* Create _(or retrieve)_ a subscription
|
|
71
71
|
*
|
|
72
72
|
* @param parameters Subscription parameters
|
|
73
73
|
* @returns Tuple holding subsccription and existing boolean
|
|
74
74
|
*/
|
|
75
|
-
create
|
|
75
|
+
create(parameters: SubscriptionParameters): [Subscription, boolean];
|
|
76
76
|
};
|
|
77
77
|
/**
|
|
78
78
|
* Parameters for creating a subscription store
|
|
@@ -4,9 +4,9 @@ type BaseHandler = {
|
|
|
4
4
|
handlers: WeakMap<WeakKey, string | GenericCallback>;
|
|
5
5
|
options: BaseHandlerOptions;
|
|
6
6
|
owner: GenericCallback;
|
|
7
|
-
deregister
|
|
8
|
-
get
|
|
9
|
-
register
|
|
7
|
+
deregister(constructor: Constructor): void;
|
|
8
|
+
get(first: unknown, second: unknown): string | GenericCallback | undefined;
|
|
9
|
+
register(constructor: Constructor, handler?: string | GenericCallback): void;
|
|
10
10
|
};
|
|
11
11
|
type BaseHandlerOptions = {
|
|
12
12
|
callback: GenericCallback;
|
|
@@ -21,7 +21,7 @@ function setValue(data, path, value, ignoreCase) {
|
|
|
21
21
|
let next = unwrap(handleValue(target, currentPath, null, true, shouldIgnoreCase), void 0);
|
|
22
22
|
if (typeof next !== "object" || next === null) {
|
|
23
23
|
const nextPath = paths[index + 1];
|
|
24
|
-
if (SET_EXPRESSION_INDEX.test(nextPath)) next = Array.from({ length:
|
|
24
|
+
if (SET_EXPRESSION_INDEX.test(nextPath)) next = Array.from({ length: +nextPath + 1 }, () => void 0);
|
|
25
25
|
else next = {};
|
|
26
26
|
target[currentPath] = next;
|
|
27
27
|
}
|
package/dist/models.d.mts
CHANGED
|
@@ -90,7 +90,7 @@ export type OnceAsync<Callback extends GenericAsyncCallback> = {
|
|
|
90
90
|
* @param parameters Callback parameters
|
|
91
91
|
* @returns Call result
|
|
92
92
|
*/
|
|
93
|
-
run
|
|
93
|
+
run(...parameters: Parameters<Callback>): ReturnType<Callback>;
|
|
94
94
|
} & OnceProperties;
|
|
95
95
|
/**
|
|
96
96
|
* A callback function that can only be called once, returning the same value on subsequent calls
|
|
@@ -102,7 +102,7 @@ export type Once<Callback extends GenericCallback> = {
|
|
|
102
102
|
* @param parameters Callback parameters
|
|
103
103
|
* @returns Call result
|
|
104
104
|
*/
|
|
105
|
-
run
|
|
105
|
+
run(...parameters: Parameters<Callback>): ReturnType<Callback>;
|
|
106
106
|
} & OnceProperties;
|
|
107
107
|
type OnceProperties = {
|
|
108
108
|
/**
|
|
@@ -116,7 +116,7 @@ type OnceProperties = {
|
|
|
116
116
|
/**
|
|
117
117
|
* Clear the callback's cached value
|
|
118
118
|
*/
|
|
119
|
-
clear
|
|
119
|
+
clear(): void;
|
|
120
120
|
};
|
|
121
121
|
/**
|
|
122
122
|
* A generic object
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/plan/generate.d.ts
|
|
2
|
+
export declare function asyncGenerate(callback: (...parameters: unknown[]) => AsyncGenerator, parameters: unknown[]): Promise<unknown>;
|
|
3
|
+
export declare function generate(callback: (...parameters: unknown[]) => Generator, parameters: unknown[]): unknown;
|
|
4
|
+
//#endregion
|