atom.io 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/dist/index.cjs +17 -1
- package/data/dist/index.js +1 -1
- package/data/src/join.ts +30 -1
- package/dist/chunk-6MLFYN32.js +18 -0
- package/dist/{chunk-JA4V7TJY.js → chunk-7DT3PVS3.js} +18 -2
- package/dist/chunk-OAYGID5B.js +27 -0
- package/dist/index.cjs +2 -11
- package/dist/index.d.ts +51 -23
- package/dist/index.js +2 -11
- package/eslint-plugin/dist/index.cjs +0 -1
- package/eslint-plugin/dist/index.js +0 -1
- package/eslint-plugin/src/rules/lifespan.ts +0 -1
- package/immortal/dist/index.cjs +180 -20
- package/immortal/dist/index.js +134 -19
- package/immortal/src/index.ts +1 -0
- package/immortal/src/make-molecule.ts +222 -0
- package/immortal/src/molecule.ts +49 -16
- package/immortal/src/seek-state.ts +15 -2
- package/internal/dist/index.cjs +1119 -754
- package/internal/dist/index.d.ts +109 -12
- package/internal/dist/index.js +1098 -760
- package/internal/src/atom/create-regular-atom.ts +0 -2
- package/internal/src/atom/create-standalone-atom.ts +6 -2
- package/internal/src/atom/dispose-atom.ts +22 -2
- package/internal/src/families/create-readonly-selector-family.ts +7 -2
- package/internal/src/families/create-regular-atom-family.ts +6 -2
- package/internal/src/families/create-writable-selector-family.ts +7 -2
- package/internal/src/families/dispose-from-store.ts +22 -0
- package/internal/src/families/find-in-store.ts +0 -1
- package/internal/src/families/index.ts +1 -0
- package/internal/src/families/init-family-member.ts +22 -1
- package/internal/src/families/seek-in-store.ts +23 -6
- package/internal/src/ingest-updates/index.ts +1 -0
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +104 -0
- package/internal/src/ingest-updates/ingest-transaction-update.ts +26 -4
- package/internal/src/mutable/create-mutable-atom-family.ts +6 -2
- package/internal/src/mutable/create-mutable-atom.ts +0 -2
- package/internal/src/mutable/get-json-token.ts +0 -1
- package/internal/src/mutable/tracker-family.ts +7 -7
- package/internal/src/not-found-error.ts +5 -0
- package/internal/src/selector/create-readonly-selector.ts +2 -3
- package/internal/src/selector/create-standalone-selector.ts +6 -2
- package/internal/src/selector/create-writable-selector.ts +2 -3
- package/internal/src/selector/dispose-selector.ts +32 -5
- package/internal/src/selector/register-selector.ts +2 -0
- package/internal/src/set-state/stow-update.ts +5 -1
- package/internal/src/store/deposit.ts +41 -7
- package/internal/src/store/store.ts +11 -0
- package/internal/src/store/withdraw.ts +28 -1
- package/internal/src/timeline/add-atom-to-timeline.ts +206 -182
- package/internal/src/timeline/create-timeline.ts +181 -60
- package/internal/src/timeline/time-travel.ts +20 -0
- package/internal/src/transaction/apply-transaction.ts +2 -12
- package/internal/src/transaction/build-transaction.ts +11 -2
- package/introspection/dist/index.cjs +2 -1
- package/introspection/dist/index.js +2 -1
- package/introspection/src/attach-timeline-family.ts +1 -0
- package/json/dist/index.cjs +3 -3
- package/json/dist/index.js +6 -5
- package/json/src/select-json-family.ts +3 -4
- package/package.json +5 -5
- package/react-devtools/dist/index.cjs +58 -47
- package/react-devtools/dist/index.js +60 -48
- package/react-devtools/src/TimelineIndex.tsx +15 -13
- package/react-devtools/src/Updates.tsx +41 -32
- package/realtime-server/dist/index.cjs +21 -10
- package/realtime-server/dist/index.d.ts +1 -1
- package/realtime-server/dist/index.js +21 -11
- package/realtime-server/src/realtime-server-stores/server-sync-store.ts +21 -11
- package/realtime-testing/dist/index.cjs +1 -0
- package/realtime-testing/dist/index.js +1 -1
- package/src/atom.ts +9 -3
- package/src/dispose-state.ts +3 -12
- package/src/index.ts +4 -0
- package/src/selector.ts +3 -3
- package/src/subscribe.ts +8 -4
- package/src/timeline.ts +18 -1
- package/src/transaction.ts +56 -4
- package/dist/chunk-BF4MVQF6.js +0 -44
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pipe, ifDefined, isArray, isRecord, doesExtend, isPlainObject, raiseError, sprawl, fallback, doNothing, become, mapObject, delve } from '../../dist/chunk-3V3VWQ7X.js';
|
|
2
2
|
import { lazyLocalStorageEffect } from '../../dist/chunk-BWWVY5O5.js';
|
|
3
|
-
import {
|
|
3
|
+
import { isString, isNumber, isBoolean } from '../../dist/chunk-6MLFYN32.js';
|
|
4
|
+
import { JSON_TYPE_NAMES, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-OAYGID5B.js';
|
|
4
5
|
import { __spreadProps, __spreadValues, __objRest, __restKey } from '../../dist/chunk-F2X4B4VY.js';
|
|
5
6
|
import { selectorFamily, atom, atomFamily, undo, redo, getState } from 'atom.io';
|
|
6
7
|
import { attachIntrospectionStates } from 'atom.io/introspection';
|
|
@@ -1621,25 +1622,28 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
|
|
|
1621
1622
|
] }),
|
|
1622
1623
|
/* @__PURE__ */ jsxs("section", { className: "transaction_impact", children: [
|
|
1623
1624
|
/* @__PURE__ */ jsx("span", { className: "detail", children: "impact: " }),
|
|
1624
|
-
transactionUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1625
|
+
transactionUpdate.updates.filter((token) => `key` in token && !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
|
|
1626
|
+
switch (update.type) {
|
|
1627
|
+
case `atom_update`:
|
|
1628
|
+
case `selector_update`:
|
|
1629
|
+
return /* @__PURE__ */ jsx(
|
|
1630
|
+
article.AtomUpdate,
|
|
1631
|
+
{
|
|
1632
|
+
serialNumber: index,
|
|
1633
|
+
atomUpdate: update
|
|
1634
|
+
},
|
|
1635
|
+
`${transactionUpdate.key}:${index}:${update.key}`
|
|
1636
|
+
);
|
|
1637
|
+
case `transaction_update`:
|
|
1638
|
+
return /* @__PURE__ */ jsx(
|
|
1639
|
+
TransactionUpdateFC,
|
|
1640
|
+
{
|
|
1641
|
+
serialNumber: index,
|
|
1642
|
+
transactionUpdate: update
|
|
1643
|
+
},
|
|
1644
|
+
`${transactionUpdate.key}:${index}:${update.key}`
|
|
1645
|
+
);
|
|
1634
1646
|
}
|
|
1635
|
-
return /* @__PURE__ */ jsx(
|
|
1636
|
-
TransactionUpdateFC,
|
|
1637
|
-
{
|
|
1638
|
-
serialNumber: index,
|
|
1639
|
-
transactionUpdate: update
|
|
1640
|
-
},
|
|
1641
|
-
`${transactionUpdate.key}:${index}:${update.key}`
|
|
1642
|
-
);
|
|
1643
1647
|
})
|
|
1644
1648
|
] })
|
|
1645
1649
|
] })
|
|
@@ -1648,7 +1652,7 @@ var TransactionUpdateFC = ({ serialNumber, transactionUpdate }) => {
|
|
|
1648
1652
|
);
|
|
1649
1653
|
};
|
|
1650
1654
|
var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
|
|
1651
|
-
return /* @__PURE__ */ jsxs(
|
|
1655
|
+
return `key` in timelineUpdate ? /* @__PURE__ */ jsxs(
|
|
1652
1656
|
"article",
|
|
1653
1657
|
{
|
|
1654
1658
|
className: "node timeline_update",
|
|
@@ -1662,22 +1666,28 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
|
|
|
1662
1666
|
timelineUpdate.key,
|
|
1663
1667
|
")"
|
|
1664
1668
|
] }) }),
|
|
1665
|
-
/* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1669
|
+
/* @__PURE__ */ jsx("main", { children: timelineUpdate.type === `transaction_update` ? timelineUpdate.updates.filter((token) => `key` in token && !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((update, index) => {
|
|
1670
|
+
switch (update.type) {
|
|
1671
|
+
case `atom_update`:
|
|
1672
|
+
case `selector_update`:
|
|
1673
|
+
return /* @__PURE__ */ jsx(
|
|
1674
|
+
article.AtomUpdate,
|
|
1675
|
+
{
|
|
1676
|
+
serialNumber: index,
|
|
1677
|
+
atomUpdate: update
|
|
1678
|
+
},
|
|
1679
|
+
`${timelineUpdate.key}:${index}:${update.key}`
|
|
1680
|
+
);
|
|
1681
|
+
case `transaction_update`:
|
|
1682
|
+
return /* @__PURE__ */ jsx(
|
|
1683
|
+
TransactionUpdateFC,
|
|
1684
|
+
{
|
|
1685
|
+
serialNumber: index,
|
|
1686
|
+
transactionUpdate: update
|
|
1687
|
+
},
|
|
1688
|
+
`${timelineUpdate.key}:${index}:${update.key}`
|
|
1689
|
+
);
|
|
1690
|
+
}
|
|
1681
1691
|
}) : timelineUpdate.type === `selector_update` ? timelineUpdate.atomUpdates.filter((token) => !token.key.startsWith(`\u{1F441}\u200D\u{1F5E8}`)).map((atomUpdate, index) => {
|
|
1682
1692
|
return /* @__PURE__ */ jsx(
|
|
1683
1693
|
article.AtomUpdate,
|
|
@@ -1696,7 +1706,7 @@ var TimelineUpdateFC = ({ timelineUpdate, serialNumber }) => {
|
|
|
1696
1706
|
) : null })
|
|
1697
1707
|
]
|
|
1698
1708
|
}
|
|
1699
|
-
);
|
|
1709
|
+
) : null;
|
|
1700
1710
|
};
|
|
1701
1711
|
var article = {
|
|
1702
1712
|
AtomUpdate: AtomUpdateFC,
|
|
@@ -1756,17 +1766,19 @@ var TimelineLog = ({ token, isOpenState, timelineState }) => {
|
|
|
1756
1766
|
] })
|
|
1757
1767
|
] })
|
|
1758
1768
|
] }),
|
|
1759
|
-
isOpen ? /* @__PURE__ */ jsx("main", { children: timeline.history.map(
|
|
1760
|
-
index
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1769
|
+
isOpen ? /* @__PURE__ */ jsx("main", { children: timeline.history.map(
|
|
1770
|
+
(update, index) => `key` in update ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1771
|
+
index === timeline.at ? /* @__PURE__ */ jsx(YouAreHere, {}) : null,
|
|
1772
|
+
/* @__PURE__ */ jsx(
|
|
1773
|
+
article.TimelineUpdate,
|
|
1774
|
+
{
|
|
1775
|
+
timelineUpdate: update,
|
|
1776
|
+
serialNumber: index
|
|
1777
|
+
}
|
|
1778
|
+
),
|
|
1779
|
+
index === timeline.history.length - 1 && timeline.at === timeline.history.length ? /* @__PURE__ */ jsx(YouAreHere, {}) : null
|
|
1780
|
+
] }, update.key + index + timeline.at) : null
|
|
1781
|
+
) }) : null
|
|
1770
1782
|
] });
|
|
1771
1783
|
};
|
|
1772
1784
|
var TimelineIndex = () => {
|
|
@@ -64,19 +64,21 @@ export const TimelineLog: FC<{
|
|
|
64
64
|
</header>
|
|
65
65
|
{isOpen ? (
|
|
66
66
|
<main>
|
|
67
|
-
{timeline.history.map((update, index) =>
|
|
68
|
-
|
|
69
|
-
{index
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
{timeline.history.map((update, index) =>
|
|
68
|
+
`key` in update ? (
|
|
69
|
+
<Fragment key={update.key + index + timeline.at}>
|
|
70
|
+
{index === timeline.at ? <YouAreHere /> : null}
|
|
71
|
+
<article.TimelineUpdate
|
|
72
|
+
timelineUpdate={update}
|
|
73
|
+
serialNumber={index}
|
|
74
|
+
/>
|
|
75
|
+
{index === timeline.history.length - 1 &&
|
|
76
|
+
timeline.at === timeline.history.length ? (
|
|
77
|
+
<YouAreHere />
|
|
78
|
+
) : null}
|
|
79
|
+
</Fragment>
|
|
80
|
+
) : null,
|
|
81
|
+
)}
|
|
80
82
|
</main>
|
|
81
83
|
) : null}
|
|
82
84
|
</section>
|
|
@@ -91,24 +91,27 @@ const TransactionUpdateFC: React.FC<{
|
|
|
91
91
|
<section className="transaction_impact">
|
|
92
92
|
<span className="detail">impact: </span>
|
|
93
93
|
{transactionUpdate.updates
|
|
94
|
-
.filter((token) => !token.key.startsWith(`👁🗨`))
|
|
94
|
+
.filter((token) => `key` in token && !token.key.startsWith(`👁🗨`))
|
|
95
95
|
.map((update, index) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
switch (update.type) {
|
|
97
|
+
case `atom_update`:
|
|
98
|
+
case `selector_update`:
|
|
99
|
+
return (
|
|
100
|
+
<article.AtomUpdate
|
|
101
|
+
key={`${transactionUpdate.key}:${index}:${update.key}`}
|
|
102
|
+
serialNumber={index}
|
|
103
|
+
atomUpdate={update}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
case `transaction_update`:
|
|
107
|
+
return (
|
|
108
|
+
<TransactionUpdateFC
|
|
109
|
+
key={`${transactionUpdate.key}:${index}:${update.key}`}
|
|
110
|
+
serialNumber={index}
|
|
111
|
+
transactionUpdate={update}
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
104
114
|
}
|
|
105
|
-
return (
|
|
106
|
-
<TransactionUpdateFC
|
|
107
|
-
key={`${transactionUpdate.key}:${index}:${update.key}`}
|
|
108
|
-
serialNumber={index}
|
|
109
|
-
transactionUpdate={update}
|
|
110
|
-
/>
|
|
111
|
-
)
|
|
112
115
|
})}
|
|
113
116
|
</section>
|
|
114
117
|
</main>
|
|
@@ -120,7 +123,7 @@ export const TimelineUpdateFC: React.FC<{
|
|
|
120
123
|
timelineUpdate: TimelineUpdate<any>
|
|
121
124
|
serialNumber: number
|
|
122
125
|
}> = ({ timelineUpdate, serialNumber }) => {
|
|
123
|
-
return (
|
|
126
|
+
return `key` in timelineUpdate ? (
|
|
124
127
|
<article
|
|
125
128
|
className="node timeline_update"
|
|
126
129
|
data-testid={`timeline-update-${timelineUpdate.key}-${serialNumber}`}
|
|
@@ -134,21 +137,27 @@ export const TimelineUpdateFC: React.FC<{
|
|
|
134
137
|
<main>
|
|
135
138
|
{timelineUpdate.type === `transaction_update` ? (
|
|
136
139
|
timelineUpdate.updates
|
|
137
|
-
.filter((token) => !token.key.startsWith(`👁🗨`))
|
|
140
|
+
.filter((token) => `key` in token && !token.key.startsWith(`👁🗨`))
|
|
138
141
|
.map((update, index) => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
switch (update.type) {
|
|
143
|
+
case `atom_update`:
|
|
144
|
+
case `selector_update`:
|
|
145
|
+
return (
|
|
146
|
+
<article.AtomUpdate
|
|
147
|
+
key={`${timelineUpdate.key}:${index}:${update.key}`}
|
|
148
|
+
serialNumber={index}
|
|
149
|
+
atomUpdate={update}
|
|
150
|
+
/>
|
|
151
|
+
)
|
|
152
|
+
case `transaction_update`:
|
|
153
|
+
return (
|
|
154
|
+
<TransactionUpdateFC
|
|
155
|
+
key={`${timelineUpdate.key}:${index}:${update.key}`}
|
|
156
|
+
serialNumber={index}
|
|
157
|
+
transactionUpdate={update}
|
|
158
|
+
/>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
152
161
|
})
|
|
153
162
|
) : timelineUpdate.type === `selector_update` ? (
|
|
154
163
|
timelineUpdate.atomUpdates
|
|
@@ -170,7 +179,7 @@ export const TimelineUpdateFC: React.FC<{
|
|
|
170
179
|
) : null}
|
|
171
180
|
</main>
|
|
172
181
|
</article>
|
|
173
|
-
)
|
|
182
|
+
) : null
|
|
174
183
|
}
|
|
175
184
|
|
|
176
185
|
export const article = {
|
|
@@ -4,6 +4,7 @@ var json = require('atom.io/json');
|
|
|
4
4
|
var internal = require('atom.io/internal');
|
|
5
5
|
var setRtx = require('atom.io/transceivers/set-rtx');
|
|
6
6
|
var AtomIO = require('atom.io');
|
|
7
|
+
require('atom.io/immortal');
|
|
7
8
|
var realtime = require('atom.io/realtime');
|
|
8
9
|
var data = require('atom.io/data');
|
|
9
10
|
var child_process = require('child_process');
|
|
@@ -642,19 +643,29 @@ var destroyRoomTX = AtomIO__namespace.transaction({
|
|
|
642
643
|
});
|
|
643
644
|
function redactTransactionUpdateContent(visibleStateKeys, updates) {
|
|
644
645
|
return updates.map((update) => {
|
|
645
|
-
|
|
646
|
-
|
|
646
|
+
switch (update.type) {
|
|
647
|
+
case `transaction_update`: {
|
|
648
|
+
const redacted = redactTransactionUpdateContent(
|
|
649
|
+
visibleStateKeys,
|
|
650
|
+
update.updates
|
|
651
|
+
);
|
|
652
|
+
return __spreadProps(__spreadValues({}, update), { updates: redacted });
|
|
653
|
+
}
|
|
654
|
+
default:
|
|
655
|
+
return update;
|
|
647
656
|
}
|
|
648
|
-
const redacted = redactTransactionUpdateContent(
|
|
649
|
-
visibleStateKeys,
|
|
650
|
-
update.updates
|
|
651
|
-
);
|
|
652
|
-
return __spreadProps(__spreadValues({}, update), { updates: redacted });
|
|
653
657
|
}).filter((update) => {
|
|
654
|
-
|
|
655
|
-
|
|
658
|
+
switch (update.type) {
|
|
659
|
+
case `atom_update`:
|
|
660
|
+
case `selector_update`:
|
|
661
|
+
return visibleStateKeys.includes(update.key);
|
|
662
|
+
case `state_creation`:
|
|
663
|
+
return visibleStateKeys.includes(update.token.key);
|
|
664
|
+
case `molecule_creation`:
|
|
665
|
+
return true;
|
|
666
|
+
case `transaction_update`:
|
|
667
|
+
return true;
|
|
656
668
|
}
|
|
657
|
-
return true;
|
|
658
669
|
});
|
|
659
670
|
}
|
|
660
671
|
var actionOcclusionAtoms = AtomIO.atomFamily({
|
|
@@ -112,7 +112,7 @@ declare function redactTransactionUpdateContent(visibleStateKeys: string[], upda
|
|
|
112
112
|
declare const actionOcclusionAtoms: AtomIO.RegularAtomFamilyTokenWithCall<{
|
|
113
113
|
occlude: (updates: TransactionUpdateContent[]) => TransactionUpdateContent[];
|
|
114
114
|
}, string>;
|
|
115
|
-
declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyTokenWithCall<Pick<TransactionUpdate<any>, "key" | "
|
|
115
|
+
declare const userUnacknowledgedQueues: AtomIO.RegularAtomFamilyTokenWithCall<Pick<TransactionUpdate<any>, "key" | "id" | "epoch" | "updates" | "output">[], string>;
|
|
116
116
|
|
|
117
117
|
declare const socketAtoms: AtomIO.RegularAtomFamilyTokenWithCall<Socket | null, string>;
|
|
118
118
|
declare const socketIndex: AtomIO.MutableAtomToken<SetRTX<string>, SetRTXJson<string>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findRelationsInStore } from '../../dist/chunk-
|
|
1
|
+
import { findRelationsInStore } from '../../dist/chunk-7DT3PVS3.js';
|
|
2
2
|
import '../../dist/chunk-FTONNX2R.js';
|
|
3
3
|
import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
|
|
4
4
|
import { parseJson, stringifyJson } from 'atom.io/json';
|
|
@@ -472,19 +472,29 @@ var destroyRoomTX = AtomIO.transaction({
|
|
|
472
472
|
});
|
|
473
473
|
function redactTransactionUpdateContent(visibleStateKeys, updates) {
|
|
474
474
|
return updates.map((update) => {
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
switch (update.type) {
|
|
476
|
+
case `transaction_update`: {
|
|
477
|
+
const redacted = redactTransactionUpdateContent(
|
|
478
|
+
visibleStateKeys,
|
|
479
|
+
update.updates
|
|
480
|
+
);
|
|
481
|
+
return __spreadProps(__spreadValues({}, update), { updates: redacted });
|
|
482
|
+
}
|
|
483
|
+
default:
|
|
484
|
+
return update;
|
|
477
485
|
}
|
|
478
|
-
const redacted = redactTransactionUpdateContent(
|
|
479
|
-
visibleStateKeys,
|
|
480
|
-
update.updates
|
|
481
|
-
);
|
|
482
|
-
return __spreadProps(__spreadValues({}, update), { updates: redacted });
|
|
483
486
|
}).filter((update) => {
|
|
484
|
-
|
|
485
|
-
|
|
487
|
+
switch (update.type) {
|
|
488
|
+
case `atom_update`:
|
|
489
|
+
case `selector_update`:
|
|
490
|
+
return visibleStateKeys.includes(update.key);
|
|
491
|
+
case `state_creation`:
|
|
492
|
+
return visibleStateKeys.includes(update.token.key);
|
|
493
|
+
case `molecule_creation`:
|
|
494
|
+
return true;
|
|
495
|
+
case `transaction_update`:
|
|
496
|
+
return true;
|
|
486
497
|
}
|
|
487
|
-
return true;
|
|
488
498
|
});
|
|
489
499
|
}
|
|
490
500
|
var actionOcclusionAtoms = atomFamily({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TransactionUpdate, TransactionUpdateContent } from "atom.io"
|
|
2
|
-
import { atomFamily
|
|
2
|
+
import { atomFamily } from "atom.io"
|
|
3
3
|
|
|
4
4
|
// export const completeUpdateAtoms = atomFamily<
|
|
5
5
|
// TransactionUpdate<any> | null,
|
|
@@ -15,20 +15,30 @@ export function redactTransactionUpdateContent(
|
|
|
15
15
|
): TransactionUpdateContent[] {
|
|
16
16
|
return updates
|
|
17
17
|
.map((update): TransactionUpdateContent => {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
switch (update.type) {
|
|
19
|
+
case `transaction_update`: {
|
|
20
|
+
const redacted = redactTransactionUpdateContent(
|
|
21
|
+
visibleStateKeys,
|
|
22
|
+
update.updates,
|
|
23
|
+
)
|
|
24
|
+
return { ...update, updates: redacted }
|
|
25
|
+
}
|
|
26
|
+
default:
|
|
27
|
+
return update
|
|
20
28
|
}
|
|
21
|
-
const redacted = redactTransactionUpdateContent(
|
|
22
|
-
visibleStateKeys,
|
|
23
|
-
update.updates,
|
|
24
|
-
)
|
|
25
|
-
return { ...update, updates: redacted }
|
|
26
29
|
})
|
|
27
30
|
.filter((update) => {
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
switch (update.type) {
|
|
32
|
+
case `atom_update`:
|
|
33
|
+
case `selector_update`:
|
|
34
|
+
return visibleStateKeys.includes(update.key)
|
|
35
|
+
case `state_creation`:
|
|
36
|
+
return visibleStateKeys.includes(update.token.key)
|
|
37
|
+
case `molecule_creation`:
|
|
38
|
+
return true
|
|
39
|
+
case `transaction_update`:
|
|
40
|
+
return true
|
|
30
41
|
}
|
|
31
|
-
return true
|
|
32
42
|
})
|
|
33
43
|
}
|
|
34
44
|
|
|
@@ -11,6 +11,7 @@ var RTS = require('atom.io/realtime-server');
|
|
|
11
11
|
var Happy = require('happy-dom');
|
|
12
12
|
var SocketIO = require('socket.io');
|
|
13
13
|
var socket_ioClient = require('socket.io-client');
|
|
14
|
+
require('atom.io/immortal');
|
|
14
15
|
require('atom.io/json');
|
|
15
16
|
require('atom.io/transceivers/set-rtx');
|
|
16
17
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { recordToEntries } from '../../dist/chunk-3V3VWQ7X.js';
|
|
2
2
|
import { myUsernameState } from '../../dist/chunk-O47EQUM6.js';
|
|
3
3
|
import '../../dist/chunk-BWWVY5O5.js';
|
|
4
|
-
import { editRelationsInStore } from '../../dist/chunk-
|
|
4
|
+
import { editRelationsInStore } from '../../dist/chunk-7DT3PVS3.js';
|
|
5
5
|
import '../../dist/chunk-FTONNX2R.js';
|
|
6
6
|
import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
|
|
7
7
|
import * as http from 'http';
|
package/src/atom.ts
CHANGED
|
@@ -6,7 +6,13 @@ import {
|
|
|
6
6
|
} from "atom.io/internal"
|
|
7
7
|
import type { Json, JsonInterface } from "atom.io/json"
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type {
|
|
10
|
+
AtomToken,
|
|
11
|
+
MutableAtomToken,
|
|
12
|
+
RegularAtomToken,
|
|
13
|
+
StateCreation,
|
|
14
|
+
StateDisposal,
|
|
15
|
+
} from "."
|
|
10
16
|
|
|
11
17
|
export type Effectors<T> = {
|
|
12
18
|
setSelf: <V extends T>(next: V | ((oldValue: T) => V)) => void
|
|
@@ -67,7 +73,7 @@ export type RegularAtomFamily<T, K extends Json.Serializable> =
|
|
|
67
73
|
& RegularAtomFamilyToken<T, K>
|
|
68
74
|
& {
|
|
69
75
|
(key: K): RegularAtomToken<T>
|
|
70
|
-
subject: Subject<
|
|
76
|
+
subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>
|
|
71
77
|
install: (store: Store) => void
|
|
72
78
|
}
|
|
73
79
|
|
|
@@ -118,7 +124,7 @@ export type MutableAtomFamily<
|
|
|
118
124
|
& MutableAtomFamilyToken<T, J, K>
|
|
119
125
|
& {
|
|
120
126
|
(key: K): MutableAtomToken<T, J>
|
|
121
|
-
subject: Subject<MutableAtomToken<T, J>>
|
|
127
|
+
subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>
|
|
122
128
|
install: (store: Store) => void
|
|
123
129
|
}
|
|
124
130
|
|
package/src/dispose-state.ts
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
+
import type { MoleculeToken } from "atom.io/immortal"
|
|
1
2
|
import * as Internal from "atom.io/internal"
|
|
2
3
|
|
|
3
4
|
import type { ReadableToken } from "."
|
|
4
5
|
|
|
5
6
|
export function disposeState(
|
|
6
|
-
token: ReadableToken<any>,
|
|
7
|
-
store: Internal.Store = Internal.IMPLICIT.STORE,
|
|
7
|
+
token: MoleculeToken<any, any, any> | ReadableToken<any>,
|
|
8
8
|
): void {
|
|
9
|
-
|
|
10
|
-
case `atom`:
|
|
11
|
-
case `mutable_atom`:
|
|
12
|
-
Internal.disposeAtom(token, store)
|
|
13
|
-
break
|
|
14
|
-
case `selector`:
|
|
15
|
-
case `readonly_selector`:
|
|
16
|
-
Internal.disposeSelector(token, store)
|
|
17
|
-
break
|
|
18
|
-
}
|
|
9
|
+
Internal.disposeFromStore(token, Internal.IMPLICIT.STORE)
|
|
19
10
|
}
|
package/src/index.ts
CHANGED
package/src/selector.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import type { Json } from "atom.io/json"
|
|
8
8
|
|
|
9
9
|
import type { ReadonlySelectorToken, WritableSelectorToken } from "."
|
|
10
|
-
import type { Read, Write } from "./transaction"
|
|
10
|
+
import type { Read, StateCreation, StateDisposal, Write } from "./transaction"
|
|
11
11
|
|
|
12
12
|
export type WritableSelectorOptions<T> = {
|
|
13
13
|
key: string
|
|
@@ -63,7 +63,7 @@ export type WritableSelectorFamily<T, K extends Json.Serializable> =
|
|
|
63
63
|
& WritableSelectorFamilyToken<T, K>
|
|
64
64
|
& {
|
|
65
65
|
(key: K): WritableSelectorToken<T>
|
|
66
|
-
subject: Subject<WritableSelectorToken<T>>
|
|
66
|
+
subject: Subject<StateCreation<WritableSelectorToken<T>> | StateDisposal<WritableSelectorToken<T>>>
|
|
67
67
|
install: (store: Store) => void
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -90,7 +90,7 @@ export type ReadonlySelectorFamily<T, K extends Json.Serializable> =
|
|
|
90
90
|
& {
|
|
91
91
|
key: string
|
|
92
92
|
type: `readonly_selector_family`
|
|
93
|
-
subject: Subject<ReadonlySelectorToken<T>>
|
|
93
|
+
subject: Subject<StateCreation<ReadonlySelectorToken<T>> | StateDisposal<ReadonlySelectorToken<T>>>
|
|
94
94
|
install: (store: Store) => void
|
|
95
95
|
__T?: T
|
|
96
96
|
__K?: K
|
package/src/subscribe.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import type {
|
|
11
11
|
FamilyMetadata,
|
|
12
|
+
Flat,
|
|
12
13
|
Func,
|
|
13
14
|
ReadableToken,
|
|
14
15
|
TimelineManageable,
|
|
@@ -19,10 +20,13 @@ import type {
|
|
|
19
20
|
} from "."
|
|
20
21
|
|
|
21
22
|
export type StateUpdate<T> = { newValue: T; oldValue: T }
|
|
22
|
-
export type KeyedStateUpdate<T> =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
export type KeyedStateUpdate<T> = Flat<
|
|
24
|
+
StateUpdate<T> & {
|
|
25
|
+
key: string
|
|
26
|
+
type: `atom_update` | `selector_update`
|
|
27
|
+
family?: FamilyMetadata
|
|
28
|
+
}
|
|
29
|
+
>
|
|
26
30
|
export type UpdateHandler<T> = (update: StateUpdate<T>) => void
|
|
27
31
|
|
|
28
32
|
export type TransactionUpdateHandler<F extends Func> = (
|
package/src/timeline.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { MoleculeFamilyToken } from "atom.io/immortal"
|
|
1
2
|
import type {
|
|
2
3
|
Timeline,
|
|
3
4
|
TimelineAtomUpdate,
|
|
5
|
+
TimelineMoleculeCreation,
|
|
6
|
+
TimelineMoleculeDisposal,
|
|
4
7
|
TimelineSelectorUpdate,
|
|
8
|
+
TimelineStateCreation,
|
|
9
|
+
TimelineStateDisposal,
|
|
5
10
|
TimelineTransactionUpdate,
|
|
6
11
|
} from "atom.io/internal"
|
|
7
12
|
import { createTimeline, IMPLICIT, timeTravel } from "atom.io/internal"
|
|
@@ -9,6 +14,14 @@ import { createTimeline, IMPLICIT, timeTravel } from "atom.io/internal"
|
|
|
9
14
|
import type { AtomFamilyToken, AtomToken } from "."
|
|
10
15
|
|
|
11
16
|
export type TimelineManageable = AtomFamilyToken<any, any> | AtomToken<any>
|
|
17
|
+
export type AtomOnly<M extends TimelineManageable> = M extends AtomFamilyToken<
|
|
18
|
+
any,
|
|
19
|
+
any
|
|
20
|
+
>
|
|
21
|
+
? AtomToken<any>
|
|
22
|
+
: M extends AtomToken<any>
|
|
23
|
+
? M
|
|
24
|
+
: never
|
|
12
25
|
|
|
13
26
|
export type TimelineToken<M> = {
|
|
14
27
|
key: string
|
|
@@ -18,7 +31,7 @@ export type TimelineToken<M> = {
|
|
|
18
31
|
|
|
19
32
|
export type TimelineOptions<ManagedAtom extends TimelineManageable> = {
|
|
20
33
|
key: string
|
|
21
|
-
|
|
34
|
+
scope: (ManagedAtom | MoleculeFamilyToken<any, any, any>)[]
|
|
22
35
|
shouldCapture?: (
|
|
23
36
|
update: TimelineUpdate<ManagedAtom>,
|
|
24
37
|
timeline: Timeline<TimelineManageable>,
|
|
@@ -27,7 +40,11 @@ export type TimelineOptions<ManagedAtom extends TimelineManageable> = {
|
|
|
27
40
|
|
|
28
41
|
export type TimelineUpdate<ManagedAtom extends TimelineManageable> =
|
|
29
42
|
| TimelineAtomUpdate<ManagedAtom>
|
|
43
|
+
| TimelineMoleculeCreation<any>
|
|
44
|
+
| TimelineMoleculeDisposal<any>
|
|
30
45
|
| TimelineSelectorUpdate<ManagedAtom>
|
|
46
|
+
| TimelineStateCreation<AtomOnly<ManagedAtom>>
|
|
47
|
+
| TimelineStateDisposal<AtomOnly<ManagedAtom>>
|
|
31
48
|
| TimelineTransactionUpdate
|
|
32
49
|
|
|
33
50
|
export const timeline = <ManagedAtom extends TimelineManageable>(
|