atom.io 0.18.1 → 0.18.3
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 +0 -2
- package/data/dist/index.js +2 -4
- package/dist/{chunk-JDUNWJFB.js → chunk-BWWVY5O5.js} +1 -3
- package/dist/{chunk-NYCVSXQB.js → chunk-CVBEVTM5.js} +0 -2
- package/dist/chunk-O47EQUM6.js +29 -0
- package/dist/{chunk-PZLG2HP3.js → chunk-U2IICNHQ.js} +0 -2
- package/dist/{chunk-XACXFU3B.js → chunk-VAE5OCKN.js} +0 -2
- package/dist/{chunk-NYTGCPHB.js → chunk-WX2NCOZR.js} +0 -2
- package/dist/{chunk-IZHOMSXA.js → chunk-YDOGCZ53.js} +0 -2
- package/dist/index.cjs +0 -2
- package/dist/index.js +1 -3
- package/internal/dist/index.cjs +46 -102
- package/internal/dist/index.d.ts +23 -23
- package/internal/dist/index.js +48 -104
- 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/introspection/dist/index.cjs +0 -2
- package/introspection/dist/index.js +1 -3
- package/json/dist/index.cjs +0 -2
- package/json/dist/index.js +3 -5
- package/package.json +6 -5
- package/react/dist/index.cjs +2 -5
- package/react/dist/index.js +3 -6
- package/react/src/use-tl.ts +2 -2
- package/react-devtools/dist/index.cjs +1 -3
- package/react-devtools/dist/index.css +0 -1
- package/react-devtools/dist/index.js +4 -6
- package/realtime/dist/index.cjs +0 -2
- package/realtime/dist/index.js +1 -3
- package/realtime-client/dist/index.cjs +1 -3
- package/realtime-client/dist/index.js +15 -41
- package/realtime-react/dist/index.cjs +0 -2
- package/realtime-react/dist/index.js +2 -4
- package/realtime-server/dist/index.cjs +3 -5
- package/realtime-server/dist/index.js +4 -6
- package/realtime-server/src/ipc-sockets/parent-socket.ts +4 -3
- package/realtime-testing/dist/index.cjs +43 -7
- package/realtime-testing/dist/index.js +6 -9
- package/realtime-testing/src/setup-realtime-test.tsx +3 -5
- package/transceivers/set-rtx/dist/index.cjs +0 -2
- package/transceivers/set-rtx/dist/index.js +1 -3
- package/data/dist/index.cjs.map +0 -1
- package/data/dist/index.js.map +0 -1
- package/dist/chunk-IZHOMSXA.js.map +0 -1
- package/dist/chunk-JDUNWJFB.js.map +0 -1
- package/dist/chunk-NYCVSXQB.js.map +0 -1
- package/dist/chunk-NYTGCPHB.js.map +0 -1
- package/dist/chunk-PZLG2HP3.js.map +0 -1
- package/dist/chunk-XACXFU3B.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/internal/dist/index.cjs.map +0 -1
- package/internal/dist/index.js.map +0 -1
- package/introspection/dist/index.cjs.map +0 -1
- package/introspection/dist/index.js.map +0 -1
- package/json/dist/index.cjs.map +0 -1
- package/json/dist/index.js.map +0 -1
- package/react/dist/index.cjs.map +0 -1
- package/react/dist/index.js.map +0 -1
- package/react-devtools/dist/index.cjs.map +0 -1
- package/react-devtools/dist/index.css.map +0 -1
- package/react-devtools/dist/index.js.map +0 -1
- package/realtime/dist/index.cjs.map +0 -1
- package/realtime/dist/index.js.map +0 -1
- package/realtime-client/dist/index.cjs.map +0 -1
- package/realtime-client/dist/index.js.map +0 -1
- package/realtime-react/dist/index.cjs.map +0 -1
- package/realtime-react/dist/index.js.map +0 -1
- package/realtime-server/dist/index.cjs.map +0 -1
- package/realtime-server/dist/index.js.map +0 -1
- package/realtime-testing/dist/index.cjs.map +0 -1
- package/realtime-testing/dist/index.js.map +0 -1
- package/transceivers/set-rtx/dist/index.cjs.map +0 -1
- package/transceivers/set-rtx/dist/index.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AtomToken, TransactionUpdate, ƒn } from "atom.io"
|
|
1
|
+
import type { AtomToken, TransactionToken, TransactionUpdate, ƒn } from "atom.io"
|
|
2
2
|
import type { TimelineUpdate } from "atom.io"
|
|
3
3
|
|
|
4
4
|
import { newest } from "../lineage"
|
|
@@ -17,16 +17,11 @@ export const addAtomToTimeline = (
|
|
|
17
17
|
store: Store,
|
|
18
18
|
): void => {
|
|
19
19
|
let maybeAtom = withdraw(atomToken, store)
|
|
20
|
-
if (maybeAtom
|
|
20
|
+
if (maybeAtom.type === `mutable_atom`) {
|
|
21
21
|
const updateToken = getUpdateToken(maybeAtom)
|
|
22
22
|
maybeAtom = withdraw(updateToken, store)
|
|
23
23
|
}
|
|
24
24
|
const atom = maybeAtom
|
|
25
|
-
if (atom === undefined) {
|
|
26
|
-
throw new Error(
|
|
27
|
-
`Cannot subscribe to atom "${atomToken.key}" because it has not been initialized in store "${store.config.name}"`,
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
25
|
store.timelineAtoms.set({ atomKey: atom.key, timelineKey: tl.key })
|
|
31
26
|
|
|
32
27
|
atom.subject.subscribe(`timeline`, (update) => {
|
|
@@ -70,15 +65,11 @@ export const addAtomToTimeline = (
|
|
|
70
65
|
}
|
|
71
66
|
}
|
|
72
67
|
if (currentTransactionKey) {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
)
|
|
77
|
-
if (currentTransaction === undefined) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Transaction "${currentTransactionKey}" not found in store "${store.config.name}". This is surprising, because we are in the application phase of "${currentTransactionKey}".`,
|
|
80
|
-
)
|
|
68
|
+
const txToken: TransactionToken<any> = {
|
|
69
|
+
key: currentTransactionKey,
|
|
70
|
+
type: `transaction`,
|
|
81
71
|
}
|
|
72
|
+
const currentTransaction = withdraw(txToken, store)
|
|
82
73
|
if (tl.transactionKey !== currentTransactionKey) {
|
|
83
74
|
if (tl.transactionKey) {
|
|
84
75
|
store.logger.error(
|
|
@@ -89,15 +89,6 @@ export function createTimeline<ManagedAtom extends TimelineManageable>(
|
|
|
89
89
|
) {
|
|
90
90
|
const familyToken: AtomFamilyToken<any> = tokenOrFamily
|
|
91
91
|
const family = withdraw(familyToken, store)
|
|
92
|
-
if (family === undefined) {
|
|
93
|
-
store.logger.error(
|
|
94
|
-
`❌`,
|
|
95
|
-
`timeline`,
|
|
96
|
-
options.key,
|
|
97
|
-
`Failed to add family "${familyToken.key}" because it does not exist in the store`,
|
|
98
|
-
)
|
|
99
|
-
continue
|
|
100
|
-
}
|
|
101
92
|
const familyKey = family.key
|
|
102
93
|
target.timelineAtoms.set({ atomKey: familyKey, timelineKey })
|
|
103
94
|
family.subject.subscribe(`timeline:${options.key}`, (token) => {
|
|
@@ -110,26 +101,8 @@ export function createTimeline<ManagedAtom extends TimelineManageable>(
|
|
|
110
101
|
}
|
|
111
102
|
} else {
|
|
112
103
|
let atom = withdraw(tokenOrFamily, store)
|
|
113
|
-
if (atom === undefined) {
|
|
114
|
-
store.logger.error(
|
|
115
|
-
`❌`,
|
|
116
|
-
`timeline`,
|
|
117
|
-
options.key,
|
|
118
|
-
`Failed to add atom "${atomKey}" because it does not exist in the store`,
|
|
119
|
-
)
|
|
120
|
-
continue
|
|
121
|
-
}
|
|
122
104
|
if (isMutable(atom)) {
|
|
123
105
|
const updateAtom = withdraw(getUpdateToken(atom), store)
|
|
124
|
-
if (updateAtom === undefined) {
|
|
125
|
-
store.logger.error(
|
|
126
|
-
`❌`,
|
|
127
|
-
`timeline`,
|
|
128
|
-
options.key,
|
|
129
|
-
`Failed to add update atom "${atomKey}" because it does not exist in the store`,
|
|
130
|
-
)
|
|
131
|
-
continue
|
|
132
|
-
}
|
|
133
106
|
atom = updateAtom
|
|
134
107
|
atomKey = atom.key
|
|
135
108
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __spreadValues, __spreadProps } from '../../dist/chunk-
|
|
1
|
+
import { __spreadValues, __spreadProps } from '../../dist/chunk-U2IICNHQ.js';
|
|
2
2
|
import * as Internal from 'atom.io/internal';
|
|
3
3
|
import { createRegularAtom, newest, createStandaloneSelector, IMPLICIT, createRegularAtomFamily, Subject, createSelectorFamily } from 'atom.io/internal';
|
|
4
4
|
|
|
@@ -292,5 +292,3 @@ var attachIntrospectionStates = (store = Internal.IMPLICIT.STORE) => {
|
|
|
292
292
|
};
|
|
293
293
|
|
|
294
294
|
export { attachIntrospectionStates };
|
|
295
|
-
//# sourceMappingURL=out.js.map
|
|
296
|
-
//# sourceMappingURL=index.js.map
|
package/json/dist/index.cjs
CHANGED
package/json/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { parseJson } from '../../dist/chunk-
|
|
2
|
-
export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-
|
|
3
|
-
import '../../dist/chunk-
|
|
1
|
+
import { parseJson } from '../../dist/chunk-VAE5OCKN.js';
|
|
2
|
+
export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-VAE5OCKN.js';
|
|
3
|
+
import '../../dist/chunk-U2IICNHQ.js';
|
|
4
4
|
import { createStandaloneSelector, IMPLICIT, createSelectorFamily } from 'atom.io/internal';
|
|
5
5
|
|
|
6
6
|
var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
@@ -34,5 +34,3 @@ function selectJsonFamily(atomFamily, transform, store = IMPLICIT.STORE) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export { selectJson, selectJsonFamily };
|
|
37
|
-
//# sourceMappingURL=out.js.map
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"test": "vitest",
|
|
40
40
|
"test:coverage": "vitest run --coverage",
|
|
41
41
|
"test:once": "bun run test:manifest && cross-env IMPORT=dist vitest run",
|
|
42
|
+
"test:once:public": "cross-env IMPORT=dist vitest run public",
|
|
42
43
|
"test:manifest": "tsx __scripts__/manifest-test.node"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"@testing-library/react": "14.2.1",
|
|
78
79
|
"@types/http-proxy": "1.17.14",
|
|
79
80
|
"@types/npmlog": "7.0.0",
|
|
80
|
-
"@types/react": "18.2.
|
|
81
|
+
"@types/react": "18.2.61",
|
|
81
82
|
"@types/tmp": "0.2.6",
|
|
82
83
|
"@vitest/coverage-v8": "1.3.1",
|
|
83
84
|
"@vitest/ui": "1.3.1",
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
"drizzle-kit": "0.20.14",
|
|
86
87
|
"drizzle-orm": "0.29.4",
|
|
87
88
|
"eslint": "8.57.0",
|
|
88
|
-
"framer-motion": "11.0.
|
|
89
|
+
"framer-motion": "11.0.8",
|
|
89
90
|
"happy-dom": "13.6.2",
|
|
90
91
|
"http-proxy": "1.18.1",
|
|
91
92
|
"npmlog": "7.0.1",
|
|
@@ -93,10 +94,10 @@
|
|
|
93
94
|
"preact": "10.19.6",
|
|
94
95
|
"react": "18.2.0",
|
|
95
96
|
"react-dom": "18.2.0",
|
|
96
|
-
"react-router-dom": "6.22.
|
|
97
|
+
"react-router-dom": "6.22.2",
|
|
97
98
|
"socket.io": "4.7.4",
|
|
98
99
|
"socket.io-client": "4.7.4",
|
|
99
|
-
"tmp": "0.2.
|
|
100
|
+
"tmp": "0.2.3",
|
|
100
101
|
"tsup": "8.0.2",
|
|
101
102
|
"typescript": "5.3.3",
|
|
102
103
|
"vite": "5.1.4",
|
package/react/dist/index.cjs
CHANGED
|
@@ -61,10 +61,9 @@ function useTL(token) {
|
|
|
61
61
|
const timeline = internal.withdraw(token, store);
|
|
62
62
|
const tokenRef = React5__namespace.useRef(token);
|
|
63
63
|
const rebuildMeta = () => {
|
|
64
|
-
var _a, _b;
|
|
65
64
|
return {
|
|
66
|
-
at:
|
|
67
|
-
length:
|
|
65
|
+
at: timeline.at,
|
|
66
|
+
length: timeline.history.length,
|
|
68
67
|
undo: () => atom_io.undo(token),
|
|
69
68
|
redo: () => atom_io.redo(token)
|
|
70
69
|
};
|
|
@@ -90,5 +89,3 @@ exports.useI = useI;
|
|
|
90
89
|
exports.useJSON = useJSON;
|
|
91
90
|
exports.useO = useO;
|
|
92
91
|
exports.useTL = useTL;
|
|
93
|
-
//# sourceMappingURL=out.js.map
|
|
94
|
-
//# sourceMappingURL=index.cjs.map
|
package/react/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../../dist/chunk-
|
|
1
|
+
import '../../dist/chunk-U2IICNHQ.js';
|
|
2
2
|
import { IMPLICIT, findInStore, setIntoStore, subscribeToState, getFromStore, getJsonToken, withdraw, subscribeToTimeline } from 'atom.io/internal';
|
|
3
3
|
import * as React5 from 'react';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -39,10 +39,9 @@ function useTL(token) {
|
|
|
39
39
|
const timeline = withdraw(token, store);
|
|
40
40
|
const tokenRef = React5.useRef(token);
|
|
41
41
|
const rebuildMeta = () => {
|
|
42
|
-
var _a, _b;
|
|
43
42
|
return {
|
|
44
|
-
at:
|
|
45
|
-
length:
|
|
43
|
+
at: timeline.at,
|
|
44
|
+
length: timeline.history.length,
|
|
46
45
|
undo: () => undo(token),
|
|
47
46
|
redo: () => redo(token)
|
|
48
47
|
};
|
|
@@ -63,5 +62,3 @@ function useTL(token) {
|
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
export { StoreContext, StoreProvider, useI, useJSON, useO, useTL };
|
|
66
|
-
//# sourceMappingURL=out.js.map
|
|
67
|
-
//# sourceMappingURL=index.js.map
|
package/react/src/use-tl.ts
CHANGED
|
@@ -19,8 +19,8 @@ export function useTL(token: TimelineToken<any>): TimelineMeta {
|
|
|
19
19
|
const tokenRef = React.useRef(token)
|
|
20
20
|
const rebuildMeta = () => {
|
|
21
21
|
return {
|
|
22
|
-
at: timeline
|
|
23
|
-
length: timeline
|
|
22
|
+
at: timeline.at,
|
|
23
|
+
length: timeline.history.length,
|
|
24
24
|
undo: () => undo(token),
|
|
25
25
|
redo: () => redo(token),
|
|
26
26
|
}
|
|
@@ -525,7 +525,7 @@ var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, on
|
|
|
525
525
|
storage.setItem(key, stringify(newValue));
|
|
526
526
|
});
|
|
527
527
|
};
|
|
528
|
-
var lazyLocalStorageEffect = persistAtom(localStorage)(JSON);
|
|
528
|
+
var lazyLocalStorageEffect = persistAtom(window.localStorage)(JSON);
|
|
529
529
|
var OpenClose = ({ isOpen, setIsOpen, disabled }) => {
|
|
530
530
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
531
531
|
"button",
|
|
@@ -2852,5 +2852,3 @@ exports.primitiveRefinery = primitiveRefinery;
|
|
|
2852
2852
|
exports.selectorIndex = selectorIndex;
|
|
2853
2853
|
exports.timelineIndex = timelineIndex;
|
|
2854
2854
|
exports.transactionIndex = transactionIndex;
|
|
2855
|
-
//# sourceMappingURL=out.js.map
|
|
2856
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { JSON_TYPE_NAMES, isString, isNumber, isBoolean, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-
|
|
4
|
-
import { __spreadProps, __spreadValues, __objRest, __restKey } from '../../dist/chunk-
|
|
1
|
+
import { treeShake, isEmptyArray, pipe, ifDefined, isArray, isRecord, doesExtend, isModifier, isPlainObject, raiseError, sprawl, recordToEntries, fallback, hasExactProperties, isEmptyObject, doNothing, isOneOf, map, entriesToRecord, comprises, addTo, become, mapObject, delve } from '../../dist/chunk-CVBEVTM5.js';
|
|
2
|
+
import { lazyLocalStorageEffect } from '../../dist/chunk-BWWVY5O5.js';
|
|
3
|
+
import { JSON_TYPE_NAMES, isString, isNumber, isBoolean, stringifyJson, JSON_DEFAULTS } from '../../dist/chunk-VAE5OCKN.js';
|
|
4
|
+
import { __spreadProps, __spreadValues, __objRest, __restKey } from '../../dist/chunk-U2IICNHQ.js';
|
|
5
5
|
import { selectorFamily, atom, atomFamily, findState, undo, redo, getState } from 'atom.io';
|
|
6
6
|
import { attachIntrospectionStates } from 'atom.io/introspection';
|
|
7
7
|
import { useI, useO } from 'atom.io/react';
|
|
@@ -2566,5 +2566,3 @@ var prettyJson = new Differ(primitiveRefinery, jsonTreeRefinery, {
|
|
|
2566
2566
|
});
|
|
2567
2567
|
|
|
2568
2568
|
export { AtomIODevtools, atomIndex, devtoolsAreOpenState, devtoolsViewOptionsState, devtoolsViewSelectionState, findTimelineState, findTransactionLogState, findViewIsOpenState, jsonTreeRefinery, prettyJson, primitiveRefinery, selectorIndex, timelineIndex, transactionIndex };
|
|
2569
|
-
//# sourceMappingURL=out.js.map
|
|
2570
|
-
//# sourceMappingURL=index.js.map
|
package/realtime/dist/index.cjs
CHANGED
package/realtime/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../../dist/chunk-
|
|
1
|
+
import '../../dist/chunk-U2IICNHQ.js';
|
|
2
2
|
import { assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity, getUpdateToken } from 'atom.io/internal';
|
|
3
3
|
import { atom, selectorFamily } from 'atom.io';
|
|
4
4
|
import { join } from 'atom.io/data';
|
|
@@ -107,5 +107,3 @@ var usersInMyRoomView = selectorFamily({
|
|
|
107
107
|
});
|
|
108
108
|
|
|
109
109
|
export { DEFAULT_USER_IN_ROOM_META, InvariantMap, SyncGroup, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex };
|
|
110
|
-
//# sourceMappingURL=out.js.map
|
|
111
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -191,7 +191,7 @@ var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, on
|
|
|
191
191
|
storage.setItem(key, stringify(newValue));
|
|
192
192
|
});
|
|
193
193
|
};
|
|
194
|
-
var lazyLocalStorageEffect = persistAtom(localStorage)(JSON);
|
|
194
|
+
var lazyLocalStorageEffect = persistAtom(window.localStorage)(JSON);
|
|
195
195
|
|
|
196
196
|
// realtime-client/src/realtime-client-stores/client-main-store.ts
|
|
197
197
|
var myIdState__INTERNAL = AtomIO__namespace.atom({
|
|
@@ -569,5 +569,3 @@ exports.pullSelectorFamilyMember = pullSelectorFamilyMember;
|
|
|
569
569
|
exports.pushState = pushState;
|
|
570
570
|
exports.serverAction = serverAction;
|
|
571
571
|
exports.syncContinuity = syncContinuity;
|
|
572
|
-
//# sourceMappingURL=out.js.map
|
|
573
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { syncContinuity } from '../../dist/chunk-
|
|
2
|
-
|
|
3
|
-
import '../../dist/chunk-
|
|
1
|
+
export { syncContinuity } from '../../dist/chunk-YDOGCZ53.js';
|
|
2
|
+
export { confirmedUpdateQueue, myIdState, myIdState__INTERNAL, myUsernameState, optimisticUpdateQueue } from '../../dist/chunk-O47EQUM6.js';
|
|
3
|
+
import '../../dist/chunk-BWWVY5O5.js';
|
|
4
|
+
import '../../dist/chunk-U2IICNHQ.js';
|
|
4
5
|
import * as Internal from 'atom.io/internal';
|
|
5
6
|
import { setIntoStore, getJsonToken, getUpdateToken } from 'atom.io/internal';
|
|
6
7
|
import { parseJson } from 'atom.io/json';
|
|
7
|
-
import * as AtomIO from 'atom.io';
|
|
8
8
|
|
|
9
9
|
function pullAtom(token, socket, store) {
|
|
10
10
|
const setServedValue = (data) => {
|
|
@@ -85,17 +85,17 @@ function pullSelector(token, socket, store) {
|
|
|
85
85
|
const unsubscribes = [];
|
|
86
86
|
if (atomKeys) {
|
|
87
87
|
for (const atomKey of atomKeys) {
|
|
88
|
-
const
|
|
89
|
-
if (!
|
|
88
|
+
const atom = store.atoms.get(atomKey);
|
|
89
|
+
if (!atom) {
|
|
90
90
|
continue;
|
|
91
91
|
}
|
|
92
|
-
switch (
|
|
92
|
+
switch (atom.type) {
|
|
93
93
|
case `atom`: {
|
|
94
|
-
unsubscribes.push(pullAtom(
|
|
94
|
+
unsubscribes.push(pullAtom(atom, socket, store));
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
97
97
|
case `mutable_atom`: {
|
|
98
|
-
unsubscribes.push(pullMutableAtom(
|
|
98
|
+
unsubscribes.push(pullMutableAtom(atom, socket, store));
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -119,17 +119,17 @@ function pullSelectorFamilyMember(token, socket, store) {
|
|
|
119
119
|
const unsubscribes = [];
|
|
120
120
|
if (atomKeys) {
|
|
121
121
|
for (const atomKey of atomKeys) {
|
|
122
|
-
const
|
|
123
|
-
if (!
|
|
122
|
+
const atom = store.atoms.get(atomKey);
|
|
123
|
+
if (!atom) {
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
126
|
-
switch (
|
|
126
|
+
switch (atom.type) {
|
|
127
127
|
case `atom`: {
|
|
128
|
-
unsubscribes.push(pullAtomFamilyMember(
|
|
128
|
+
unsubscribes.push(pullAtomFamilyMember(atom, socket, store));
|
|
129
129
|
break;
|
|
130
130
|
}
|
|
131
131
|
case `mutable_atom`: {
|
|
132
|
-
unsubscribes.push(pullMutableAtomFamilyMember(
|
|
132
|
+
unsubscribes.push(pullMutableAtomFamilyMember(atom, socket, store));
|
|
133
133
|
break;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -156,30 +156,6 @@ function pushState(token, socket, store) {
|
|
|
156
156
|
socket.emit(`unclaim:${token.key}`);
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
var myIdState__INTERNAL = AtomIO.atom({
|
|
160
|
-
key: `mySocketId__INTERNAL`,
|
|
161
|
-
default: void 0
|
|
162
|
-
});
|
|
163
|
-
var myIdState = AtomIO.selector({
|
|
164
|
-
key: `mySocketId`,
|
|
165
|
-
get: ({ get }) => get(myIdState__INTERNAL)
|
|
166
|
-
});
|
|
167
|
-
var usernameEffects = typeof window === `undefined` ? [] : [lazyLocalStorageEffect(`myUsername`)];
|
|
168
|
-
var myUsernameState = AtomIO.atom({
|
|
169
|
-
key: `myUsername`,
|
|
170
|
-
default: null,
|
|
171
|
-
effects: usernameEffects
|
|
172
|
-
});
|
|
173
|
-
var optimisticUpdateQueue = AtomIO.atom({
|
|
174
|
-
key: `updateQueue`,
|
|
175
|
-
default: []
|
|
176
|
-
});
|
|
177
|
-
var confirmedUpdateQueue = AtomIO.atom(
|
|
178
|
-
{
|
|
179
|
-
key: `serverConfirmedUpdateQueue`,
|
|
180
|
-
default: []
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
159
|
function serverAction(token, socket, store) {
|
|
184
160
|
const unsubscribeFromLocalUpdates = Internal.subscribeToTransaction(
|
|
185
161
|
token,
|
|
@@ -194,6 +170,4 @@ function serverAction(token, socket, store) {
|
|
|
194
170
|
};
|
|
195
171
|
}
|
|
196
172
|
|
|
197
|
-
export {
|
|
198
|
-
//# sourceMappingURL=out.js.map
|
|
199
|
-
//# sourceMappingURL=index.js.map
|
|
173
|
+
export { pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction };
|
|
@@ -512,5 +512,3 @@ exports.usePullSelectorFamilyMember = usePullSelectorFamilyMember;
|
|
|
512
512
|
exports.usePush = usePush;
|
|
513
513
|
exports.useServerAction = useServerAction;
|
|
514
514
|
exports.useSyncContinuity = useSyncContinuity;
|
|
515
|
-
//# sourceMappingURL=out.js.map
|
|
516
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { syncContinuity } from '../../dist/chunk-
|
|
2
|
-
import '../../dist/chunk-
|
|
1
|
+
import { syncContinuity } from '../../dist/chunk-YDOGCZ53.js';
|
|
2
|
+
import '../../dist/chunk-U2IICNHQ.js';
|
|
3
3
|
import { useI, StoreContext, useO } from 'atom.io/react';
|
|
4
4
|
import * as RTC from 'atom.io/realtime-client';
|
|
5
5
|
import * as React from 'react';
|
|
@@ -155,5 +155,3 @@ function useSyncContinuity(token) {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export { RealtimeContext, RealtimeProvider, usePullAtom, usePullAtomFamilyMember, usePullMutable, usePullMutableAtomFamilyMember, usePullSelector, usePullSelectorFamilyMember, usePush, useServerAction, useSyncContinuity };
|
|
158
|
-
//# sourceMappingURL=out.js.map
|
|
159
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -271,11 +271,11 @@ var ParentSocket = class extends CustomSocket {
|
|
|
271
271
|
}
|
|
272
272
|
);
|
|
273
273
|
this.on(`exit`, () => {
|
|
274
|
+
this.logger.info(`\u{1F525}`, this.id, `received "exit"`);
|
|
274
275
|
process.exit(0);
|
|
275
276
|
});
|
|
276
|
-
process.on(`exit`, () => {
|
|
277
|
-
this.logger.info(`\u{1F525}`, this.id, `exited`);
|
|
278
|
-
process.exit(0);
|
|
277
|
+
process.on(`exit`, (code) => {
|
|
278
|
+
this.logger.info(`\u{1F525}`, this.id, `exited with code ${code}`);
|
|
279
279
|
});
|
|
280
280
|
process.on(`end`, () => {
|
|
281
281
|
this.logger.info(`\u{1F525}`, this.id, `ended`);
|
|
@@ -1008,5 +1008,3 @@ exports.socketIndex = socketIndex;
|
|
|
1008
1008
|
exports.userIndex = userIndex;
|
|
1009
1009
|
exports.userUnacknowledgedQueues = userUnacknowledgedQueues;
|
|
1010
1010
|
exports.usersOfSockets = usersOfSockets;
|
|
1011
|
-
//# sourceMappingURL=out.js.map
|
|
1012
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __spreadProps, __spreadValues } from '../../dist/chunk-
|
|
1
|
+
import { __spreadProps, __spreadValues } from '../../dist/chunk-U2IICNHQ.js';
|
|
2
2
|
import { parseJson, stringifyJson } from 'atom.io/json';
|
|
3
3
|
import { getUpdateToken, IMPLICIT, Subject, findInStore, getFromStore, subscribeToState, getJsonToken, isRootStore, subscribeToTransaction, actUponStore, setIntoStore } from 'atom.io/internal';
|
|
4
4
|
import { SetRTX } from 'atom.io/transceivers/set-rtx';
|
|
@@ -231,11 +231,11 @@ var ParentSocket = class extends CustomSocket {
|
|
|
231
231
|
}
|
|
232
232
|
);
|
|
233
233
|
this.on(`exit`, () => {
|
|
234
|
+
this.logger.info(`\u{1F525}`, this.id, `received "exit"`);
|
|
234
235
|
process.exit(0);
|
|
235
236
|
});
|
|
236
|
-
process.on(`exit`, () => {
|
|
237
|
-
this.logger.info(`\u{1F525}`, this.id, `exited`);
|
|
238
|
-
process.exit(0);
|
|
237
|
+
process.on(`exit`, (code) => {
|
|
238
|
+
this.logger.info(`\u{1F525}`, this.id, `exited with code ${code}`);
|
|
239
239
|
});
|
|
240
240
|
process.on(`end`, () => {
|
|
241
241
|
this.logger.info(`\u{1F525}`, this.id, `ended`);
|
|
@@ -944,5 +944,3 @@ function realtimeActionReceiver({
|
|
|
944
944
|
}
|
|
945
945
|
|
|
946
946
|
export { ChildSocket, CustomSocket, ParentSocket, SubjectSocket, actionOcclusionAtoms, createRoomTX, destroyRoomTX, joinRoomTX, leaveRoomTX, realtimeActionReceiver, realtimeAtomFamilyProvider, realtimeContinuitySynchronizer, realtimeMutableFamilyProvider, realtimeMutableProvider, realtimeStateProvider, realtimeStateReceiver, realtimeStateSynchronizer, redactTransactionUpdateContent, roomArgumentsAtoms, roomSelectors, socketAtoms, socketIndex, userIndex, userUnacknowledgedQueues, usersOfSockets };
|
|
947
|
-
//# sourceMappingURL=out.js.map
|
|
948
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -85,6 +85,7 @@ export class ParentSocket<
|
|
|
85
85
|
this.process.stdin.resume()
|
|
86
86
|
this.relays = new Map()
|
|
87
87
|
this.relayServices = []
|
|
88
|
+
// this.logger.info(`🔗`, `uplink`, process.pid)
|
|
88
89
|
|
|
89
90
|
this.process.stdin.on(
|
|
90
91
|
`data`,
|
|
@@ -118,11 +119,11 @@ export class ParentSocket<
|
|
|
118
119
|
)
|
|
119
120
|
|
|
120
121
|
this.on(`exit`, () => {
|
|
122
|
+
this.logger.info(`🔥`, this.id, `received "exit"`)
|
|
121
123
|
process.exit(0)
|
|
122
124
|
})
|
|
123
|
-
process.on(`exit`, () => {
|
|
124
|
-
this.logger.info(`🔥`, this.id, `exited`)
|
|
125
|
-
process.exit(0)
|
|
125
|
+
process.on(`exit`, (code) => {
|
|
126
|
+
this.logger.info(`🔥`, this.id, `exited with code ${code}`)
|
|
126
127
|
})
|
|
127
128
|
process.on(`end`, () => {
|
|
128
129
|
this.logger.info(`🔥`, this.id, `ended`)
|
|
@@ -62,6 +62,47 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
62
62
|
|
|
63
63
|
// ../anvl/src/object/entries.ts
|
|
64
64
|
var recordToEntries = (obj) => Object.entries(obj);
|
|
65
|
+
|
|
66
|
+
// __unstable__/web-effects/src/storage.ts
|
|
67
|
+
var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, onSet }) => {
|
|
68
|
+
const savedValue = storage.getItem(key);
|
|
69
|
+
if (savedValue != null)
|
|
70
|
+
setSelf(parse(savedValue));
|
|
71
|
+
onSet(({ newValue }) => {
|
|
72
|
+
if (newValue == null) {
|
|
73
|
+
storage.removeItem(key);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
storage.setItem(key, stringify(newValue));
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
var lazyLocalStorageEffect = persistAtom(window.localStorage)(JSON);
|
|
80
|
+
|
|
81
|
+
// realtime-client/src/realtime-client-stores/client-main-store.ts
|
|
82
|
+
var myIdState__INTERNAL = AtomIO__namespace.atom({
|
|
83
|
+
key: `mySocketId__INTERNAL`,
|
|
84
|
+
default: void 0
|
|
85
|
+
});
|
|
86
|
+
AtomIO__namespace.selector({
|
|
87
|
+
key: `mySocketId`,
|
|
88
|
+
get: ({ get }) => get(myIdState__INTERNAL)
|
|
89
|
+
});
|
|
90
|
+
var usernameEffects = typeof window === `undefined` ? [] : [lazyLocalStorageEffect(`myUsername`)];
|
|
91
|
+
var myUsernameState = AtomIO__namespace.atom({
|
|
92
|
+
key: `myUsername`,
|
|
93
|
+
default: null,
|
|
94
|
+
effects: usernameEffects
|
|
95
|
+
});
|
|
96
|
+
AtomIO__namespace.atom({
|
|
97
|
+
key: `updateQueue`,
|
|
98
|
+
default: []
|
|
99
|
+
});
|
|
100
|
+
AtomIO__namespace.atom(
|
|
101
|
+
{
|
|
102
|
+
key: `serverConfirmedUpdateQueue`,
|
|
103
|
+
default: []
|
|
104
|
+
}
|
|
105
|
+
);
|
|
65
106
|
var testNumber = 0;
|
|
66
107
|
var setupRealtimeTestServer = (options) => {
|
|
67
108
|
++testNumber;
|
|
@@ -121,6 +162,7 @@ var setupRealtimeTestClient = (options, name, port) => {
|
|
|
121
162
|
silo.store.valueMap.set(key, [...value]);
|
|
122
163
|
}
|
|
123
164
|
}
|
|
165
|
+
silo.setState(myUsernameState, `${name}-${testNumber}`);
|
|
124
166
|
const { document } = new Happy__namespace.Window();
|
|
125
167
|
document.body.innerHTML = `<div id="app"></div>`;
|
|
126
168
|
const renderResult = react.render(
|
|
@@ -148,11 +190,7 @@ var setupRealtimeTestClient = (options, name, port) => {
|
|
|
148
190
|
};
|
|
149
191
|
var singleClient = (options) => {
|
|
150
192
|
const server = setupRealtimeTestServer(options);
|
|
151
|
-
const client = setupRealtimeTestClient(
|
|
152
|
-
options,
|
|
153
|
-
`CLIENT-${testNumber}`,
|
|
154
|
-
server.port
|
|
155
|
-
);
|
|
193
|
+
const client = setupRealtimeTestClient(options, `CLIENT`, server.port);
|
|
156
194
|
return {
|
|
157
195
|
client,
|
|
158
196
|
server,
|
|
@@ -191,5 +229,3 @@ exports.multiClient = multiClient;
|
|
|
191
229
|
exports.setupRealtimeTestClient = setupRealtimeTestClient;
|
|
192
230
|
exports.setupRealtimeTestServer = setupRealtimeTestServer;
|
|
193
231
|
exports.singleClient = singleClient;
|
|
194
|
-
//# sourceMappingURL=out.js.map
|
|
195
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { myUsernameState } from '../../dist/chunk-O47EQUM6.js';
|
|
2
|
+
import { recordToEntries } from '../../dist/chunk-CVBEVTM5.js';
|
|
3
|
+
import '../../dist/chunk-BWWVY5O5.js';
|
|
4
|
+
import { __spreadProps, __spreadValues } from '../../dist/chunk-U2IICNHQ.js';
|
|
3
5
|
import * as http from 'http';
|
|
4
6
|
import { render, prettyDOM } from '@testing-library/react';
|
|
5
7
|
import * as AtomIO from 'atom.io';
|
|
@@ -72,6 +74,7 @@ var setupRealtimeTestClient = (options, name, port) => {
|
|
|
72
74
|
silo.store.valueMap.set(key, [...value]);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
77
|
+
silo.setState(myUsernameState, `${name}-${testNumber}`);
|
|
75
78
|
const { document } = new Happy.Window();
|
|
76
79
|
document.body.innerHTML = `<div id="app"></div>`;
|
|
77
80
|
const renderResult = render(
|
|
@@ -99,11 +102,7 @@ var setupRealtimeTestClient = (options, name, port) => {
|
|
|
99
102
|
};
|
|
100
103
|
var singleClient = (options) => {
|
|
101
104
|
const server = setupRealtimeTestServer(options);
|
|
102
|
-
const client = setupRealtimeTestClient(
|
|
103
|
-
options,
|
|
104
|
-
`CLIENT-${testNumber}`,
|
|
105
|
-
server.port
|
|
106
|
-
);
|
|
105
|
+
const client = setupRealtimeTestClient(options, `CLIENT`, server.port);
|
|
107
106
|
return {
|
|
108
107
|
client,
|
|
109
108
|
server,
|
|
@@ -139,5 +138,3 @@ var multiClient = (options) => {
|
|
|
139
138
|
};
|
|
140
139
|
|
|
141
140
|
export { multiClient, setupRealtimeTestClient, setupRealtimeTestServer, singleClient };
|
|
142
|
-
//# sourceMappingURL=out.js.map
|
|
143
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -21,6 +21,7 @@ import type { Socket as ClientSocket } from "socket.io-client"
|
|
|
21
21
|
import { io } from "socket.io-client"
|
|
22
22
|
|
|
23
23
|
import { recordToEntries } from "~/packages/anvl/src/object"
|
|
24
|
+
import { myUsernameState } from "../../realtime-client/src/realtime-client-stores"
|
|
24
25
|
|
|
25
26
|
let testNumber = 0
|
|
26
27
|
|
|
@@ -137,6 +138,7 @@ export const setupRealtimeTestClient = (
|
|
|
137
138
|
silo.store.valueMap.set(key, [...value])
|
|
138
139
|
}
|
|
139
140
|
}
|
|
141
|
+
silo.setState(myUsernameState, `${name}-${testNumber}`)
|
|
140
142
|
|
|
141
143
|
const { document } = new Happy.Window()
|
|
142
144
|
document.body.innerHTML = `<div id="app"></div>`
|
|
@@ -175,11 +177,7 @@ export const singleClient = (
|
|
|
175
177
|
options: TestSetupOptions__SingleClient,
|
|
176
178
|
): RealtimeTestAPI__SingleClient => {
|
|
177
179
|
const server = setupRealtimeTestServer(options)
|
|
178
|
-
const client = setupRealtimeTestClient(
|
|
179
|
-
options,
|
|
180
|
-
`CLIENT-${testNumber}`,
|
|
181
|
-
server.port,
|
|
182
|
-
)
|
|
180
|
+
const client = setupRealtimeTestClient(options, `CLIENT`, server.port)
|
|
183
181
|
|
|
184
182
|
return {
|
|
185
183
|
client,
|