New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@visisoft/staticland

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visisoft/staticland - npm Package Compare versions

Comparing version 2.0.0-alpha.1 to 2.0.0-alpha.2

91

dist/cjs/cancelable.js
/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -749,3 +749,3 @@ 'use strict';

var _promiseToCancelable = promise => (res, rej) => {
var __promiseToCancelable = promise => (res, rej) => {
let

@@ -780,3 +780,3 @@ resolveInner = res,

cancelPromiseContinuation = _promiseToCancelable(promise)(resolve, reject);
cancelPromiseContinuation = __promiseToCancelable(promise)(resolve, reject);

@@ -790,73 +790,2 @@ return () => {

/**
* StaticLand: fantasyfy.js
*
* Created by Matthias Seemann on 8.07.2022.
* Copyright (c) 2022 Visisoft OHG. All rights reserved.
*/
const
fantasticCancelable = C => cac => {
// const
// // copy
// cac = (resolve, reject) => ca(resolve, reject);
cac.map = cac['fantasy-land/map'] = fn => C.map(fn, cac);
cac.ap = cac['fantasy-land/ap'] = mfn => C.ap(mfn, cac);
cac.chain = cac['fantasy-land/chain'] = fn => C.chain(fn, cac);
/*
Reassigning the .constructor property apparently does not do much harm.
see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor
"There is nothing protecting the constructor property from being re-assigned or shadowed, so using it to detect the type of a variable should usually be avoided in favor of less fragile ways like instanceof and Symbol.toStringTag for objects, or typeof for primitives."
*/
cac.constructor = {
"fantasy-land/of": C.of,
"fantasy-land/zero": C.never
};
return cac;
};
const
never$1 = () => fantasticCancelable({ap: ap$1, chain: chain$1, map: map$1, never: never$1, of: of$1})( (unused, unusedToo) => () => {} );
const
// :: a -> Cancelable * a
of$1 = a => fantasticCancelable({ap: ap$1, chain: chain$1, map: map$1, never: never$1, of: of$1})(laterSucceed(0, a));
const
map$1 = ramda.curry((fn, cc) =>
fantasticCancelable({ap: ap$1, chain: chain$1, map: map$1, never: never$1, of: of$1})(
(resolve, reject) => cc(ramda.o(resolve, fn), reject)
));
const
/** @deprecated */
addFantasyLandInterface$1 = cac => {
cac['fantasy-land/map'] = fn => map$1(fn, cac);
cac['fantasy-land/ap'] = mfn => ap$1(mfn, cac);
cac['fantasy-land/chain'] = fn => chain$1(fn, cac);
/*
Reassigning the .constructor property apparently does not do much harm.
see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor
"There is nothing protecting the constructor property from being re-assigned or shadowed, so using it to detect the type of a variable should usually be avoided in favor of less fragile ways like instanceof and Symbol.toStringTag for objects, or typeof for primitives."
*/
cac.constructor = {
"fantasy-land/of": of$1,
"fantasy-land/zero": never$1
};
};
// :: Promise e a -> Cancelable e a
const promiseToCancelable = promise => {
const cancelable = _promiseToCancelable(promise);
addFantasyLandInterface$1(cancelable);
return cancelable;
};
/***

@@ -880,3 +809,3 @@ * Iso version for the browser or Node.js

cancelPromiseContinuation =
promiseToCancelable(
__promiseToCancelable(
fetch(

@@ -1023,3 +952,3 @@ url.toString(),

const IS_ABORT_CONTROLLER_SUPPORTED = typeof AbortController === 'function',
/**

@@ -1037,5 +966,5 @@ * @deprecated

abortController = IS_ABORT_CONTROLLER_SUPPORTED ? new AbortController() : undefined,
cancelPromiseContinuation =
promiseToCancelable(
__promiseToCancelable(
fetch(

@@ -1046,6 +975,6 @@ url.toString(),

)(resolve, reject);
return () => {
cancelPromiseContinuation();
if (abortController) {

@@ -1052,0 +981,0 @@ abortController.abort();

12

dist/cjs/either.js
/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -237,5 +237,2 @@ 'use strict';

/** @deprecated */
var traverse = ramda.curry((of_f, map_f, effect_to_f, ma) => sequence(of_f, map_f, map(effect_to_f, ma)));
/**

@@ -312,4 +309,7 @@ * StaticLand: either.js

either(ramda.always(mb), of, ma)
);
),
/** @deprecated */
traverse = ramda.curry((of_f, map_f, effect_to_f, ma) => sequence(of_f, map_f, map(effect_to_f, ma)));
exports.Either = Either;

@@ -316,0 +316,0 @@ exports.Left = Left;

/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -5,0 +5,0 @@ 'use strict';

/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -5,0 +5,0 @@ 'use strict';

/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -5,0 +5,0 @@ 'use strict';

/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -5,0 +5,0 @@ 'use strict';

/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -5,0 +5,0 @@ 'use strict';

/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -148,3 +148,3 @@ 'use strict';

// of :: a -> Promise e a
of$4 = value => Promise.resolve(value);
of$3 = value => Promise.resolve(value);

@@ -155,4 +155,4 @@ // see https://github.com/fantasyland/fantasy-land/tree/v4.0.1#type-representatives

TypeRepresentative$1 = {
"fantasy-land/of": of$4,
of: of$4
"fantasy-land/of": of$3,
of: of$3
};

@@ -180,3 +180,3 @@

// reject :: e -> Promise e a
reject$2 = error => Promise.reject(error),
reject$1 = error => Promise.reject(error),

@@ -188,3 +188,3 @@ // Callback a :: a -> undefined

never$2 = new Promise(() => undefined),
never$1 = new Promise(() => undefined),

@@ -197,3 +197,3 @@ // Transformation //

// mapRej :: (e -> c) -> Promise e b -> Promise c b
mapRej = ramda.curry((fn, aPromise) => aPromise.catch(ramda.o(reject$2, fn)));
mapRej = ramda.curry((fn, aPromise) => aPromise.catch(ramda.o(reject$1, fn)));

@@ -214,3 +214,3 @@ /**

bimap$1 = ramda.curry((failureMap, successMap, aPromise) =>
aPromise.then(successMap, ramda.o(reject$2, failureMap))),
aPromise.then(successMap, ramda.o(reject$1, failureMap))),

@@ -364,6 +364,6 @@ // chainIf :: (a -> Boolean) -> (a -> Promise a) -> Promise a -> Promise a

mapRej: mapRej,
never: never$2,
of: of$4,
never: never$1,
of: of$3,
race: race$2,
reject: reject$2,
reject: reject$1,
tap: tap$1,

@@ -672,7 +672,7 @@ tapRegardless: tapRegardless,

// :: a -> Maybe a
of$3 = Maybe.of,
of$2 = Maybe.of,
nothing = () => new Nothing();
let just = of$3;
let just = of$2;

@@ -687,8 +687,8 @@ /** @deprecated Use FL compliant utility function e.g. R.chain */

// map :: (a -> b) -> Maybe a -> Maybe b
var map$4 = ramda.curry((f, mx) => mx.map(ramda.unary(f)));
var map$3 = ramda.curry((f, mx) => mx.map(ramda.unary(f)));
/** @deprecated Use FL compliant utility function e.g. R.ap */
var ap$2 = ramda.curry((mf, mx) => chain$3(f => map$4(f, mx), mf));
var ap$2 = ramda.curry((mf, mx) => chain$3(f => map$3(f, mx), mf));
var liftA2$1 = ramda.curry((f, ma, mb) => ap$2(map$4(f, ma), mb));
var liftA2$1 = ramda.curry((f, ma, mb) => ap$2(map$3(f, ma), mb));

@@ -703,3 +703,3 @@ /**

/** @deprecated use R.pluck or fantasyland/pluck */
var pluck$1 = ramda.curry((key, ca) => map$4(ramda.prop(key), ca));
var pluck$1 = ramda.curry((key, ca) => map$3(ramda.prop(key), ca));

@@ -723,3 +723,3 @@ /**

var traverse$2 = ramda.curry((of_f, map_f, effect_to_f, ma) => sequence$1(of_f, map_f, map$4(effect_to_f, ma)));
var traverse$2 = ramda.curry((of_f, map_f, effect_to_f, ma) => sequence$1(of_f, map_f, map$3(effect_to_f, ma)));

@@ -739,10 +739,10 @@ /**

// fromNilable :: (a|undefined|null) -> Maybe a
fromNilable = ramda.ifElse(ramda.isNil, nothing, of$3),
fromNilable = ramda.ifElse(ramda.isNil, nothing, of$2),
// fromContentHolding :: a -> Maybe a
fromContentHolding = ramda.ifElse(ramda.isEmpty, nothing, of$3),
fromContentHolding = ramda.ifElse(ramda.isEmpty, nothing, of$2),
// :: (a -> Boolean) -> a -> Maybe a
fromPredicate = ramda.curry((predicate, x) =>
predicate(x) ? of$3(x) : nothing()
predicate(x) ? of$2(x) : nothing()
),

@@ -832,6 +832,6 @@

liftA2: liftA2$1,
map: map$4,
map: map$3,
maybe: maybe$1,
nothing: nothing,
of: of$3,
of: of$2,
pluck: pluck$1,

@@ -1063,5 +1063,2 @@ reduce: reduce,

/** @deprecated */
var traverse$1 = ramda.curry((of_f, map_f, effect_to_f, ma) => sequence(of_f, map_f, map$3(effect_to_f, ma)));
/**

@@ -1080,13 +1077,13 @@ * StaticLand: either.js

of$2 = Either.of,
of$1 = Either.of,
left = x => new Left(x),
right = of$2,
right = of$1,
// :: (…b -> a) -> …b -> Either c a
fromThrowable = f => ramda.tryCatch(ramda.o(of$2, f), left),
fromThrowable = f => ramda.tryCatch(ramda.o(of$1, f), left),
// :: (a -> Boolean) -> (a -> b) -> a -> Either b a
fromAssertedValue = ramda.curry((predicate, createLeftValue, a) =>
predicate(a) ? of$2 (a) : left(createLeftValue(a))
predicate(a) ? of$1 (a) : left(createLeftValue(a))
),

@@ -1105,3 +1102,3 @@

/** @deprecated Use FL compliant utility function e.g. R.map */
map$3 = ramda.curry((fn, mx) => mx.map(fn)),
map$2 = ramda.curry((fn, mx) => mx.map(fn)),

@@ -1140,5 +1137,8 @@ /** @deprecated Use FL compliant utility function e.g. R.chain */

alt = ramda.curry((ma, mb) =>
either(ramda.always(mb), of$2, ma)
);
either(ramda.always(mb), of$1, ma)
),
/** @deprecated */
traverse$1 = ramda.curry((of_f, map_f, effect_to_f, ma) => sequence(of_f, map_f, map$2(effect_to_f, ma)));
var either$1 = /*#__PURE__*/Object.freeze({

@@ -1162,4 +1162,4 @@ __proto__: null,

left: left,
map: map$3,
of: of$2,
map: map$2,
of: of$1,
right: right,

@@ -1236,33 +1236,3 @@ sequence: sequence,

/**
* StaticLand: fantasyfy.js
*
* Created by Matthias Seemann on 8.07.2022.
* Copyright (c) 2022 Visisoft OHG. All rights reserved.
*/
const
fantasticCancelable = C => cac => {
// const
// // copy
// cac = (resolve, reject) => ca(resolve, reject);
cac.map = cac['fantasy-land/map'] = fn => C.map(fn, cac);
cac.ap = cac['fantasy-land/ap'] = mfn => C.ap(mfn, cac);
cac.chain = cac['fantasy-land/chain'] = fn => C.chain(fn, cac);
/*
Reassigning the .constructor property apparently does not do much harm.
see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor
"There is nothing protecting the constructor property from being re-assigned or shadowed, so using it to detect the type of a variable should usually be avoided in favor of less fragile ways like instanceof and Symbol.toStringTag for objects, or typeof for primitives."
*/
cac.constructor = {
"fantasy-land/of": C.of,
"fantasy-land/zero": C.never
};
return cac;
};
const
// :: Number -> a -> Cancelable * a

@@ -1274,106 +1244,2 @@ laterSucceed = ramda.curry((dt, value) => (resolve, unused) => {

const
never$1 = () => fantasticCancelable({ap: ap$1, chain: chain$1, map: map$2, never: never$1, of: of$1})( (unused, unusedToo) => () => {} );
const
// :: a -> Cancelable * a
of$1 = a => fantasticCancelable({ap: ap$1, chain: chain$1, map: map$2, never: never$1, of: of$1})(laterSucceed(0, a));
const
map$2 = ramda.curry((fn, cc) =>
fantasticCancelable({ap: ap$1, chain: chain$1, map: map$2, never: never$1, of: of$1})(
(resolve, reject) => cc(ramda.o(resolve, fn), reject)
));
const
/** @deprecated */
addFantasyLandInterface$1 = cac => {
cac['fantasy-land/map'] = fn => map$2(fn, cac);
cac['fantasy-land/ap'] = mfn => ap$1(mfn, cac);
cac['fantasy-land/chain'] = fn => chain$1(fn, cac);
/*
Reassigning the .constructor property apparently does not do much harm.
see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor
"There is nothing protecting the constructor property from being re-assigned or shadowed, so using it to detect the type of a variable should usually be avoided in favor of less fragile ways like instanceof and Symbol.toStringTag for objects, or typeof for primitives."
*/
cac.constructor = {
"fantasy-land/of": of$1,
"fantasy-land/zero": never$1
};
};
var _promiseToCancelable = promise => (res, rej) => {
let
resolveInner = res,
rejectInner = rej;
promise.then(x => resolveInner(x), e => rejectInner(e));
return () => {
resolveInner = () => undefined;
rejectInner = () => undefined;
};
};
// :: Promise e a -> Cancelable e a
const promiseToCancelable = promise => {
const cancelable = _promiseToCancelable(promise);
addFantasyLandInterface$1(cancelable);
return cancelable;
};
const cancelableToPromise = cancelable => new Promise(cancelable);
const
baconObservableToCancelable = observable => {
// Warn of converting of shared Bacon (many-event) observables
// to lazy (i.e. evaluate when needed) cancelables.
// Possible (breaking-change) solutions would be
// - subscribing to observable.toProperty(),
// - or/and returning a shared cancelable
// Use of undocumented property _isProperty!
//if (!observable._isProperty) {
console.warn(`Possible bug: Creating a lazy cancelable from a shared once-executed Bacon Observable "${observable.inspect()}"!`);
//}
const cancelable = (res, rej) =>
observable.last().subscribe(evt => {
if (evt.hasValue) {
res(evt.value);
}
else if (evt.isError) {
rej(evt.error);
}
return Bacon__namespace.noMore;
});
addFantasyLandInterface$1(cancelable);
return cancelable;
};
const
noop$1 = () => undefined,
cancelableToBaconStream = cc => Bacon__namespace.fromBinder(sink => {
let toAbort = cc(
x => {
toAbort = noop$1;
sink(x);
sink(new Bacon__namespace.End());
},
e => {
toAbort = noop$1;
sink(new Bacon__namespace.Error(e));
sink(new Bacon__namespace.End());
}
);
return () => { toAbort(); };
});
// :: Number -> e -> Cancelable e *

@@ -1385,84 +1251,2 @@ const laterFail = ramda.curry((dt, value) => (unused, reject) => {

const reject$1 = value => fantasticCancelable({ap: ap$1, chain: chain$1, map: map$2, never: never$1, of: of$1})(laterFail(0, value));
var eitherToCancelable = either(reject$1, of$1);
// A specialisation of the Maybe sequence:
// sequence(of_o, map_o)
// :: Maybe Observable e a -> EventStream e Maybe a
const maybeOfBaconObservableToBaconObservableOfMaybe =
maybe$1(ramda.compose(Bacon__namespace.once, nothing), observable => observable.toEventStream().map(of$3));
// A specialisation of the Maybe sequence:
// sequence(of_c, map_c)
var maybeOfCancelableToCancelableOfMaybe = maybe$1(ramda.compose(of$1, nothing), map$2(just));
/**
* StaticLand: transformations.js
*
* Created by Matthias Seemann on 18.09.2020.
* Copyright (c) 2020 Visisoft OHG. All rights reserved.
*/
const
// eitherToPromise :: Either e a -> Promise e a
eitherToPromise = either(reject$2, of$4),
// :: Promise e a -> Promise * Either e a
promiseToPromiseOfEither = coalesce$1(left, right),
// maybeToPromise :: e -> Maybe a -> Promise e a
maybeToPromise = ramda.curry((e, ma) => maybe$1(ramda.thunkify(reject$2)(e), of$4, ma)),
// maybeToObj :: key -> Maybe a -> ({}|{key: a})
// key = String
maybeToObj = ramda.curry((keyName, ma) => maybe$1(ramda.always({}), ramda.objOf(keyName), ma)),
/**
* @deprecated
* use lens/view(sequence(maybe/map, indexLens(n)))(obj)
*/
// kind of inverse of `maybeToObj`
// key = String
// keyMaybeToMaybeObj :: key -> {key: Maybe a, …} -> Maybe {key: a, …}
keyMaybeToMaybeObj = ramda.curry((keyName, obj) =>
maybe$1(nothing, ramda.o(just, ramda.assoc(keyName, ramda.__, obj)), obj[keyName])
// TODO: Is that the same as
// map_mb(assoc(key, __, obj), obj[key])
// TODO: Is that the same as
// propUnlens(map_mb)
),
/** @deprecated
* use maybe/sequence(of_p, map_p)
*/
// maybeOfPromiseToPromiseOfMaybe :: Maybe Promise e a -> Promise e Maybe a
maybeOfPromiseToPromiseOfMaybe = maybe$1(ramda.compose(of$4, nothing), map_p(of$3)),
/** @deprecated */
// keyPromiseToPromiseCollection :: String -> {ki: Promise e vi, k:v …} -> Promise e {ki:vi, k:v …}
// keyPromiseToPromiseCollection :: Int -> [v,…, Promise e v, v,…] -> Promise e [v]
keyPromiseToPromiseCollection = ramda.curry((key, obj) =>
map_p(ramda.assoc(key, ramda.__, obj), obj[key])
);
var transformations = /*#__PURE__*/Object.freeze({
__proto__: null,
cancelableToEventStream: cancelableToBaconStream,
cancelableToPromise: cancelableToPromise,
eitherToCancelable: eitherToCancelable,
eitherToPromise: eitherToPromise,
keyMaybeToMaybeObj: keyMaybeToMaybeObj,
keyPromiseToPromiseCollection: keyPromiseToPromiseCollection,
maybeOfBaconObservableToBaconObservableOfMaybe: maybeOfBaconObservableToBaconObservableOfMaybe,
maybeOfCancelableToCancelableOfMaybe: maybeOfCancelableToCancelableOfMaybe,
maybeOfPromiseToPromiseOfMaybe: maybeOfPromiseToPromiseOfMaybe,
maybeToObj: maybeToObj,
maybeToPromise: maybeToPromise,
observableToCancelable: baconObservableToCancelable,
promiseToCancelable: promiseToCancelable,
promiseToPromiseOfEither: promiseToPromiseOfEither
});
const race$1 = (ccA, ccB) =>

@@ -2047,3 +1831,3 @@ (resolve, reject) => {

const
noop = () => undefined,
noop$1 = () => undefined,

@@ -2093,12 +1877,12 @@ /** @description Make a lazy Cancelable eager */

case "cancelled":
return noop;
return noop$1;
case "rejected":
setTimeout(propagateReject, 0, outcome);
return noop;
return noop$1;
case "resolved":
setTimeout(propagateResolve, 0, outcome);
return noop;
return noop$1;
default:
setTimeout(propagateReject, 0, new Error(`Unexpected cancelable deferred state: "${state}"`));
return noop;
return noop$1;
}

@@ -2131,2 +1915,15 @@ };

var __promiseToCancelable = promise => (res, rej) => {
let
resolveInner = res,
rejectInner = rej;
promise.then(x => resolveInner(x), e => rejectInner(e));
return () => {
resolveInner = () => undefined;
rejectInner = () => undefined;
};
};
const

@@ -2149,3 +1946,3 @@ cancelifyWithArityAbortableFactory = fantasyfy => (arity, fn) => ramda.curryN(arity, (...args) => fantasyfy(

cancelPromiseContinuation = _promiseToCancelable(promise)(resolve, reject);
cancelPromiseContinuation = __promiseToCancelable(promise)(resolve, reject);

@@ -2177,3 +1974,3 @@ return () => {

cancelPromiseContinuation =
promiseToCancelable(
__promiseToCancelable(
fetch(

@@ -2321,3 +2118,3 @@ url.toString(),

IS_ABORT_CONTROLLER_SUPPORTED = typeof AbortController === 'function',
/**

@@ -2335,5 +2132,5 @@ * @deprecated

abortController = IS_ABORT_CONTROLLER_SUPPORTED ? new AbortController() : undefined,
cancelPromiseContinuation =
promiseToCancelable(
__promiseToCancelable(
fetch(

@@ -2344,6 +2141,6 @@ url.toString(),

)(resolve, reject);
return () => {
cancelPromiseContinuation();
if (abortController) {

@@ -2500,2 +2297,134 @@ abortController.abort();

// :: Promise e a -> Cancelable e a
const promiseToCancelable = ramda.o(addFantasyLandInterface, __promiseToCancelable);
const cancelableToPromise = cancelable => new Promise(cancelable);
const
baconObservableToCancelable = observable => {
// Warn of converting of shared Bacon (many-event) observables
// to lazy (i.e. evaluate when needed) cancelables.
// Possible (breaking-change) solutions would be
// - subscribing to observable.toProperty(),
// - or/and returning a shared cancelable
// Use of undocumented property _isProperty!
//if (!observable._isProperty) {
console.warn(`Possible bug: Creating a lazy cancelable from a shared once-executed Bacon Observable "${observable.inspect()}"!`);
//}
const cancelable = (res, rej) =>
observable.last().subscribe(evt => {
if (evt.hasValue) {
res(evt.value);
}
else if (evt.isError) {
rej(evt.error);
}
return Bacon__namespace.noMore;
});
return addFantasyLandInterface(cancelable);
};
const
noop = () => undefined,
cancelableToBaconStream = cc => Bacon__namespace.fromBinder(sink => {
let toAbort = cc(
x => {
toAbort = noop;
sink(x);
sink(new Bacon__namespace.End());
},
e => {
toAbort = noop;
sink(new Bacon__namespace.Error(e));
sink(new Bacon__namespace.End());
}
);
return () => { toAbort(); };
});
var eitherToCancelable = either(reject, of);
// A specialisation of the Maybe sequence:
// sequence(of_o, map_o)
// :: Maybe Observable e a -> EventStream e Maybe a
const maybeOfBaconObservableToBaconObservableOfMaybe =
maybe$1(ramda.compose(Bacon__namespace.once, nothing), observable => observable.toEventStream().map(of$2));
// A specialisation of the Maybe sequence:
// sequence(of_c, map_c)
var maybeOfCancelableToCancelableOfMaybe = maybe$1(ramda.compose(of, nothing), map$1(just));
/**
* StaticLand: transformations.js
*
* Created by Matthias Seemann on 18.09.2020.
* Copyright (c) 2020 Visisoft OHG. All rights reserved.
*/
const
// eitherToPromise :: Either e a -> Promise e a
eitherToPromise = either(reject$1, of$3),
// :: Promise e a -> Promise * Either e a
promiseToPromiseOfEither = coalesce$1(left, right),
// maybeToPromise :: e -> Maybe a -> Promise e a
maybeToPromise = ramda.curry((e, ma) => maybe$1(ramda.thunkify(reject$1)(e), of$3, ma)),
// maybeToObj :: key -> Maybe a -> ({}|{key: a})
// key = String
maybeToObj = ramda.curry((keyName, ma) => maybe$1(ramda.always({}), ramda.objOf(keyName), ma)),
/**
* @deprecated
* use lens/view(sequence(maybe/map, indexLens(n)))(obj)
*/
// kind of inverse of `maybeToObj`
// key = String
// keyMaybeToMaybeObj :: key -> {key: Maybe a, …} -> Maybe {key: a, …}
keyMaybeToMaybeObj = ramda.curry((keyName, obj) =>
maybe$1(nothing, ramda.o(just, ramda.assoc(keyName, ramda.__, obj)), obj[keyName])
// TODO: Is that the same as
// map_mb(assoc(key, __, obj), obj[key])
// TODO: Is that the same as
// propUnlens(map_mb)
),
/** @deprecated
* use maybe/sequence(of_p, map_p)
*/
// maybeOfPromiseToPromiseOfMaybe :: Maybe Promise e a -> Promise e Maybe a
maybeOfPromiseToPromiseOfMaybe = maybe$1(ramda.compose(of$3, nothing), map_p(of$2)),
/** @deprecated */
// keyPromiseToPromiseCollection :: String -> {ki: Promise e vi, k:v …} -> Promise e {ki:vi, k:v …}
// keyPromiseToPromiseCollection :: Int -> [v,…, Promise e v, v,…] -> Promise e [v]
keyPromiseToPromiseCollection = ramda.curry((key, obj) =>
map_p(ramda.assoc(key, ramda.__, obj), obj[key])
);
var transformations = /*#__PURE__*/Object.freeze({
__proto__: null,
cancelableToEventStream: cancelableToBaconStream,
cancelableToPromise: cancelableToPromise,
eitherToCancelable: eitherToCancelable,
eitherToPromise: eitherToPromise,
keyMaybeToMaybeObj: keyMaybeToMaybeObj,
keyPromiseToPromiseCollection: keyPromiseToPromiseCollection,
maybeOfBaconObservableToBaconObservableOfMaybe: maybeOfBaconObservableToBaconObservableOfMaybe,
maybeOfCancelableToCancelableOfMaybe: maybeOfCancelableToCancelableOfMaybe,
maybeOfPromiseToPromiseOfMaybe: maybeOfPromiseToPromiseOfMaybe,
maybeToObj: maybeToObj,
maybeToPromise: maybeToPromise,
observableToCancelable: baconObservableToCancelable,
promiseToCancelable: promiseToCancelable,
promiseToPromiseOfEither: promiseToPromiseOfEither
});
var _isString = x => Object.prototype.toString.call(x) === '[object String]';

@@ -2502,0 +2431,0 @@

/* @license Apache-2.0
@visisoft/staticland v.2.0.0-alpha.1 visisoft.de
(Build date: 9/18/2023 - 8:07:49 PM)
@visisoft/staticland v.2.0.0-alpha.2 visisoft.de
(Build date: 9/19/2023 - 12:17:15 PM)
*/

@@ -258,5 +258,2 @@ 'use strict';

/** @deprecated */
ramda.curry((of_f, map_f, effect_to_f, ma) => sequence$1(of_f, map_f, map$2(effect_to_f, ma)));
/**

@@ -329,2 +326,5 @@ * StaticLand: either.js

/** @deprecated */
ramda.curry((of_f, map_f, effect_to_f, ma) => sequence$1(of_f, map_f, map$2(effect_to_f, ma)));
/**

@@ -764,3 +764,3 @@ * StaticLand: tap.js

//chain = curry((f, mx) => mx.flatMap(unary(f))),
var chain$1 = ramda.curry((f, mx) => isJust(mx) ? f(mx.$value) : nothing());
var chain$2 = ramda.curry((f, mx) => isJust(mx) ? f(mx.$value) : nothing());

@@ -772,5 +772,5 @@ /** @deprecated Use FL compliant utility function e.g. R.map */

/** @deprecated Use FL compliant utility function e.g. R.ap */
var ap$1 = ramda.curry((mf, mx) => chain$1(f => map$1(f, mx), mf));
var ap$2 = ramda.curry((mf, mx) => chain$2(f => map$1(f, mx), mf));
ramda.curry((f, ma, mb) => ap$1(map$1(f, ma), mb));
ramda.curry((f, ma, mb) => ap$2(map$1(f, ma), mb));

@@ -865,3 +865,3 @@ /**

// Sequential execution is derived from chain and map: ap(mf, ma) = chain(f => map(f, ma), mf)
ap = (ccF, ccB) => (res, rej) => {
ap$1 = (ccF, ccB) => (res, rej) => {
let theF, theB, cancelB, hasB;

@@ -912,3 +912,3 @@ const cancelF = ccF(

const
chain = (fn, cc) => (resolve, reject) => {
chain$1 = (fn, cc) => (resolve, reject) => {
let cancel = ramda.identity;

@@ -923,33 +923,3 @@ const resolveInner = x => {

/**
* StaticLand: fantasyfy.js
*
* Created by Matthias Seemann on 8.07.2022.
* Copyright (c) 2022 Visisoft OHG. All rights reserved.
*/
const
fantasticCancelable = C => cac => {
// const
// // copy
// cac = (resolve, reject) => ca(resolve, reject);
cac.map = cac['fantasy-land/map'] = fn => C.map(fn, cac);
cac.ap = cac['fantasy-land/ap'] = mfn => C.ap(mfn, cac);
cac.chain = cac['fantasy-land/chain'] = fn => C.chain(fn, cac);
/*
Reassigning the .constructor property apparently does not do much harm.
see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor
"There is nothing protecting the constructor property from being re-assigned or shadowed, so using it to detect the type of a variable should usually be avoided in favor of less fragile ways like instanceof and Symbol.toStringTag for objects, or typeof for primitives."
*/
cac.constructor = {
"fantasy-land/of": C.of,
"fantasy-land/zero": C.never
};
return cac;
};
const
// :: Number -> a -> Cancelable * a

@@ -961,34 +931,579 @@ laterSucceed = ramda.curry((dt, value) => (resolve, unused) => {

const
never = () => fantasticCancelable({ap, chain, map, never, of})( (unused, unusedToo) => () => {} );
// :: Number -> e -> Cancelable e *
const laterFail = ramda.curry((dt, value) => (unused, reject) => {
const timer = setTimeout(reject, dt, value);
return () => { clearTimeout(timer); };
});
const
// :: a -> Cancelable * a
of = a => fantasticCancelable({ap, chain, map, never, of})(laterSucceed(0, a));
const race = (ccA, ccB) =>
(resolve, reject) => {
let
cancelB,
const
map = ramda.curry((fn, cc) =>
fantasticCancelable({ap, chain, map, never, of})(
(resolve, reject) => cc(ramda.o(resolve, fn), reject)
));
cancelA = ccA(
x => {
cancelB();
resolve(x);
},
e => {
cancelB();
reject(e);
}
);
const
/** @deprecated */
addFantasyLandInterface = cac => {
cac['fantasy-land/map'] = fn => map(fn, cac);
cac['fantasy-land/ap'] = mfn => ap(mfn, cac);
cac['fantasy-land/chain'] = fn => chain(fn, cac);
cancelB = ccB(
x => {
cancelA();
resolve(x);
},
e => {
cancelA();
reject(e);
}
);
/*
Reassigning the .constructor property apparently does not do much harm.
see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor
"There is nothing protecting the constructor property from being re-assigned or shadowed, so using it to detect the type of a variable should usually be avoided in favor of less fragile ways like instanceof and Symbol.toStringTag for objects, or typeof for primitives."
*/
cac.constructor = {
"fantasy-land/of": of,
"fantasy-land/zero": never
return () => {
cancelA();
cancelB();
};
};
var _promiseToCancelable = promise => (res, rej) => {
const anyMap = new WeakMap();
const eventsMap = new WeakMap();
const producersMap = new WeakMap();
const anyProducer = Symbol('anyProducer');
const resolvedPromise = Promise.resolve();
// Define symbols for "meta" events.
const listenerAdded = Symbol('listenerAdded');
const listenerRemoved = Symbol('listenerRemoved');
let canEmitMetaEvents = false;
let isGlobalDebugEnabled = false;
function assertEventName(eventName) {
if (typeof eventName !== 'string' && typeof eventName !== 'symbol' && typeof eventName !== 'number') {
throw new TypeError('`eventName` must be a string, symbol, or number');
}
}
function assertListener(listener) {
if (typeof listener !== 'function') {
throw new TypeError('listener must be a function');
}
}
function getListeners(instance, eventName) {
const events = eventsMap.get(instance);
if (!events.has(eventName)) {
return;
}
return events.get(eventName);
}
function getEventProducers(instance, eventName) {
const key = typeof eventName === 'string' || typeof eventName === 'symbol' || typeof eventName === 'number' ? eventName : anyProducer;
const producers = producersMap.get(instance);
if (!producers.has(key)) {
return;
}
return producers.get(key);
}
function enqueueProducers(instance, eventName, eventData) {
const producers = producersMap.get(instance);
if (producers.has(eventName)) {
for (const producer of producers.get(eventName)) {
producer.enqueue(eventData);
}
}
if (producers.has(anyProducer)) {
const item = Promise.all([eventName, eventData]);
for (const producer of producers.get(anyProducer)) {
producer.enqueue(item);
}
}
}
function iterator(instance, eventNames) {
eventNames = Array.isArray(eventNames) ? eventNames : [eventNames];
let isFinished = false;
let flush = () => {};
let queue = [];
const producer = {
enqueue(item) {
queue.push(item);
flush();
},
finish() {
isFinished = true;
flush();
},
};
for (const eventName of eventNames) {
let set = getEventProducers(instance, eventName);
if (!set) {
set = new Set();
const producers = producersMap.get(instance);
producers.set(eventName, set);
}
set.add(producer);
}
return {
async next() {
if (!queue) {
return {done: true};
}
if (queue.length === 0) {
if (isFinished) {
queue = undefined;
return this.next();
}
await new Promise(resolve => {
flush = resolve;
});
return this.next();
}
return {
done: false,
value: await queue.shift(),
};
},
async return(value) {
queue = undefined;
for (const eventName of eventNames) {
const set = getEventProducers(instance, eventName);
if (set) {
set.delete(producer);
if (set.size === 0) {
const producers = producersMap.get(instance);
producers.delete(eventName);
}
}
}
flush();
return arguments.length > 0
? {done: true, value: await value}
: {done: true};
},
[Symbol.asyncIterator]() {
return this;
},
};
}
function defaultMethodNamesOrAssert(methodNames) {
if (methodNames === undefined) {
return allEmitteryMethods;
}
if (!Array.isArray(methodNames)) {
throw new TypeError('`methodNames` must be an array of strings');
}
for (const methodName of methodNames) {
if (!allEmitteryMethods.includes(methodName)) {
if (typeof methodName !== 'string') {
throw new TypeError('`methodNames` element must be a string');
}
throw new Error(`${methodName} is not Emittery method`);
}
}
return methodNames;
}
const isMetaEvent = eventName => eventName === listenerAdded || eventName === listenerRemoved;
function emitMetaEvent(emitter, eventName, eventData) {
if (isMetaEvent(eventName)) {
try {
canEmitMetaEvents = true;
emitter.emit(eventName, eventData);
} finally {
canEmitMetaEvents = false;
}
}
}
class Emittery {
static mixin(emitteryPropertyName, methodNames) {
methodNames = defaultMethodNamesOrAssert(methodNames);
return target => {
if (typeof target !== 'function') {
throw new TypeError('`target` must be function');
}
for (const methodName of methodNames) {
if (target.prototype[methodName] !== undefined) {
throw new Error(`The property \`${methodName}\` already exists on \`target\``);
}
}
function getEmitteryProperty() {
Object.defineProperty(this, emitteryPropertyName, {
enumerable: false,
value: new Emittery(),
});
return this[emitteryPropertyName];
}
Object.defineProperty(target.prototype, emitteryPropertyName, {
enumerable: false,
get: getEmitteryProperty,
});
const emitteryMethodCaller = methodName => function (...args) {
return this[emitteryPropertyName][methodName](...args);
};
for (const methodName of methodNames) {
Object.defineProperty(target.prototype, methodName, {
enumerable: false,
value: emitteryMethodCaller(methodName),
});
}
return target;
};
}
static get isDebugEnabled() {
// In a browser environment, `globalThis.process` can potentially reference a DOM Element with a `#process` ID,
// so instead of just type checking `globalThis.process`, we need to make sure that `globalThis.process.env` exists.
// eslint-disable-next-line n/prefer-global/process
if (typeof globalThis.process?.env !== 'object') {
return isGlobalDebugEnabled;
}
// eslint-disable-next-line n/prefer-global/process
const {env} = globalThis.process ?? {env: {}};
return env.DEBUG === 'emittery' || env.DEBUG === '*' || isGlobalDebugEnabled;
}
static set isDebugEnabled(newValue) {
isGlobalDebugEnabled = newValue;
}
constructor(options = {}) {
anyMap.set(this, new Set());
eventsMap.set(this, new Map());
producersMap.set(this, new Map());
producersMap.get(this).set(anyProducer, new Set());
this.debug = options.debug ?? {};
if (this.debug.enabled === undefined) {
this.debug.enabled = false;
}
if (!this.debug.logger) {
this.debug.logger = (type, debugName, eventName, eventData) => {
try {
// TODO: Use https://github.com/sindresorhus/safe-stringify when the package is more mature. Just copy-paste the code.
eventData = JSON.stringify(eventData);
} catch {
eventData = `Object with the following keys failed to stringify: ${Object.keys(eventData).join(',')}`;
}
if (typeof eventName === 'symbol' || typeof eventName === 'number') {
eventName = eventName.toString();
}
const currentTime = new Date();
const logTime = `${currentTime.getHours()}:${currentTime.getMinutes()}:${currentTime.getSeconds()}.${currentTime.getMilliseconds()}`;
console.log(`[${logTime}][emittery:${type}][${debugName}] Event Name: ${eventName}\n\tdata: ${eventData}`);
};
}
}
logIfDebugEnabled(type, eventName, eventData) {
if (Emittery.isDebugEnabled || this.debug.enabled) {
this.debug.logger(type, this.debug.name, eventName, eventData);
}
}
on(eventNames, listener) {
assertListener(listener);
eventNames = Array.isArray(eventNames) ? eventNames : [eventNames];
for (const eventName of eventNames) {
assertEventName(eventName);
let set = getListeners(this, eventName);
if (!set) {
set = new Set();
const events = eventsMap.get(this);
events.set(eventName, set);
}
set.add(listener);
this.logIfDebugEnabled('subscribe', eventName, undefined);
if (!isMetaEvent(eventName)) {
emitMetaEvent(this, listenerAdded, {eventName, listener});
}
}
return this.off.bind(this, eventNames, listener);
}
off(eventNames, listener) {
assertListener(listener);
eventNames = Array.isArray(eventNames) ? eventNames : [eventNames];
for (const eventName of eventNames) {
assertEventName(eventName);
const set = getListeners(this, eventName);
if (set) {
set.delete(listener);
if (set.size === 0) {
const events = eventsMap.get(this);
events.delete(eventName);
}
}
this.logIfDebugEnabled('unsubscribe', eventName, undefined);
if (!isMetaEvent(eventName)) {
emitMetaEvent(this, listenerRemoved, {eventName, listener});
}
}
}
once(eventNames) {
let off_;
const promise = new Promise(resolve => {
off_ = this.on(eventNames, data => {
off_();
resolve(data);
});
});
promise.off = off_;
return promise;
}
events(eventNames) {
eventNames = Array.isArray(eventNames) ? eventNames : [eventNames];
for (const eventName of eventNames) {
assertEventName(eventName);
}
return iterator(this, eventNames);
}
async emit(eventName, eventData) {
assertEventName(eventName);
if (isMetaEvent(eventName) && !canEmitMetaEvents) {
throw new TypeError('`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`');
}
this.logIfDebugEnabled('emit', eventName, eventData);
enqueueProducers(this, eventName, eventData);
const listeners = getListeners(this, eventName) ?? new Set();
const anyListeners = anyMap.get(this);
const staticListeners = [...listeners];
const staticAnyListeners = isMetaEvent(eventName) ? [] : [...anyListeners];
await resolvedPromise;
await Promise.all([
...staticListeners.map(async listener => {
if (listeners.has(listener)) {
return listener(eventData);
}
}),
...staticAnyListeners.map(async listener => {
if (anyListeners.has(listener)) {
return listener(eventName, eventData);
}
}),
]);
}
async emitSerial(eventName, eventData) {
assertEventName(eventName);
if (isMetaEvent(eventName) && !canEmitMetaEvents) {
throw new TypeError('`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`');
}
this.logIfDebugEnabled('emitSerial', eventName, eventData);
const listeners = getListeners(this, eventName) ?? new Set();
const anyListeners = anyMap.get(this);
const staticListeners = [...listeners];
const staticAnyListeners = [...anyListeners];
await resolvedPromise;
/* eslint-disable no-await-in-loop */
for (const listener of staticListeners) {
if (listeners.has(listener)) {
await listener(eventData);
}
}
for (const listener of staticAnyListeners) {
if (anyListeners.has(listener)) {
await listener(eventName, eventData);
}
}
/* eslint-enable no-await-in-loop */
}
onAny(listener) {
assertListener(listener);
this.logIfDebugEnabled('subscribeAny', undefined, undefined);
anyMap.get(this).add(listener);
emitMetaEvent(this, listenerAdded, {listener});
return this.offAny.bind(this, listener);
}
anyEvent() {
return iterator(this);
}
offAny(listener) {
assertListener(listener);
this.logIfDebugEnabled('unsubscribeAny', undefined, undefined);
emitMetaEvent(this, listenerRemoved, {listener});
anyMap.get(this).delete(listener);
}
clearListeners(eventNames) {
eventNames = Array.isArray(eventNames) ? eventNames : [eventNames];
for (const eventName of eventNames) {
this.logIfDebugEnabled('clear', eventName, undefined);
if (typeof eventName === 'string' || typeof eventName === 'symbol' || typeof eventName === 'number') {
const set = getListeners(this, eventName);
if (set) {
set.clear();
}
const producers = getEventProducers(this, eventName);
if (producers) {
for (const producer of producers) {
producer.finish();
}
producers.clear();
}
} else {
anyMap.get(this).clear();
for (const [eventName, listeners] of eventsMap.get(this).entries()) {
listeners.clear();
eventsMap.get(this).delete(eventName);
}
for (const [eventName, producers] of producersMap.get(this).entries()) {
for (const producer of producers) {
producer.finish();
}
producers.clear();
producersMap.get(this).delete(eventName);
}
}
}
}
listenerCount(eventNames) {
eventNames = Array.isArray(eventNames) ? eventNames : [eventNames];
let count = 0;
for (const eventName of eventNames) {
if (typeof eventName === 'string') {
count += anyMap.get(this).size
+ (getListeners(this, eventName)?.size ?? 0)
+ (getEventProducers(this, eventName)?.size ?? 0)
+ (getEventProducers(this)?.size ?? 0);
continue;
}
if (typeof eventName !== 'undefined') {
assertEventName(eventName);
}
count += anyMap.get(this).size;
for (const value of eventsMap.get(this).values()) {
count += value.size;
}
for (const value of producersMap.get(this).values()) {
count += value.size;
}
}
return count;
}
bindMethods(target, methodNames) {
if (typeof target !== 'object' || target === null) {
throw new TypeError('`target` must be an object');
}
methodNames = defaultMethodNamesOrAssert(methodNames);
for (const methodName of methodNames) {
if (target[methodName] !== undefined) {
throw new Error(`The property \`${methodName}\` already exists on \`target\``);
}
Object.defineProperty(target, methodName, {
enumerable: false,
value: this[methodName].bind(this),
});
}
}
}
const allEmitteryMethods = Object.getOwnPropertyNames(Emittery.prototype).filter(v => v !== 'constructor');
Object.defineProperty(Emittery, 'listenerAdded', {
value: listenerAdded,
writable: false,
enumerable: true,
configurable: false,
});
Object.defineProperty(Emittery, 'listenerRemoved', {
value: listenerRemoved,
writable: false,
enumerable: true,
configurable: false,
});
var __promiseToCancelable = promise => (res, rej) => {
let

@@ -1006,11 +1521,195 @@ resolveInner = res,

var __bi_tap = (fnf, fns, cc) => (resolve, reject) => cc(
ramda.tryCatch(ramda.o(resolve, ramda.tap(fns)), (e, ...args) => reject(e)),
ramda.tryCatch(ramda.o(reject, ramda.tap(fnf)), (e_fnf, e) => reject(e_fnf))
);
const
unity = () => undefined,
biChain = (fnRej, fn, cc) =>
(resolve, reject) => {
let cancel = unity;
const
resolveInner = x => {
cancel = fn(x)(resolve, reject);
},
rejectInner = e => {
cancel = fnRej(e)(resolve, reject);
};
cancel = cc(resolveInner, rejectInner);
return () => cancel();
};
const
share = cc => (function() {
const
emitter = new Emittery(),
doNothing = () => undefined;
// mutable state
let
cancelRunningComputation = doNothing(),
isFinallyResolved = false,
isFinallyRejected = false,
previousListenerCount = 0,
finalOutcome;
emitter.on(Emittery.listenerRemoved, (function() {
return function onListenerRemoved() {
//console.log(`listenerRemoved: count=${emitter.listenerCount("settle")}, previousCount=${previousListenerCount}`);
if ((emitter.listenerCount("settle") === 0) && (previousListenerCount > 0)
&& !isFinallyResolved && !isFinallyRejected) {
// abort the running computation if the number of consumers drops to zero
cancelRunningComputation();
}
previousListenerCount = emitter.listenerCount("settle");
};
}()));
emitter.on(Emittery.listenerAdded, (function() {
return function onListenerAdded() {
//console.log(`listenerAdded: count=${emitter.listenerCount("settle")}, previousCount=${previousListenerCount}`);
if ((emitter.listenerCount("settle") > 0) && (previousListenerCount === 0)) {
// run once for all when the number of consumers exceeds zero
cancelRunningComputation = cc(
value => {
finalOutcome = value;
isFinallyResolved = true;
emitter.emit("settle", {outcome: value, isSuccess: true});
},
error => {
finalOutcome = error;
isFinallyRejected = true;
emitter.emit("settle", {outcome: error, isSuccess: false});
}
);
}
previousListenerCount = emitter.listenerCount("settle");
};
}()));
return (resolve, reject) => {
if (isFinallyResolved) {
setTimeout(resolve, 0, finalOutcome);
return doNothing;
}
if (isFinallyRejected) {
setTimeout(reject, 0, finalOutcome);
return doNothing;
}
const
unConsume =
emitter.on("settle", ({isSuccess, outcome}) => {
(isSuccess ? resolve : reject)(outcome);
unConsume();
});
return unConsume;
};
}());
/**
* @typedef {function(function(*): void, function(*): void): function(): void} CancelableComputation
*/
const /**
* fantasy-land helper
* @param {CancelableComputation} cac
* @return {Cancelable<any>}
* @private
*/
__fantasyfy = cac => {
cac.map = cac['fantasy-land/map'] = fn => map(fn, cac);
cac.ap = cac['fantasy-land/ap'] = mfn => ap(mfn, cac);
cac.chain = cac['fantasy-land/chain'] = fn => chain(fn, cac);
/*
Reassigning the .constructor property apparently does not do much harm.
see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor
"There is nothing protecting the constructor property from being re-assigned or shadowed, so using it to detect the type of a variable should usually be avoided in favor of less fragile ways like instanceof and Symbol.toStringTag for objects, or typeof for primitives."
*/
cac.constructor = {
"fantasy-land/of": of,
"fantasy-land/zero": never
};
return cac;
},
//// Creation ////
// :: a -> Cancelable * a
of = a => __fantasyfy(laterSucceed(0, a)),
// :: * -> Cancelable *
reject = value => __fantasyfy(laterFail(0, value));
ramda.curry((dt, value) => __fantasyfy(laterSucceed(dt, value)));
ramda.curry((dt, value) => __fantasyfy(laterFail(dt, value)));
const never = () => __fantasyfy((unused, unusedToo) => () => {}),
//// Transformation ////
map = ramda.curry(
(fn, cc) => __fantasyfy(
(res, rej) => cc(ramda.o(res, fn), rej)
)
);
ramda.curry(
(fnLeft, fnRight, cc) => __fantasyfy((res, rej) =>
cc(ramda.o(res, fnRight), ramda.o(rej, fnLeft))
)
);
ramda.curry(
(onFailure, onSuccess, cc) => __fantasyfy(
(resolve, unused) => cc(ramda.o(resolve, onSuccess), ramda.o(resolve, onFailure))
)
);
const //// Combination ////
ap = ramda.curry((ccF, ccB) => __fantasyfy(ap$1(ccF, ccB))),
chain = ramda.curry((fn, cc) => __fantasyfy(chain$1(fn, cc)));
ramda.curry((fnRej, fn, cc) => __fantasyfy(biChain(fnRej, fn, cc)));
ramda.curry((ccA, ccB) => __fantasyfy(race(ccA, ccB)));
// Combination Derivatives //
ramda.curry((f, ma, mb) => ap(map(f, ma), mb));
ramda.curry((f, ma, mb, mc) => ap(ap(map(f, ma), mb), mc));
ramda.curry((f, ma, mb, mc, md) => ap(ap(ap(map(f, ma), mb), mc), md));
////// Side effects /////
ramda.curry((fnf, fns, cc) => __fantasyfy(__bi_tap(fnf, fns, cc)));
///// Misc /////
ramda.o(__fantasyfy, share);
/** @deprecated use Ramda's pluck */
// :: Cancelable c => k -> c {k: v} -> c v
ramda.curry((key, mc) => map(ramda.prop(key), mc));
let addFantasyLandInterface = __fantasyfy;
// :: Promise e a -> Cancelable e a
const promiseToCancelable = promise => {
const cancelable = _promiseToCancelable(promise);
addFantasyLandInterface(cancelable);
return cancelable;
};
const promiseToCancelable = ramda.o(addFantasyLandInterface, __promiseToCancelable);

@@ -1041,5 +1740,3 @@ const cancelableToPromise = cancelable => new Promise(cancelable);

addFantasyLandInterface(cancelable);
return cancelable;
return addFantasyLandInterface(cancelable);
};

@@ -1066,10 +1763,2 @@

// :: Number -> e -> Cancelable e *
const laterFail = ramda.curry((dt, value) => (unused, reject) => {
const timer = setTimeout(reject, dt, value);
return () => { clearTimeout(timer); };
});
const reject = value => fantasticCancelable({ap, chain, map, never, of})(laterFail(0, value));
var eitherToCancelable = either(reject, of);

@@ -1076,0 +1765,0 @@

@@ -106,3 +106,3 @@ {

"type": "module",
"version": "2.0.0-alpha.1"
"version": "2.0.0-alpha.2"
}
import { curryN } from "ramda";
import _promiseToCancelable from "./internal/_promiseToCancelable.js";
import __promiseToCancelable from "./internal/_promiseToCancelable.js";

@@ -21,3 +21,3 @@ const

cancelPromiseContinuation = _promiseToCancelable(promise)(resolve, reject);
cancelPromiseContinuation = __promiseToCancelable(promise)(resolve, reject);

@@ -24,0 +24,0 @@ return () => {

@@ -5,7 +5,7 @@ /***

import promiseToCancelable from "../transformations/promiseToCancelable.js";
import __promiseToCancelable from "./internal/_promiseToCancelable.js";
const
IS_ABORT_CONTROLLER_SUPPORTED = typeof AbortController === 'function',
/**

@@ -23,5 +23,5 @@ * @deprecated

abortController = IS_ABORT_CONTROLLER_SUPPORTED ? new AbortController() : undefined,
cancelPromiseContinuation =
promiseToCancelable(
__promiseToCancelable(
fetch(

@@ -32,6 +32,6 @@ url.toString(),

)(resolve, reject);
return () => {
cancelPromiseContinuation();
if (abortController) {

@@ -42,3 +42,3 @@ abortController.abort();

};
export default fetchResponse;

@@ -5,3 +5,3 @@ /***

import promiseToCancelable from "../transformations/promiseToCancelable.js";
import __promiseToCancelable from "./internal/_promiseToCancelable.js";

@@ -21,3 +21,3 @@ const

cancelPromiseContinuation =
promiseToCancelable(
__promiseToCancelable(
fetch(

@@ -24,0 +24,0 @@ url.toString(),

@@ -10,2 +10,3 @@ /**

import { Either, Left, Right } from "./either/mostly-adequate.js";
import sequence from './either/sequence.js';

@@ -76,12 +77,11 @@ /** @typedef {import('./either/mostly-adequate.js').Right | import('./either/mostly-adequate.js').Left} Either */

either(always(mb), of, ma)
);
),
/** @deprecated */
traverse = curry((of_f, map_f, effect_to_f, ma) => sequence(of_f, map_f, map(effect_to_f, ma)));
export {
Either, Left, Right,
alt, bimap, bi_tap, chain, chainLeft, either, fromAssertedValue, fromThrowable, isEither, isLeft, isRight, join, left, map, of, right
alt, bimap, bi_tap, chain, chainLeft, either, fromAssertedValue, fromThrowable, isEither, isLeft, isRight, join, left, map, of, right, sequence, traverse
};
// TODO: mark as deprecated
export {default as sequence} from './either/sequence.js';
export {default as traverse} from './either/traverse.js';
import * as Bacon from 'baconjs';
import addFantasyLandInterface from "../cancelable/addFantasyLandInterface.js";
import { addFantasyLandInterface as fantasyfy } from "../cancelable.js";

@@ -27,5 +27,3 @@ const

addFantasyLandInterface(cancelable);
return cancelable;
return fantasyfy(cancelable);
};

@@ -32,0 +30,0 @@

@@ -1,5 +0,4 @@

import of from "../cancelable/of.js";
import reject from '../cancelable/reject.js';
import {of, reject} from "../cancelable.js";
import {either} from '../either.js';
export default either(reject, of);
import {compose} from 'ramda';
import {just, maybe, nothing} from "../maybe.js";
import map_c from '../cancelable/map.js';
import of_c from '../cancelable/of.js';
import {map as map_c, of as of_c} from '../cancelable.js';

@@ -6,0 +5,0 @@ // A specialisation of the Maybe sequence:

// :: Promise e a -> Cancelable e a
import addFantasyLandInterface from "../cancelable/addFantasyLandInterface.js";
import _promiseToCancelable from "../cancelable/internal/_promiseToCancelable.js";
import { addFantasyLandInterface as fantasyfy } from "../cancelable.js";
import __promiseToCancelable from "../cancelable/internal/_promiseToCancelable.js";
import { o } from "ramda";
const promiseToCancelable = promise => {
const cancelable = _promiseToCancelable(promise);
addFantasyLandInterface(cancelable);
return cancelable;
};
const promiseToCancelable = o(fantasyfy, __promiseToCancelable);
export default promiseToCancelable;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc