atom.io 0.18.1 → 0.18.2
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/chunk-3J2EGSBE.js +31 -0
- package/dist/chunk-3J2EGSBE.js.map +1 -0
- package/dist/{chunk-JDUNWJFB.js → chunk-A4ZCNKWQ.js} +2 -2
- package/dist/chunk-A4ZCNKWQ.js.map +1 -0
- package/internal/dist/index.cjs +46 -100
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.ts +23 -23
- package/internal/dist/index.js +46 -100
- package/internal/dist/index.js.map +1 -1
- package/internal/src/families/create-regular-atom-family.ts +4 -4
- package/internal/src/get-state/get-from-store.ts +2 -5
- package/internal/src/mutable/create-mutable-atom-family.ts +4 -4
- package/internal/src/selector/register-selector.ts +3 -14
- package/internal/src/set-state/set-into-store.ts +2 -5
- package/internal/src/store/withdraw-new-family-member.ts +38 -28
- package/internal/src/store/withdraw.ts +20 -23
- package/internal/src/subscribe/subscribe-to-state.ts +2 -3
- package/internal/src/subscribe/subscribe-to-timeline.ts +0 -5
- package/internal/src/subscribe/subscribe-to-transaction.ts +0 -5
- package/internal/src/timeline/add-atom-to-timeline.ts +6 -15
- package/internal/src/timeline/create-timeline.ts +0 -27
- package/package.json +6 -5
- package/react/dist/index.cjs +2 -3
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.js +2 -3
- package/react/dist/index.js.map +1 -1
- package/react/src/use-tl.ts +2 -2
- package/react-devtools/dist/index.cjs +1 -1
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.js +1 -1
- package/realtime-client/dist/index.cjs +1 -1
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.js +13 -37
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-server/dist/index.cjs +3 -3
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.js +3 -3
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/src/ipc-sockets/parent-socket.ts +4 -3
- package/realtime-testing/dist/index.cjs +43 -5
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.js +4 -5
- package/realtime-testing/dist/index.js.map +1 -1
- package/realtime-testing/src/setup-realtime-test.tsx +3 -5
- package/dist/chunk-JDUNWJFB.js.map +0 -1
package/internal/dist/index.d.ts
CHANGED
|
@@ -243,28 +243,28 @@ declare const IMPLICIT: {
|
|
|
243
243
|
declare const clearStore: (store: Store) => void;
|
|
244
244
|
|
|
245
245
|
type Withdrawable = Atom<any> | AtomFamily<any, any> | MutableAtom<any, any> | MutableAtomFamily<any, any, any> | ReadableState<any> | ReadableState<any> | ReadonlySelector<any> | ReadonlySelectorFamily<any, any> | RegularAtom<any> | RegularAtomFamily<any, any> | Selector<any> | SelectorFamily<any, any> | Timeline<any> | Transaction<any> | WritableSelector<any> | WritableSelectorFamily<any, any> | WritableState<any>;
|
|
246
|
-
declare function withdraw<T>(token: RegularAtomToken<T>, store: Store): RegularAtom<T
|
|
247
|
-
declare function withdraw<T extends Transceiver<any>>(token: MutableAtomToken<T, any>, store: Store): MutableAtom<T, any
|
|
248
|
-
declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T
|
|
249
|
-
declare function withdraw<T>(token: WritableSelectorToken<T>, store: Store): WritableSelector<T
|
|
250
|
-
declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T
|
|
251
|
-
declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T
|
|
252
|
-
declare function withdraw<T>(token: WritableToken<T>, store: Store): WritableState<T
|
|
253
|
-
declare function withdraw<T>(token: ReadableToken<T>, store: Store): ReadableState<T
|
|
254
|
-
declare function withdraw<T, K extends Json.Serializable>(token: RegularAtomFamilyToken<T, K>, store: Store): RegularAtomFamily<T, K
|
|
255
|
-
declare function withdraw<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(token: MutableAtomFamilyToken<T, J, K>, store: Store): MutableAtomFamily<T, J, K
|
|
256
|
-
declare function withdraw<T, K extends Json.Serializable>(token: AtomFamilyToken<T>, store: Store): AtomFamily<T, any
|
|
257
|
-
declare function withdraw<T, K extends Json.Serializable>(token: ReadonlySelectorFamilyToken<T, K>, store: Store): ReadonlySelectorFamily<T, any
|
|
258
|
-
declare function withdraw<T, K extends Json.Serializable>(token: WritableSelectorFamilyToken<T, K>, store: Store): WritableSelectorFamily<T, any
|
|
259
|
-
declare function withdraw<T, K extends Json.Serializable>(token: SelectorFamilyToken<T, K>, store: Store): SelectorFamily<T, any
|
|
260
|
-
declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transaction<T extends _n ? T : never
|
|
261
|
-
declare function withdraw<T>(token: TimelineToken<T>, store: Store): Timeline<T extends TimelineManageable ? T : never
|
|
262
|
-
|
|
263
|
-
declare function
|
|
264
|
-
declare function
|
|
265
|
-
declare function
|
|
266
|
-
declare function
|
|
267
|
-
declare function
|
|
246
|
+
declare function withdraw<T>(token: RegularAtomToken<T>, store: Store): RegularAtom<T>;
|
|
247
|
+
declare function withdraw<T extends Transceiver<any>>(token: MutableAtomToken<T, any>, store: Store): MutableAtom<T, any>;
|
|
248
|
+
declare function withdraw<T>(token: AtomToken<T>, store: Store): Atom<T>;
|
|
249
|
+
declare function withdraw<T>(token: WritableSelectorToken<T>, store: Store): WritableSelector<T>;
|
|
250
|
+
declare function withdraw<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T>;
|
|
251
|
+
declare function withdraw<T>(token: SelectorToken<T>, store: Store): Selector<T>;
|
|
252
|
+
declare function withdraw<T>(token: WritableToken<T>, store: Store): WritableState<T>;
|
|
253
|
+
declare function withdraw<T>(token: ReadableToken<T>, store: Store): ReadableState<T>;
|
|
254
|
+
declare function withdraw<T, K extends Json.Serializable>(token: RegularAtomFamilyToken<T, K>, store: Store): RegularAtomFamily<T, K>;
|
|
255
|
+
declare function withdraw<T extends Transceiver<any>, J extends Json.Serializable, K extends Json.Serializable>(token: MutableAtomFamilyToken<T, J, K>, store: Store): MutableAtomFamily<T, J, K>;
|
|
256
|
+
declare function withdraw<T, K extends Json.Serializable>(token: AtomFamilyToken<T>, store: Store): AtomFamily<T, any>;
|
|
257
|
+
declare function withdraw<T, K extends Json.Serializable>(token: ReadonlySelectorFamilyToken<T, K>, store: Store): ReadonlySelectorFamily<T, any>;
|
|
258
|
+
declare function withdraw<T, K extends Json.Serializable>(token: WritableSelectorFamilyToken<T, K>, store: Store): WritableSelectorFamily<T, any>;
|
|
259
|
+
declare function withdraw<T, K extends Json.Serializable>(token: SelectorFamilyToken<T, K>, store: Store): SelectorFamily<T, any>;
|
|
260
|
+
declare function withdraw<T>(token: TransactionToken<T>, store: Store): Transaction<T extends _n ? T : never>;
|
|
261
|
+
declare function withdraw<T>(token: TimelineToken<T>, store: Store): Timeline<T extends TimelineManageable ? T : never>;
|
|
262
|
+
|
|
263
|
+
declare function withdrawOrCreate<T>(token: RegularAtomToken<T>, store: Store): Atom<T>;
|
|
264
|
+
declare function withdrawOrCreate<T>(token: WritableSelectorToken<T>, store: Store): WritableSelector<T>;
|
|
265
|
+
declare function withdrawOrCreate<T>(token: ReadonlySelectorToken<T>, store: Store): ReadonlySelector<T>;
|
|
266
|
+
declare function withdrawOrCreate<T>(token: WritableToken<T>, store: Store): WritableState<T>;
|
|
267
|
+
declare function withdrawOrCreate<T>(token: ReadableToken<T>, store: Store): ReadableState<T>;
|
|
268
268
|
|
|
269
269
|
interface Transceiver<Signal extends Json.Serializable> {
|
|
270
270
|
do: (update: Signal) => number | `OUT_OF_RANGE` | null;
|
|
@@ -484,4 +484,4 @@ type Selector<T> = ReadonlySelector<T> | WritableSelector<T>;
|
|
|
484
484
|
type WritableState<T> = Atom<T> | WritableSelector<T>;
|
|
485
485
|
type ReadableState<T> = Atom<T> | Selector<T>;
|
|
486
486
|
|
|
487
|
-
export { type Atom, type AtomIOState, type AtomKey, type ChildStore, type EnvironmentData, FamilyTracker, Future, IMPLICIT, LazyMap, type Lineage, type Modify, type MutableAtom, NotFoundError, type OperationProgress, type ReadableState, type ReadonlySelector, type ReadonlySelectorKey, type RegularAtom, type RootStore, type Selector, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type Withdrawable, type WritableSelector, type WritableState, abortTransaction, actUponStore, addAtomToTimeline, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deleteAtom, deleteSelector, deposit, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, ingestAtomUpdate, ingestSelectorUpdate, ingestTransactionUpdate, isAtomDefault, isAtomKey, isChildStore, isDone, isMutable, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw,
|
|
487
|
+
export { type Atom, type AtomIOState, type AtomKey, type ChildStore, type EnvironmentData, FamilyTracker, Future, IMPLICIT, LazyMap, type Lineage, type Modify, type MutableAtom, NotFoundError, type OperationProgress, type ReadableState, type ReadonlySelector, type ReadonlySelectorKey, type RegularAtom, type RootStore, type Selector, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineSelectorUpdate, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type Withdrawable, type WritableSelector, type WritableState, abortTransaction, actUponStore, addAtomToTimeline, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deleteAtom, deleteSelector, deposit, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, ingestAtomUpdate, ingestSelectorUpdate, ingestTransactionUpdate, isAtomDefault, isAtomKey, isChildStore, isDone, isMutable, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw, withdrawOrCreate };
|
package/internal/dist/index.js
CHANGED
|
@@ -226,27 +226,37 @@ function withdraw(token, store) {
|
|
|
226
226
|
}
|
|
227
227
|
target = target.child;
|
|
228
228
|
}
|
|
229
|
+
throw new NotFoundError(token, store);
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
// internal/src/store/withdraw-new-family-member.ts
|
|
232
|
-
function
|
|
233
|
-
|
|
234
|
-
store
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
233
|
+
function withdrawOrCreate(token, store) {
|
|
234
|
+
try {
|
|
235
|
+
const state = withdraw(token, store);
|
|
236
|
+
return state;
|
|
237
|
+
} catch (notFoundError) {
|
|
238
|
+
if (token.family) {
|
|
239
|
+
store.logger.info(
|
|
240
|
+
`\u{1F46A}`,
|
|
241
|
+
token.type,
|
|
242
|
+
token.key,
|
|
243
|
+
`creating new family member in store "${store.config.name}"`
|
|
244
|
+
);
|
|
245
|
+
const target = newest(store);
|
|
246
|
+
const family = target.families.get(token.family.key);
|
|
247
|
+
if (family) {
|
|
248
|
+
const jsonSubKey = JSON.parse(token.family.subKey);
|
|
249
|
+
family(jsonSubKey);
|
|
250
|
+
const state = withdraw(token, store);
|
|
251
|
+
return state;
|
|
252
|
+
}
|
|
253
|
+
throw new NotFoundError(
|
|
254
|
+
{ key: token.family.key, type: `${token.type}_family` },
|
|
255
|
+
store
|
|
256
|
+
);
|
|
247
257
|
}
|
|
258
|
+
throw notFoundError;
|
|
248
259
|
}
|
|
249
|
-
return void 0;
|
|
250
260
|
}
|
|
251
261
|
|
|
252
262
|
// internal/src/future.ts
|
|
@@ -359,10 +369,11 @@ function createRegularAtomFamily(options, store) {
|
|
|
359
369
|
const subKey = stringifyJson(key);
|
|
360
370
|
const family = { key: options.key, subKey };
|
|
361
371
|
const fullKey = `${options.key}(${subKey})`;
|
|
362
|
-
const
|
|
372
|
+
const target2 = newest(store);
|
|
373
|
+
const atomAlreadyCreated = target2.atoms.has(fullKey);
|
|
363
374
|
let token;
|
|
364
|
-
if (
|
|
365
|
-
token =
|
|
375
|
+
if (atomAlreadyCreated) {
|
|
376
|
+
token = { type: `atom`, key: fullKey, family };
|
|
366
377
|
} else {
|
|
367
378
|
const individualOptions = {
|
|
368
379
|
key: fullKey,
|
|
@@ -720,15 +731,11 @@ var setAtomOrSelector = (state, value, store) => {
|
|
|
720
731
|
|
|
721
732
|
// internal/src/set-state/set-into-store.ts
|
|
722
733
|
function setIntoStore(token, value, store) {
|
|
723
|
-
var _a;
|
|
724
734
|
const rejection = openOperation(token, store);
|
|
725
735
|
if (rejection) {
|
|
726
736
|
return;
|
|
727
737
|
}
|
|
728
|
-
const state = (
|
|
729
|
-
if (state === void 0) {
|
|
730
|
-
throw new NotFoundError(token, store);
|
|
731
|
-
}
|
|
738
|
+
const state = withdrawOrCreate(token, store);
|
|
732
739
|
setAtomOrSelector(state, value, store);
|
|
733
740
|
closeOperation(store);
|
|
734
741
|
}
|
|
@@ -813,14 +820,8 @@ var updateSelectorAtoms = (selectorKey, dependency, store) => {
|
|
|
813
820
|
// internal/src/selector/register-selector.ts
|
|
814
821
|
var registerSelector = (selectorKey, store) => ({
|
|
815
822
|
get: (dependency) => {
|
|
816
|
-
var _a;
|
|
817
823
|
const target = newest(store);
|
|
818
|
-
const dependencyState = (
|
|
819
|
-
if (dependencyState === void 0) {
|
|
820
|
-
throw new Error(
|
|
821
|
-
`State "${dependency.key}" not found in store "${store.config.name}".`
|
|
822
|
-
);
|
|
823
|
-
}
|
|
824
|
+
const dependencyState = withdrawOrCreate(dependency, store);
|
|
824
825
|
const dependencyValue = readOrComputeValue(dependencyState, store);
|
|
825
826
|
store.logger.info(
|
|
826
827
|
`\u{1F50C}`,
|
|
@@ -843,12 +844,7 @@ var registerSelector = (selectorKey, store) => ({
|
|
|
843
844
|
return dependencyValue;
|
|
844
845
|
},
|
|
845
846
|
set: (WritableToken, newValue) => {
|
|
846
|
-
const state =
|
|
847
|
-
if (state === void 0) {
|
|
848
|
-
throw new Error(
|
|
849
|
-
`State "${WritableToken.key}" not found in this store. Did you forget to initialize with the "atom" or "selector" function?`
|
|
850
|
-
);
|
|
851
|
-
}
|
|
847
|
+
const state = withdrawOrCreate(WritableToken, store);
|
|
852
848
|
setAtomOrSelector(state, newValue, store);
|
|
853
849
|
},
|
|
854
850
|
find: (token, key) => findInStore(token, key, store)
|
|
@@ -1036,8 +1032,7 @@ var subscribeToRootAtoms = (selector, store) => {
|
|
|
1036
1032
|
|
|
1037
1033
|
// internal/src/subscribe/subscribe-to-state.ts
|
|
1038
1034
|
function subscribeToState(token, handleUpdate, key, store) {
|
|
1039
|
-
|
|
1040
|
-
const state = (_a = withdraw(token, store)) != null ? _a : withdrawNewFamilyMember(token, store);
|
|
1035
|
+
const state = withdrawOrCreate(token, store);
|
|
1041
1036
|
if (state === void 0) {
|
|
1042
1037
|
throw new Error(
|
|
1043
1038
|
`State "${token.key}" not found in this store. Did you forget to initialize with the "atom" or "selector" function?`
|
|
@@ -1072,11 +1067,6 @@ function subscribeToState(token, handleUpdate, key, store) {
|
|
|
1072
1067
|
// internal/src/subscribe/subscribe-to-timeline.ts
|
|
1073
1068
|
var subscribeToTimeline = (token, handleUpdate, key, store) => {
|
|
1074
1069
|
const tl = withdraw(token, store);
|
|
1075
|
-
if (tl === void 0) {
|
|
1076
|
-
throw new Error(
|
|
1077
|
-
`Cannot subscribe to timeline "${token.key}": timeline not found in store "${store.config.name}".`
|
|
1078
|
-
);
|
|
1079
|
-
}
|
|
1080
1070
|
store.logger.info(`\u{1F440}`, `timeline`, token.key, `Adding subscription "${key}"`);
|
|
1081
1071
|
const unsubscribe = tl.subject.subscribe(key, handleUpdate);
|
|
1082
1072
|
return () => {
|
|
@@ -1093,11 +1083,6 @@ var subscribeToTimeline = (token, handleUpdate, key, store) => {
|
|
|
1093
1083
|
// internal/src/subscribe/subscribe-to-transaction.ts
|
|
1094
1084
|
var subscribeToTransaction = (token, handleUpdate, key, store) => {
|
|
1095
1085
|
const tx = withdraw(token, store);
|
|
1096
|
-
if (tx === void 0) {
|
|
1097
|
-
throw new Error(
|
|
1098
|
-
`Cannot subscribe to transaction "${token.key}": transaction not found in store "${store.config.name}".`
|
|
1099
|
-
);
|
|
1100
|
-
}
|
|
1101
1086
|
store.logger.info(
|
|
1102
1087
|
`\u{1F440}`,
|
|
1103
1088
|
`transaction`,
|
|
@@ -1372,10 +1357,11 @@ function createMutableAtomFamily(options, store) {
|
|
|
1372
1357
|
const subKey = stringifyJson(key);
|
|
1373
1358
|
const family = { key: options.key, subKey };
|
|
1374
1359
|
const fullKey = `${options.key}(${subKey})`;
|
|
1375
|
-
const
|
|
1360
|
+
const target2 = newest(store);
|
|
1361
|
+
const atomAlreadyCreated = target2.atoms.has(fullKey);
|
|
1376
1362
|
let token;
|
|
1377
|
-
if (
|
|
1378
|
-
token =
|
|
1363
|
+
if (atomAlreadyCreated) {
|
|
1364
|
+
token = { type: `mutable_atom`, key: fullKey, family };
|
|
1379
1365
|
} else {
|
|
1380
1366
|
const individualOptions = {
|
|
1381
1367
|
key: fullKey,
|
|
@@ -1598,11 +1584,7 @@ function getEnvironmentData(store) {
|
|
|
1598
1584
|
|
|
1599
1585
|
// internal/src/get-state/get-from-store.ts
|
|
1600
1586
|
function getFromStore(token, store) {
|
|
1601
|
-
|
|
1602
|
-
const state = (_a = withdraw(token, store)) != null ? _a : withdrawNewFamilyMember(token, store);
|
|
1603
|
-
if (state === void 0) {
|
|
1604
|
-
throw new NotFoundError(token, store);
|
|
1605
|
-
}
|
|
1587
|
+
const state = withdrawOrCreate(token, store);
|
|
1606
1588
|
return readOrComputeValue(state, store);
|
|
1607
1589
|
}
|
|
1608
1590
|
|
|
@@ -1674,16 +1656,11 @@ var LazyMap = class extends Map {
|
|
|
1674
1656
|
// internal/src/timeline/add-atom-to-timeline.ts
|
|
1675
1657
|
var addAtomToTimeline = (atomToken, tl, store) => {
|
|
1676
1658
|
let maybeAtom = withdraw(atomToken, store);
|
|
1677
|
-
if (
|
|
1659
|
+
if (maybeAtom.type === `mutable_atom`) {
|
|
1678
1660
|
const updateToken = getUpdateToken(maybeAtom);
|
|
1679
1661
|
maybeAtom = withdraw(updateToken, store);
|
|
1680
1662
|
}
|
|
1681
1663
|
const atom = maybeAtom;
|
|
1682
|
-
if (atom === void 0) {
|
|
1683
|
-
throw new Error(
|
|
1684
|
-
`Cannot subscribe to atom "${atomToken.key}" because it has not been initialized in store "${store.config.name}"`
|
|
1685
|
-
);
|
|
1686
|
-
}
|
|
1687
1664
|
store.timelineAtoms.set({ atomKey: atom.key, timelineKey: tl.key });
|
|
1688
1665
|
atom.subject.subscribe(`timeline`, (update) => {
|
|
1689
1666
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -1715,15 +1692,11 @@ var addAtomToTimeline = (atomToken, tl, store) => {
|
|
|
1715
1692
|
}
|
|
1716
1693
|
}
|
|
1717
1694
|
if (currentTransactionKey) {
|
|
1718
|
-
const
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
throw new Error(
|
|
1724
|
-
`Transaction "${currentTransactionKey}" not found in store "${store.config.name}". This is surprising, because we are in the application phase of "${currentTransactionKey}".`
|
|
1725
|
-
);
|
|
1726
|
-
}
|
|
1695
|
+
const txToken = {
|
|
1696
|
+
key: currentTransactionKey,
|
|
1697
|
+
type: `transaction`
|
|
1698
|
+
};
|
|
1699
|
+
const currentTransaction = withdraw(txToken, store);
|
|
1727
1700
|
if (tl.transactionKey !== currentTransactionKey) {
|
|
1728
1701
|
if (tl.transactionKey) {
|
|
1729
1702
|
store.logger.error(
|
|
@@ -1895,15 +1868,6 @@ function createTimeline(options, store, data) {
|
|
|
1895
1868
|
if (tokenOrFamily.type === `atom_family` || tokenOrFamily.type === `mutable_atom_family`) {
|
|
1896
1869
|
const familyToken = tokenOrFamily;
|
|
1897
1870
|
const family = withdraw(familyToken, store);
|
|
1898
|
-
if (family === void 0) {
|
|
1899
|
-
store.logger.error(
|
|
1900
|
-
`\u274C`,
|
|
1901
|
-
`timeline`,
|
|
1902
|
-
options.key,
|
|
1903
|
-
`Failed to add family "${familyToken.key}" because it does not exist in the store`
|
|
1904
|
-
);
|
|
1905
|
-
continue;
|
|
1906
|
-
}
|
|
1907
1871
|
const familyKey = family.key;
|
|
1908
1872
|
target.timelineAtoms.set({ atomKey: familyKey, timelineKey });
|
|
1909
1873
|
family.subject.subscribe(`timeline:${options.key}`, (token2) => {
|
|
@@ -1916,26 +1880,8 @@ function createTimeline(options, store, data) {
|
|
|
1916
1880
|
}
|
|
1917
1881
|
} else {
|
|
1918
1882
|
let atom = withdraw(tokenOrFamily, store);
|
|
1919
|
-
if (atom === void 0) {
|
|
1920
|
-
store.logger.error(
|
|
1921
|
-
`\u274C`,
|
|
1922
|
-
`timeline`,
|
|
1923
|
-
options.key,
|
|
1924
|
-
`Failed to add atom "${atomKey}" because it does not exist in the store`
|
|
1925
|
-
);
|
|
1926
|
-
continue;
|
|
1927
|
-
}
|
|
1928
1883
|
if (isMutable(atom)) {
|
|
1929
1884
|
const updateAtom = withdraw(getUpdateToken(atom), store);
|
|
1930
|
-
if (updateAtom === void 0) {
|
|
1931
|
-
store.logger.error(
|
|
1932
|
-
`\u274C`,
|
|
1933
|
-
`timeline`,
|
|
1934
|
-
options.key,
|
|
1935
|
-
`Failed to add update atom "${atomKey}" because it does not exist in the store`
|
|
1936
|
-
);
|
|
1937
|
-
continue;
|
|
1938
|
-
}
|
|
1939
1885
|
atom = updateAtom;
|
|
1940
1886
|
atomKey = atom.key;
|
|
1941
1887
|
}
|
|
@@ -2277,6 +2223,6 @@ function getEpochNumberOfAction(transactionKey, store) {
|
|
|
2277
2223
|
// internal/src/transaction/index.ts
|
|
2278
2224
|
var TRANSACTION_PHASES = [`idle`, `building`, `applying`];
|
|
2279
2225
|
|
|
2280
|
-
export { FamilyTracker, Future, IMPLICIT, LazyMap, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, addAtomToTimeline, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deleteAtom, deleteSelector, deposit, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, ingestAtomUpdate, ingestSelectorUpdate, ingestTransactionUpdate, isAtomDefault, isAtomKey, isChildStore, isDone, isMutable, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw,
|
|
2226
|
+
export { FamilyTracker, Future, IMPLICIT, LazyMap, NotFoundError, StatefulSubject, Store, Subject, TRANSACTION_PHASES, Tracker, abortTransaction, actUponStore, addAtomToTimeline, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deleteAtom, deleteSelector, deposit, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, ingestAtomUpdate, ingestSelectorUpdate, ingestTransactionUpdate, isAtomDefault, isAtomKey, isChildStore, isDone, isMutable, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw, withdrawOrCreate };
|
|
2281
2227
|
//# sourceMappingURL=out.js.map
|
|
2282
2228
|
//# sourceMappingURL=index.js.map
|