Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lom_atom

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lom_atom - npm Package Compare versions

Comparing version 3.0.16 to 3.0.17

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # Change Log

<a name="3.0.17"></a>
## [3.0.17](https://github.com/zerkalica/lom_atom/compare/v3.0.16...v3.0.17) (2017-12-09)
<a name="3.0.16"></a>

@@ -7,0 +12,0 @@ ## [3.0.16](https://github.com/zerkalica/lom_atom/compare/v3.0.15...v3.0.16) (2017-12-08)

119

dist/lom_atom.es.js

@@ -29,6 +29,8 @@ function _defineProperties(target, props) {

var ATOM_STATUS_DEEP_RESET = 5;
var catchedId = Symbol('lom_atom_catched');
var ATOM_FORCE_NONE = 0;
var ATOM_FORCE_CACHE = 1;
var ATOM_FORCE_ASYNC = 2;
var ATOM_FORCE_RETRY = 3;
var catchedId = Symbol('lom_cached');
var AtomWait =

@@ -55,29 +57,2 @@ /*#__PURE__*/

}(Error);
var atomId = Symbol('lom_atom');
var RecoverableError =
/*#__PURE__*/
function (_Error2) {
_inheritsLoose(RecoverableError, _Error2);
function RecoverableError(error, atom) {
var _this2;
_this2 = _Error2.call(this, error.message || error) || this;
_this2.retry = function () {
_this2[atomId].value(undefined, ATOM_FORCE_CACHE);
};
_this2.stack = error.stack // $FlowFixMe new.target
;
_this2['__proto__'] = new.target.prototype;
_this2[catchedId] = true;
_this2[atomId] = atom;
return _this2;
}
return RecoverableError;
}(Error);
function getId(t, hk) {

@@ -98,3 +73,3 @@ return (t.constructor.displayName || t.constructor.name) + "." + hk;

};
var origId = Symbol('orig_error');
var origId = Symbol('lom_error_orig');
var throwOnAccess = {

@@ -221,4 +196,6 @@ get: function get(target, key) {

if (this._slaves) this._slaves.forEach(checkSlave);
this._masters = null;
this._checkSlaves();
this._slaves = null;

@@ -237,2 +214,3 @@

this._keyHash = undefined;
this._retry = undefined;
};

@@ -242,11 +220,8 @@

var context = this._context;
var current = this.current;
if (forceCache === ATOM_FORCE_CACHE) {
if (next === undefined) {
// this._suggested = this._next
// this._next = undefined
if (this.current instanceof RecoverableError) {
this._next = this._suggested;
}
this._suggested = this._next;
this._next = undefined;
this.status = ATOM_STATUS_DEEP_RESET;

@@ -274,3 +249,3 @@ if (this._slaves) this._slaves.forEach(obsoleteSlave);

if (next !== undefined && (normalized = conform(next, this._suggested, this.isComponent)) !== this._suggested && (this.current instanceof Error || (normalized = conform(next, this.current, this.isComponent)) !== this.current)) {
if (next !== undefined && (normalized = conform(next, this._suggested, this.isComponent)) !== this._suggested && (current instanceof Error || (normalized = conform(next, current, this.isComponent)) !== current)) {
this._suggested = this._next = normalized;

@@ -283,3 +258,3 @@ this.status = ATOM_STATUS_OBSOLETE;

var current = this.current;
current = this.current;

@@ -313,12 +288,9 @@ if (current instanceof Error) {

Atom.deepReset = deepReset || new Set();
this._pullPush();
this.refresh();
Atom.deepReset = deepReset;
} else if (deepReset !== undefined && !this.manualReset && !deepReset.has(this)) {
deepReset.add(this);
this._pullPush();
this.refresh();
} else if (this.status !== ATOM_STATUS_ACTUAL) {
this._pullPush();
this.refresh();
}

@@ -328,3 +300,11 @@ };

_proto._push = function _push(nextRaw) {
if (!(nextRaw instanceof AtomWait)) {
this.status = ATOM_STATUS_ACTUAL;
var prev = this.current;
var next;
if (nextRaw instanceof Error) {
if (nextRaw[origId]) nextRaw = nextRaw[origId];
next = nextRaw;
} else {
next = conform(nextRaw, prev, this.isComponent);
this._suggested = this._next;

@@ -334,6 +314,2 @@ this._next = undefined;

this.status = ATOM_STATUS_ACTUAL;
var prev = this.current;
var next = nextRaw instanceof Error ? nextRaw[origId] || nextRaw : conform(nextRaw, prev, this.isComponent);
if (prev !== next) {

@@ -348,3 +324,3 @@ this.current = next;

_proto._pullPush = function _pullPush() {
_proto.refresh = function refresh() {
var masters = this._masters;

@@ -373,3 +349,3 @@

newValue = error instanceof AtomWait || error instanceof RecoverableError ? error : new RecoverableError(error, this);
newValue = error;
}

@@ -427,2 +403,17 @@

_proto.getRetry = function getRetry() {
var _this = this;
if (this._retry === undefined) {
var fn = function fn() {
return _this.refresh();
};
setFunctionName(fn, "atom(" + this.displayName + ").retry()");
this._retry = fn;
}
return this._retry;
};
_createClass(Atom, [{

@@ -728,3 +719,3 @@ key: "displayName",

var isForceCache = 0;
var forceCache = ATOM_FORCE_NONE;

@@ -749,3 +740,3 @@ function mem(proto, name, descr, deepReset) {

return atom.value(next, isForceCache);
return forceCache === ATOM_FORCE_RETRY ? atom : atom.value(next, forceCache);
}

@@ -828,3 +819,3 @@

return atom.value(next, isForceCache);
return forceCache === ATOM_FORCE_RETRY ? atom : atom.value(next, forceCache);
}

@@ -843,20 +834,30 @@

function cache(data) {
isForceCache = 0;
forceCache = ATOM_FORCE_NONE;
return data;
}
function getRetryResult(atom) {
forceCache = ATOM_FORCE_NONE;
return atom.getRetry();
}
Object.defineProperties(mem, {
cache: {
get: function get() {
isForceCache = 1;
forceCache = ATOM_FORCE_CACHE;
return cache;
}
},
getRetry: {
get: function get() {
forceCache = ATOM_FORCE_RETRY;
return getRetryResult;
}
},
async: {
get: function get() {
isForceCache = 2;
forceCache = ATOM_FORCE_ASYNC;
return cache;
}
},
// unchanged: {value}
manual: {

@@ -921,3 +922,3 @@ value: memManual

export { Atom, action, detached, mem, ConsoleLogger, defaultContext, RecoverableError, AtomWait };
export { Atom, action, detached, mem, ConsoleLogger, defaultContext, AtomWait };
//# sourceMappingURL=lom_atom.es.js.map

@@ -33,6 +33,8 @@ 'use strict';

var ATOM_STATUS_DEEP_RESET = 5;
var catchedId = Symbol('lom_atom_catched');
var ATOM_FORCE_NONE = 0;
var ATOM_FORCE_CACHE = 1;
var ATOM_FORCE_ASYNC = 2;
var ATOM_FORCE_RETRY = 3;
var catchedId = Symbol('lom_cached');
var AtomWait =

@@ -59,29 +61,2 @@ /*#__PURE__*/

}(Error);
var atomId = Symbol('lom_atom');
var RecoverableError =
/*#__PURE__*/
function (_Error2) {
_inheritsLoose(RecoverableError, _Error2);
function RecoverableError(error, atom) {
var _this2;
_this2 = _Error2.call(this, error.message || error) || this;
_this2.retry = function () {
_this2[atomId].value(undefined, ATOM_FORCE_CACHE);
};
_this2.stack = error.stack // $FlowFixMe new.target
;
_this2['__proto__'] = new.target.prototype;
_this2[catchedId] = true;
_this2[atomId] = atom;
return _this2;
}
return RecoverableError;
}(Error);
function getId(t, hk) {

@@ -102,3 +77,3 @@ return (t.constructor.displayName || t.constructor.name) + "." + hk;

};
var origId = Symbol('orig_error');
var origId = Symbol('lom_error_orig');
var throwOnAccess = {

@@ -225,4 +200,6 @@ get: function get(target, key) {

if (this._slaves) this._slaves.forEach(checkSlave);
this._masters = null;
this._checkSlaves();
this._slaves = null;

@@ -241,2 +218,3 @@

this._keyHash = undefined;
this._retry = undefined;
};

@@ -246,11 +224,8 @@

var context = this._context;
var current = this.current;
if (forceCache === ATOM_FORCE_CACHE) {
if (next === undefined) {
// this._suggested = this._next
// this._next = undefined
if (this.current instanceof RecoverableError) {
this._next = this._suggested;
}
this._suggested = this._next;
this._next = undefined;
this.status = ATOM_STATUS_DEEP_RESET;

@@ -278,3 +253,3 @@ if (this._slaves) this._slaves.forEach(obsoleteSlave);

if (next !== undefined && (normalized = conform(next, this._suggested, this.isComponent)) !== this._suggested && (this.current instanceof Error || (normalized = conform(next, this.current, this.isComponent)) !== this.current)) {
if (next !== undefined && (normalized = conform(next, this._suggested, this.isComponent)) !== this._suggested && (current instanceof Error || (normalized = conform(next, current, this.isComponent)) !== current)) {
this._suggested = this._next = normalized;

@@ -287,3 +262,3 @@ this.status = ATOM_STATUS_OBSOLETE;

var current = this.current;
current = this.current;

@@ -317,12 +292,9 @@ if (current instanceof Error) {

Atom.deepReset = deepReset || new Set();
this._pullPush();
this.refresh();
Atom.deepReset = deepReset;
} else if (deepReset !== undefined && !this.manualReset && !deepReset.has(this)) {
deepReset.add(this);
this._pullPush();
this.refresh();
} else if (this.status !== ATOM_STATUS_ACTUAL) {
this._pullPush();
this.refresh();
}

@@ -332,3 +304,11 @@ };

_proto._push = function _push(nextRaw) {
if (!(nextRaw instanceof AtomWait)) {
this.status = ATOM_STATUS_ACTUAL;
var prev = this.current;
var next;
if (nextRaw instanceof Error) {
if (nextRaw[origId]) nextRaw = nextRaw[origId];
next = nextRaw;
} else {
next = conform(nextRaw, prev, this.isComponent);
this._suggested = this._next;

@@ -338,6 +318,2 @@ this._next = undefined;

this.status = ATOM_STATUS_ACTUAL;
var prev = this.current;
var next = nextRaw instanceof Error ? nextRaw[origId] || nextRaw : conform(nextRaw, prev, this.isComponent);
if (prev !== next) {

@@ -352,3 +328,3 @@ this.current = next;

_proto._pullPush = function _pullPush() {
_proto.refresh = function refresh() {
var masters = this._masters;

@@ -377,3 +353,3 @@

newValue = error instanceof AtomWait || error instanceof RecoverableError ? error : new RecoverableError(error, this);
newValue = error;
}

@@ -431,2 +407,17 @@

_proto.getRetry = function getRetry() {
var _this = this;
if (this._retry === undefined) {
var fn = function fn() {
return _this.refresh();
};
setFunctionName(fn, "atom(" + this.displayName + ").retry()");
this._retry = fn;
}
return this._retry;
};
_createClass(Atom, [{

@@ -732,3 +723,3 @@ key: "displayName",

var isForceCache = 0;
var forceCache = ATOM_FORCE_NONE;

@@ -753,3 +744,3 @@ function mem(proto, name, descr, deepReset) {

return atom.value(next, isForceCache);
return forceCache === ATOM_FORCE_RETRY ? atom : atom.value(next, forceCache);
}

@@ -832,3 +823,3 @@

return atom.value(next, isForceCache);
return forceCache === ATOM_FORCE_RETRY ? atom : atom.value(next, forceCache);
}

@@ -847,20 +838,30 @@

function cache(data) {
isForceCache = 0;
forceCache = ATOM_FORCE_NONE;
return data;
}
function getRetryResult(atom) {
forceCache = ATOM_FORCE_NONE;
return atom.getRetry();
}
Object.defineProperties(mem, {
cache: {
get: function get() {
isForceCache = 1;
forceCache = ATOM_FORCE_CACHE;
return cache;
}
},
getRetry: {
get: function get() {
forceCache = ATOM_FORCE_RETRY;
return getRetryResult;
}
},
async: {
get: function get() {
isForceCache = 2;
forceCache = ATOM_FORCE_ASYNC;
return cache;
}
},
// unchanged: {value}
manual: {

@@ -931,4 +932,3 @@ value: memManual

exports.defaultContext = defaultContext;
exports.RecoverableError = RecoverableError;
exports.AtomWait = AtomWait;
//# sourceMappingURL=lom_atom.js.map

@@ -35,6 +35,8 @@ (function (global, factory) {

var ATOM_STATUS_DEEP_RESET = 5;
var catchedId = Symbol('lom_atom_catched');
var ATOM_FORCE_NONE = 0;
var ATOM_FORCE_CACHE = 1;
var ATOM_FORCE_ASYNC = 2;
var ATOM_FORCE_RETRY = 3;
var catchedId = Symbol('lom_cached');
var AtomWait =

@@ -61,29 +63,2 @@ /*#__PURE__*/

}(Error);
var atomId = Symbol('lom_atom');
var RecoverableError =
/*#__PURE__*/
function (_Error2) {
_inheritsLoose(RecoverableError, _Error2);
function RecoverableError(error, atom) {
var _this2;
_this2 = _Error2.call(this, error.message || error) || this;
_this2.retry = function () {
_this2[atomId].value(undefined, ATOM_FORCE_CACHE);
};
_this2.stack = error.stack // $FlowFixMe new.target
;
_this2['__proto__'] = new.target.prototype;
_this2[catchedId] = true;
_this2[atomId] = atom;
return _this2;
}
return RecoverableError;
}(Error);
function getId(t, hk) {

@@ -104,3 +79,3 @@ return (t.constructor.displayName || t.constructor.name) + "." + hk;

};
var origId = Symbol('orig_error');
var origId = Symbol('lom_error_orig');
var throwOnAccess = {

@@ -227,4 +202,6 @@ get: function get(target, key) {

if (this._slaves) this._slaves.forEach(checkSlave);
this._masters = null;
this._checkSlaves();
this._slaves = null;

@@ -243,2 +220,3 @@

this._keyHash = undefined;
this._retry = undefined;
};

@@ -248,11 +226,8 @@

var context = this._context;
var current = this.current;
if (forceCache === ATOM_FORCE_CACHE) {
if (next === undefined) {
// this._suggested = this._next
// this._next = undefined
if (this.current instanceof RecoverableError) {
this._next = this._suggested;
}
this._suggested = this._next;
this._next = undefined;
this.status = ATOM_STATUS_DEEP_RESET;

@@ -280,3 +255,3 @@ if (this._slaves) this._slaves.forEach(obsoleteSlave);

if (next !== undefined && (normalized = conform(next, this._suggested, this.isComponent)) !== this._suggested && (this.current instanceof Error || (normalized = conform(next, this.current, this.isComponent)) !== this.current)) {
if (next !== undefined && (normalized = conform(next, this._suggested, this.isComponent)) !== this._suggested && (current instanceof Error || (normalized = conform(next, current, this.isComponent)) !== current)) {
this._suggested = this._next = normalized;

@@ -289,3 +264,3 @@ this.status = ATOM_STATUS_OBSOLETE;

var current = this.current;
current = this.current;

@@ -319,12 +294,9 @@ if (current instanceof Error) {

Atom.deepReset = deepReset || new Set();
this._pullPush();
this.refresh();
Atom.deepReset = deepReset;
} else if (deepReset !== undefined && !this.manualReset && !deepReset.has(this)) {
deepReset.add(this);
this._pullPush();
this.refresh();
} else if (this.status !== ATOM_STATUS_ACTUAL) {
this._pullPush();
this.refresh();
}

@@ -334,3 +306,11 @@ };

_proto._push = function _push(nextRaw) {
if (!(nextRaw instanceof AtomWait)) {
this.status = ATOM_STATUS_ACTUAL;
var prev = this.current;
var next;
if (nextRaw instanceof Error) {
if (nextRaw[origId]) nextRaw = nextRaw[origId];
next = nextRaw;
} else {
next = conform(nextRaw, prev, this.isComponent);
this._suggested = this._next;

@@ -340,6 +320,2 @@ this._next = undefined;

this.status = ATOM_STATUS_ACTUAL;
var prev = this.current;
var next = nextRaw instanceof Error ? nextRaw[origId] || nextRaw : conform(nextRaw, prev, this.isComponent);
if (prev !== next) {

@@ -354,3 +330,3 @@ this.current = next;

_proto._pullPush = function _pullPush() {
_proto.refresh = function refresh() {
var masters = this._masters;

@@ -379,3 +355,3 @@

newValue = error instanceof AtomWait || error instanceof RecoverableError ? error : new RecoverableError(error, this);
newValue = error;
}

@@ -433,2 +409,17 @@

_proto.getRetry = function getRetry() {
var _this = this;
if (this._retry === undefined) {
var fn = function fn() {
return _this.refresh();
};
setFunctionName(fn, "atom(" + this.displayName + ").retry()");
this._retry = fn;
}
return this._retry;
};
_createClass(Atom, [{

@@ -734,3 +725,3 @@ key: "displayName",

var isForceCache = 0;
var forceCache = ATOM_FORCE_NONE;

@@ -755,3 +746,3 @@ function mem(proto, name, descr, deepReset) {

return atom.value(next, isForceCache);
return forceCache === ATOM_FORCE_RETRY ? atom : atom.value(next, forceCache);
}

@@ -834,3 +825,3 @@

return atom.value(next, isForceCache);
return forceCache === ATOM_FORCE_RETRY ? atom : atom.value(next, forceCache);
}

@@ -849,20 +840,30 @@

function cache(data) {
isForceCache = 0;
forceCache = ATOM_FORCE_NONE;
return data;
}
function getRetryResult(atom) {
forceCache = ATOM_FORCE_NONE;
return atom.getRetry();
}
Object.defineProperties(mem, {
cache: {
get: function get() {
isForceCache = 1;
forceCache = ATOM_FORCE_CACHE;
return cache;
}
},
getRetry: {
get: function get() {
forceCache = ATOM_FORCE_RETRY;
return getRetryResult;
}
},
async: {
get: function get() {
isForceCache = 2;
forceCache = ATOM_FORCE_ASYNC;
return cache;
}
},
// unchanged: {value}
manual: {

@@ -933,3 +934,2 @@ value: memManual

exports.defaultContext = defaultContext;
exports.RecoverableError = RecoverableError;
exports.AtomWait = AtomWait;

@@ -936,0 +936,0 @@

{
"name": "lom_atom",
"version": "3.0.16",
"version": "3.0.17",
"description": "Alternative implementation of eigenmethod mol_atom state management library",

@@ -5,0 +5,0 @@ "publishConfig": {

// @flow
import {
catchedId,
ATOM_FORCE_NONE, ATOM_FORCE_CACHE, ATOM_FORCE_ASYNC,

@@ -21,3 +20,3 @@ ATOM_STATUS_DESTROYED,

import {AtomWait, RecoverableError, origId, proxify} from './utils'
import {AtomWait, setFunctionName, origId, catchedId, proxify} from './utils'
import conform from './conform'

@@ -112,4 +111,4 @@

}
if (this._slaves) this._slaves.forEach(checkSlave)
this._masters = null
this._checkSlaves()
this._slaves = null

@@ -125,2 +124,3 @@ this._hostAtoms.delete(((this._keyHash || this.owner): any))

this._keyHash = undefined
this._retry = undefined
}

@@ -130,9 +130,7 @@

const context = this._context
let current: V | Error = this.current
if (forceCache === ATOM_FORCE_CACHE) {
if (next === undefined) {
// this._suggested = this._next
// this._next = undefined
if (this.current instanceof RecoverableError) {
this._next = this._suggested
}
this._suggested = this._next
this._next = undefined
this.status = ATOM_STATUS_DEEP_RESET

@@ -160,4 +158,4 @@ if (this._slaves) this._slaves.forEach(obsoleteSlave)

&& (
this.current instanceof Error
|| (normalized = conform(next, this.current, this.isComponent)) !== this.current
current instanceof Error
|| (normalized = conform(next, current, this.isComponent)) !== current
)

@@ -170,3 +168,3 @@ ) {

}
const current: V | Error = this.current
current = this.current
if (current instanceof Error) {

@@ -200,9 +198,9 @@ if (forceCache !== ATOM_FORCE_NONE) return proxify((current: any))

Atom.deepReset = deepReset || new Set()
this._pullPush()
this.refresh()
Atom.deepReset = deepReset
} else if (deepReset !== undefined && !this.manualReset && !deepReset.has(this)) {
deepReset.add(this)
this._pullPush()
this.refresh()
} else if (this.status !== ATOM_STATUS_ACTUAL) {
this._pullPush()
this.refresh()
}

@@ -212,11 +210,13 @@ }

_push(nextRaw: V | Error): void {
if (!(nextRaw instanceof AtomWait)) {
this.status = ATOM_STATUS_ACTUAL
const prev = this.current
let next: V | Error
if (nextRaw instanceof Error) {
if ((nextRaw: Object)[origId]) nextRaw = (nextRaw: Object)[origId]
next = nextRaw
} else {
next = conform(nextRaw, prev, this.isComponent)
this._suggested = this._next
this._next = undefined
}
this.status = ATOM_STATUS_ACTUAL
const prev = this.current
const next: V | Error = nextRaw instanceof Error
? (nextRaw: Object)[origId] || nextRaw
: conform(nextRaw, prev, this.isComponent)

@@ -230,3 +230,3 @@ if (prev !== next) {

_pullPush(): void {
refresh(): void {
const masters = this._masters

@@ -255,8 +255,5 @@ if (masters) {

}
newValue = error instanceof AtomWait || error instanceof RecoverableError
? error
: new RecoverableError(error, this)
newValue = error
}
context.current = slave
if (this.status !== ATOM_STATUS_DEEP_RESET) this._push(newValue)

@@ -304,2 +301,14 @@ }

}
_retry: (() => void) | void
getRetry(): () => void {
if (this._retry === undefined) {
const fn = () => this.refresh()
setFunctionName(fn, `atom(${this.displayName}).retry()`)
this._retry = fn
}
return this._retry
}
}
// @flow
import type {TypedPropertyDescriptor, IAtom, IAtomStatus} from '../interfaces'
import {ATOM_STATUS_DEEP_RESET} from '../interfaces'
import type {TypedPropertyDescriptor, IAtom, IAtomForce, IAtomStatus} from '../interfaces'
import {ATOM_STATUS_DEEP_RESET, ATOM_FORCE_NONE, ATOM_FORCE_RETRY, ATOM_FORCE_CACHE, ATOM_FORCE_ASYNC} from '../interfaces'
import {defaultContext} from '../Context'

@@ -29,3 +29,3 @@ import {getId, setFunctionName} from '../utils'

let isForceCache = 0
let forceCache: IAtomForce = ATOM_FORCE_NONE

@@ -55,3 +55,3 @@ function mem<V>(

}
return atom.value(next, isForceCache)
return forceCache === ATOM_FORCE_RETRY ? (atom: any) : atom.value(next, forceCache)
}

@@ -142,4 +142,3 @@ if (descr.value !== undefined) {

}
return atom.value(next, isForceCache)
return forceCache === ATOM_FORCE_RETRY ? (atom: any) : atom.value(next, forceCache)
}

@@ -164,20 +163,30 @@

function cache<V>(data: V): V {
isForceCache = 0
forceCache = ATOM_FORCE_NONE
return data
}
function getRetryResult<V>(atom: IAtom<V>): () => void {
forceCache = ATOM_FORCE_NONE
return atom.getRetry()
}
Object.defineProperties(mem, {
cache: ({
get<V>(): (v: V) => V {
isForceCache = 1
forceCache = ATOM_FORCE_CACHE
return cache
}
}: any),
getRetry: ({
get<V>(): (v: IAtom<V>) => () => void {
forceCache = ATOM_FORCE_RETRY
return getRetryResult
}
}: any),
async: ({
get<V>(): (v: V) => V {
isForceCache = 2
forceCache = ATOM_FORCE_ASYNC
return cache
}
}: any),
// unchanged: {value}
manual: { value: memManual },

@@ -198,5 +207,5 @@ key: { value: memkey }

async<V>(v: V): V;
getRetry<V>(v: V): () => void;
key: IMemKey;
}
export default ((mem: any): IMem)

@@ -9,3 +9,3 @@ // @flow

export {defaultContext} from './Context'
export {RecoverableError, AtomWait} from './utils'
export {AtomWait} from './utils'

@@ -12,0 +12,0 @@ export type {

@@ -44,3 +44,2 @@ // @flow

export const catchedId = Symbol('lom_atom_catched')
export type IAtomStatus = typeof ATOM_STATUS_OBSOLETE

@@ -53,4 +52,5 @@ | typeof ATOM_STATUS_CHECKING | typeof ATOM_STATUS_PULLING | typeof ATOM_STATUS_ACTUAL

export const ATOM_FORCE_ASYNC: 2 = 2
export const ATOM_FORCE_RETRY: 3 = 3
export type IAtomForce = typeof ATOM_FORCE_NONE | typeof ATOM_FORCE_CACHE | typeof ATOM_FORCE_ASYNC
export type IAtomForce = typeof ATOM_FORCE_NONE | typeof ATOM_FORCE_CACHE | typeof ATOM_FORCE_ASYNC | typeof ATOM_FORCE_RETRY

@@ -63,3 +63,5 @@ export interface IAtom<V> {

value(v?: V | Error, forceCache?: IAtomForce): V;
refresh(): void;
destructor(): void;
getRetry(): () => void;
}

@@ -66,0 +68,0 @@

// @flow
import {ATOM_FORCE_CACHE, catchedId} from './interfaces'
import {ATOM_FORCE_CACHE} from './interfaces'
import type {IAtom} from './interfaces'
export const catchedId = Symbol('lom_cached')
export class AtomWait extends Error {

@@ -14,18 +15,3 @@ constructor(message?: string = 'Wait...') {

}
const atomId = Symbol('lom_atom')
export class RecoverableError<V> extends Error {
constructor(error: Error, atom: IAtom<V>) {
super(error.message || error)
this.stack = error.stack
// $FlowFixMe new.target
;(this: Object)['__proto__'] = new.target.prototype
;(this: Object)[catchedId] = true
;(this: Object)[atomId] = atom
}
retry = () => {
;(this: Object)[atomId].value(undefined, ATOM_FORCE_CACHE)
}
}
export function getId(t: Object, hk: string): string {

@@ -45,3 +31,3 @@ return `${t.constructor.displayName || t.constructor.name}.${hk}`

export const origId = Symbol('orig_error')
export const origId = Symbol('lom_error_orig')
const throwOnAccess = {

@@ -48,0 +34,0 @@ get<V: Object>(target: Error, key: string): V {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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