flightdeck 0.2.19 → 0.2.21
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-D4EVARJP.js → chunk-Z5L2EOFC.js} +108 -106
- package/dist/chunk-Z5L2EOFC.js.map +1 -0
- package/dist/flightdeck.x.js +1 -1
- package/dist/lib.d.ts +2 -2
- package/dist/lib.js +1 -1
- package/package.json +9 -9
- package/dist/chunk-D4EVARJP.js.map +0 -1
|
@@ -486,19 +486,30 @@ var readOrComputeValue = (target, state) => {
|
|
|
486
486
|
target.logger.info(`\u{1F4D6}`, state.type, state.key, `reading cached value`);
|
|
487
487
|
return readCachedValue(state, target);
|
|
488
488
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
489
|
+
switch (state.type) {
|
|
490
|
+
case `selector`:
|
|
491
|
+
case `readonly_selector`:
|
|
492
|
+
target.logger.info(`\u{1F9EE}`, state.type, state.key, `computing value`);
|
|
493
|
+
return state.get();
|
|
494
|
+
case `atom`:
|
|
495
|
+
case `mutable_atom`: {
|
|
496
|
+
const def = state.default;
|
|
497
|
+
let fallback;
|
|
498
|
+
if (def instanceof Function) {
|
|
499
|
+
fallback = def();
|
|
500
|
+
} else {
|
|
501
|
+
fallback = def;
|
|
502
|
+
}
|
|
503
|
+
target.logger.info(
|
|
504
|
+
`\u{1F481}`,
|
|
505
|
+
`atom`,
|
|
506
|
+
state.key,
|
|
507
|
+
`could not find cached value; using default`,
|
|
508
|
+
fallback
|
|
509
|
+
);
|
|
510
|
+
return fallback;
|
|
511
|
+
}
|
|
492
512
|
}
|
|
493
|
-
const fallback = state.default instanceof Function ? state.default() : state.default;
|
|
494
|
-
target.logger.info(
|
|
495
|
-
`\u{1F481}`,
|
|
496
|
-
`atom`,
|
|
497
|
-
state.key,
|
|
498
|
-
`could not find cached value; using default`,
|
|
499
|
-
fallback
|
|
500
|
-
);
|
|
501
|
-
return state.default instanceof Function ? state.default() : state.default;
|
|
502
513
|
};
|
|
503
514
|
|
|
504
515
|
// ../atom.io/internal/src/operation.ts
|
|
@@ -626,55 +637,8 @@ var evictDownStream = (store, atom2) => {
|
|
|
626
637
|
}
|
|
627
638
|
};
|
|
628
639
|
|
|
629
|
-
// ../atom.io/internal/src/set-state/stow-update.ts
|
|
630
|
-
function shouldUpdateBeStowed(key, update) {
|
|
631
|
-
if (isTransceiver(update.newValue)) {
|
|
632
|
-
return false;
|
|
633
|
-
}
|
|
634
|
-
if (key.includes(`\u{1F50D}`)) {
|
|
635
|
-
return false;
|
|
636
|
-
}
|
|
637
|
-
return true;
|
|
638
|
-
}
|
|
639
|
-
var stowUpdate = (store, state, update) => {
|
|
640
|
-
const { key } = state;
|
|
641
|
-
const target = newest(store);
|
|
642
|
-
if (!isChildStore(target) || target.transactionMeta.phase !== `building`) {
|
|
643
|
-
store.logger.error(
|
|
644
|
-
`\u{1F41E}`,
|
|
645
|
-
`atom`,
|
|
646
|
-
key,
|
|
647
|
-
`stowUpdate called outside of a transaction. This is probably a bug.`
|
|
648
|
-
);
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
const shouldStow = shouldUpdateBeStowed(key, update);
|
|
652
|
-
if (!shouldStow) {
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
const atomUpdate = {
|
|
656
|
-
type: `atom_update`,
|
|
657
|
-
key,
|
|
658
|
-
...update
|
|
659
|
-
};
|
|
660
|
-
if (state.family) {
|
|
661
|
-
atomUpdate.family = state.family;
|
|
662
|
-
}
|
|
663
|
-
target.transactionMeta.update.updates.push(atomUpdate);
|
|
664
|
-
store.logger.info(
|
|
665
|
-
`\u{1F4C1}`,
|
|
666
|
-
`atom`,
|
|
667
|
-
key,
|
|
668
|
-
`stowed (`,
|
|
669
|
-
update.oldValue,
|
|
670
|
-
`->`,
|
|
671
|
-
update.newValue,
|
|
672
|
-
`)`
|
|
673
|
-
);
|
|
674
|
-
};
|
|
675
|
-
|
|
676
640
|
// ../atom.io/internal/src/set-state/set-atom.ts
|
|
677
|
-
var setAtom = (atom2, next
|
|
641
|
+
var setAtom = (target, atom2, next) => {
|
|
678
642
|
const oldValue = readOrComputeValue(target, atom2);
|
|
679
643
|
let newValue = oldValue;
|
|
680
644
|
if (atom2.type === `mutable_atom` && isChildStore(target)) {
|
|
@@ -691,23 +655,45 @@ var setAtom = (atom2, next, target) => {
|
|
|
691
655
|
markDone(target, atom2.key);
|
|
692
656
|
evictDownStream(target, atom2);
|
|
693
657
|
const update = { oldValue, newValue };
|
|
694
|
-
if (
|
|
658
|
+
if (!isChildStore(target)) {
|
|
695
659
|
emitUpdate(target, atom2, update);
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
let transceiver = target.valueMap.get(mutableKey);
|
|
703
|
-
if (mutableAtom.type === `mutable_atom` && isChildStore(target)) {
|
|
704
|
-
const { parent } = target;
|
|
705
|
-
const copiedValue = copyMutableIfNeeded(target, mutableAtom, parent);
|
|
706
|
-
transceiver = copiedValue;
|
|
707
|
-
}
|
|
708
|
-
const accepted = transceiver.do(update.newValue) === null;
|
|
709
|
-
if (accepted) evictDownStream(target, mutableAtom);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
if (target.on.transactionApplying.state === null) {
|
|
663
|
+
const { key } = atom2;
|
|
664
|
+
if (isTransceiver(update.newValue)) {
|
|
665
|
+
return;
|
|
710
666
|
}
|
|
667
|
+
const atomUpdate = {
|
|
668
|
+
type: `atom_update`,
|
|
669
|
+
key,
|
|
670
|
+
...update
|
|
671
|
+
};
|
|
672
|
+
if (atom2.family) {
|
|
673
|
+
atomUpdate.family = atom2.family;
|
|
674
|
+
}
|
|
675
|
+
target.transactionMeta.update.updates.push(atomUpdate);
|
|
676
|
+
target.logger.info(
|
|
677
|
+
`\u{1F4C1}`,
|
|
678
|
+
`atom`,
|
|
679
|
+
key,
|
|
680
|
+
`stowed (`,
|
|
681
|
+
update.oldValue,
|
|
682
|
+
`->`,
|
|
683
|
+
update.newValue,
|
|
684
|
+
`)`
|
|
685
|
+
);
|
|
686
|
+
} else if (atom2.key.startsWith(`*`)) {
|
|
687
|
+
const mutableKey = atom2.key.slice(1);
|
|
688
|
+
const mutableAtom = target.atoms.get(mutableKey);
|
|
689
|
+
let transceiver = target.valueMap.get(mutableKey);
|
|
690
|
+
if (mutableAtom.type === `mutable_atom` && isChildStore(target)) {
|
|
691
|
+
const { parent } = target;
|
|
692
|
+
const copiedValue = copyMutableIfNeeded(target, mutableAtom, parent);
|
|
693
|
+
transceiver = copiedValue;
|
|
694
|
+
}
|
|
695
|
+
const accepted = transceiver.do(update.newValue) === null;
|
|
696
|
+
if (accepted) evictDownStream(target, mutableAtom);
|
|
711
697
|
}
|
|
712
698
|
};
|
|
713
699
|
|
|
@@ -716,7 +702,7 @@ var setAtomOrSelector = (store, state, value) => {
|
|
|
716
702
|
switch (state.type) {
|
|
717
703
|
case `atom`:
|
|
718
704
|
case `mutable_atom`:
|
|
719
|
-
setAtom(state, value
|
|
705
|
+
setAtom(store, state, value);
|
|
720
706
|
break;
|
|
721
707
|
case `selector`:
|
|
722
708
|
state.set(value);
|
|
@@ -1160,13 +1146,34 @@ function ingestTransactionUpdate(applying, transactionUpdate, store) {
|
|
|
1160
1146
|
}
|
|
1161
1147
|
}
|
|
1162
1148
|
|
|
1149
|
+
// ../atom.io/internal/src/transaction/get-epoch-number.ts
|
|
1150
|
+
function getContinuityKey(store, transactionKey) {
|
|
1151
|
+
const continuity = store.transactionMeta.actionContinuities.getRelatedKey(transactionKey);
|
|
1152
|
+
return continuity;
|
|
1153
|
+
}
|
|
1154
|
+
function getEpochNumberOfContinuity(store, continuityKey) {
|
|
1155
|
+
const epoch = store.transactionMeta.epoch.get(continuityKey);
|
|
1156
|
+
return epoch;
|
|
1157
|
+
}
|
|
1158
|
+
function getEpochNumberOfAction(store, transactionKey) {
|
|
1159
|
+
const isRoot = isRootStore(store);
|
|
1160
|
+
if (!isRoot) {
|
|
1161
|
+
return void 0;
|
|
1162
|
+
}
|
|
1163
|
+
const continuityKey = getContinuityKey(store, transactionKey);
|
|
1164
|
+
if (continuityKey === void 0) {
|
|
1165
|
+
return void 0;
|
|
1166
|
+
}
|
|
1167
|
+
return getEpochNumberOfContinuity(store, continuityKey);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1163
1170
|
// ../atom.io/internal/src/transaction/set-epoch-number.ts
|
|
1164
1171
|
function setEpochNumberOfAction(store, transactionKey, newEpoch) {
|
|
1165
1172
|
const isRoot = isRootStore(store);
|
|
1166
1173
|
if (!isRoot) {
|
|
1167
1174
|
return;
|
|
1168
1175
|
}
|
|
1169
|
-
const continuityKey = store
|
|
1176
|
+
const continuityKey = getContinuityKey(store, transactionKey);
|
|
1170
1177
|
if (continuityKey !== void 0) {
|
|
1171
1178
|
store.transactionMeta.epoch.set(continuityKey, newEpoch);
|
|
1172
1179
|
}
|
|
@@ -1729,14 +1736,6 @@ function createTransaction(store, options) {
|
|
|
1729
1736
|
return token;
|
|
1730
1737
|
}
|
|
1731
1738
|
|
|
1732
|
-
// ../atom.io/internal/src/transaction/get-epoch-number.ts
|
|
1733
|
-
function getEpochNumberOfAction(store, transactionKey) {
|
|
1734
|
-
const isRoot = isRootStore(store);
|
|
1735
|
-
const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) : void 0;
|
|
1736
|
-
const epoch = isRoot && continuity !== void 0 ? store.transactionMeta.epoch.get(continuity) : void 0;
|
|
1737
|
-
return epoch;
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
1739
|
// ../atom.io/src/transaction.ts
|
|
1741
1740
|
function transaction(options) {
|
|
1742
1741
|
return createTransaction(IMPLICIT.STORE, options);
|
|
@@ -1831,7 +1830,7 @@ var Store = class {
|
|
|
1831
1830
|
lifespan: `ephemeral`
|
|
1832
1831
|
};
|
|
1833
1832
|
loggers = [
|
|
1834
|
-
new AtomIOLogger(`warn`, (_, __, key) => !key
|
|
1833
|
+
new AtomIOLogger(`warn`, (_, __, key) => !isReservedIntrospectionKey(key))
|
|
1835
1834
|
];
|
|
1836
1835
|
logger = {
|
|
1837
1836
|
error: (...messages) => {
|
|
@@ -1899,12 +1898,10 @@ var Store = class {
|
|
|
1899
1898
|
};
|
|
1900
1899
|
var IMPLICIT = {
|
|
1901
1900
|
get STORE() {
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1901
|
+
globalThis.ATOM_IO_IMPLICIT_STORE ??= new Store({
|
|
1902
|
+
name: `IMPLICIT_STORE`,
|
|
1903
|
+
lifespan: `ephemeral`
|
|
1904
|
+
});
|
|
1908
1905
|
return globalThis.ATOM_IO_IMPLICIT_STORE;
|
|
1909
1906
|
}
|
|
1910
1907
|
};
|
|
@@ -2899,18 +2896,18 @@ function isTransceiver(value) {
|
|
|
2899
2896
|
function copyMutableIfNeeded(target, atom2, origin) {
|
|
2900
2897
|
const originValue = origin.valueMap.get(atom2.key);
|
|
2901
2898
|
const targetValue = target.valueMap.get(atom2.key);
|
|
2902
|
-
if (originValue
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
return
|
|
2899
|
+
if (originValue !== targetValue) {
|
|
2900
|
+
return targetValue;
|
|
2901
|
+
}
|
|
2902
|
+
if (originValue === void 0) {
|
|
2903
|
+
return atom2.default();
|
|
2904
|
+
}
|
|
2905
|
+
origin.logger.info(`\u{1F4C3}`, `atom`, atom2.key, `copying`);
|
|
2906
|
+
const jsonValue = atom2.toJson(originValue);
|
|
2907
|
+
const copiedValue = atom2.fromJson(jsonValue);
|
|
2908
|
+
target.valueMap.set(atom2.key, copiedValue);
|
|
2909
|
+
new Tracker(atom2, origin);
|
|
2910
|
+
return copiedValue;
|
|
2914
2911
|
}
|
|
2915
2912
|
|
|
2916
2913
|
// ../atom.io/internal/src/caching.ts
|
|
@@ -3731,6 +3728,11 @@ function getInternalRelationsFromStore(token, store) {
|
|
|
3731
3728
|
return family;
|
|
3732
3729
|
}
|
|
3733
3730
|
|
|
3731
|
+
// ../atom.io/internal/src/reserved-keys.ts
|
|
3732
|
+
function isReservedIntrospectionKey(value) {
|
|
3733
|
+
return value.startsWith(`\u{1F50D} `);
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3734
3736
|
// ../atom.io/introspection/src/refinery.ts
|
|
3735
3737
|
var Refinery = class {
|
|
3736
3738
|
supported;
|
|
@@ -4774,5 +4776,5 @@ var FlightDeckLogger = class {
|
|
|
4774
4776
|
};
|
|
4775
4777
|
|
|
4776
4778
|
export { FLIGHTDECK_ERROR, FLIGHTDECK_INFO, FLIGHTDECK_LNAV_FORMAT, FLIGHTDECK_SETUP_PHASES, FLIGHTDECK_UPDATE_PHASES, FLIGHTDECK_WARN, FlightDeck, FlightDeckLogger, flightDeckLogSchema, isVersionNumber };
|
|
4777
|
-
//# sourceMappingURL=chunk-
|
|
4778
|
-
//# sourceMappingURL=chunk-
|
|
4779
|
+
//# sourceMappingURL=chunk-Z5L2EOFC.js.map
|
|
4780
|
+
//# sourceMappingURL=chunk-Z5L2EOFC.js.map
|