atom.io 0.24.2 → 0.24.4
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 +3 -6
- package/data/dist/index.js +2 -2
- package/dist/{chunk-BWWVY5O5.js → chunk-H6EDLPKH.js} +1 -2
- package/dist/{chunk-FTONNX2R.js → chunk-HYXKCFVY.js} +3 -6
- package/dist/{chunk-3V3VWQ7X.js → chunk-MR5NETHW.js} +1 -2
- package/dist/index.cjs +0 -9
- package/dist/index.d.ts +6 -7
- package/dist/index.js +2 -9
- package/ephemeral/dist/index.js +1 -1
- package/eslint-plugin/dist/index.js +1 -1
- package/immortal/dist/index.js +1 -1
- package/internal/dist/index.cjs +16 -14
- package/internal/dist/index.d.ts +3 -1
- package/internal/dist/index.js +15 -10
- package/internal/src/get-state/get-from-store.ts +31 -2
- package/internal/src/molecule/make-molecule-in-store.ts +2 -1
- package/introspection/dist/index.js +1 -1
- package/json/dist/index.d.ts +1 -1
- package/json/dist/index.js +1 -1
- package/package.json +12 -12
- package/react/dist/index.js +1 -1
- package/react-devtools/dist/index.cjs +44 -60
- package/react-devtools/dist/index.js +43 -57
- package/realtime/dist/index.js +1 -1
- package/realtime-client/dist/index.cjs +2 -4
- package/realtime-client/dist/index.js +3 -4
- package/realtime-react/dist/index.js +1 -1
- package/realtime-server/dist/index.cjs +2 -4
- package/realtime-server/dist/index.js +3 -5
- package/realtime-testing/dist/index.cjs +1 -2
- package/realtime-testing/dist/index.js +3 -4
- package/src/get-state.ts +6 -2
- package/src/molecule.ts +1 -14
- package/src/transaction.ts +3 -2
- package/transceivers/set-rtx/dist/index.cjs +1 -2
- package/transceivers/set-rtx/dist/index.js +2 -3
- /package/dist/{chunk-F2X4B4VY.js → chunk-S4N6XNPH.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __spreadProps, __spreadValues } from '../../dist/chunk-
|
|
1
|
+
import { __spreadProps, __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
|
|
2
2
|
import { parseJson, stringifyJson } from 'atom.io/json';
|
|
3
3
|
import { getUpdateToken, IMPLICIT, Subject, getFromStore, subscribeToState, findInStore, getJsonToken, actUponStore, isRootStore, subscribeToTransaction, setIntoStore } from 'atom.io/internal';
|
|
4
4
|
import { SetRTX } from 'atom.io/transceivers/set-rtx';
|
|
@@ -629,8 +629,7 @@ function realtimeContinuitySynchronizer({
|
|
|
629
629
|
unsubFns.push(unsubscribe);
|
|
630
630
|
}
|
|
631
631
|
return () => {
|
|
632
|
-
for (const unsubscribe of unsubFns)
|
|
633
|
-
unsubscribe();
|
|
632
|
+
for (const unsubscribe of unsubFns) unsubscribe();
|
|
634
633
|
};
|
|
635
634
|
};
|
|
636
635
|
const unsubscribeFromPerspectives = revealPerspectives();
|
|
@@ -768,8 +767,7 @@ function realtimeContinuitySynchronizer({
|
|
|
768
767
|
socket.off(`tx-run:${continuityKey}`, fillTransactionRequest);
|
|
769
768
|
socket.on(`tx-run:${continuityKey}`, fillTransactionRequest);
|
|
770
769
|
return () => {
|
|
771
|
-
for (const unsubscribe of unsubscribeFunctions)
|
|
772
|
-
unsubscribe();
|
|
770
|
+
for (const unsubscribe of unsubscribeFunctions) unsubscribe();
|
|
773
771
|
unsubscribeFromPerspectives();
|
|
774
772
|
socket == null ? void 0 : socket.off(`get:${continuityKey}`, sendInitialPayload);
|
|
775
773
|
socket == null ? void 0 : socket.off(`tx-run:${continuityKey}`, fillTransactionRequest);
|
|
@@ -74,8 +74,7 @@ var setupRealtimeTestServer = (options) => {
|
|
|
74
74
|
const httpServer = http__namespace.createServer((_, res) => res.end(`Hello World!`));
|
|
75
75
|
const address = httpServer.listen(options.port).address();
|
|
76
76
|
const port = typeof address === `string` ? null : address === null ? null : address.port;
|
|
77
|
-
if (port === null)
|
|
78
|
-
throw new Error(`Could not determine port for test server`);
|
|
77
|
+
if (port === null) throw new Error(`Could not determine port for test server`);
|
|
79
78
|
const server = new SocketIO__namespace.Server(httpServer).use((socket, next) => {
|
|
80
79
|
const { token, username } = socket.handshake.auth;
|
|
81
80
|
if (token === `test` && socket.id) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { recordToEntries } from '../../dist/chunk-
|
|
2
|
-
import { __spreadProps, __spreadValues } from '../../dist/chunk-
|
|
1
|
+
import { recordToEntries } from '../../dist/chunk-MR5NETHW.js';
|
|
2
|
+
import { __spreadProps, __spreadValues } from '../../dist/chunk-S4N6XNPH.js';
|
|
3
3
|
import * as http from 'http';
|
|
4
4
|
import { render, prettyDOM } from '@testing-library/react';
|
|
5
5
|
import * as AtomIO from 'atom.io';
|
|
@@ -25,8 +25,7 @@ var setupRealtimeTestServer = (options) => {
|
|
|
25
25
|
const httpServer = http.createServer((_, res) => res.end(`Hello World!`));
|
|
26
26
|
const address = httpServer.listen(options.port).address();
|
|
27
27
|
const port = typeof address === `string` ? null : address === null ? null : address.port;
|
|
28
|
-
if (port === null)
|
|
29
|
-
throw new Error(`Could not determine port for test server`);
|
|
28
|
+
if (port === null) throw new Error(`Could not determine port for test server`);
|
|
30
29
|
const server = new SocketIO.Server(httpServer).use((socket, next) => {
|
|
31
30
|
const { token, username } = socket.handshake.auth;
|
|
32
31
|
if (token === `test` && socket.id) {
|
package/src/get-state.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as Internal from "atom.io/internal"
|
|
2
2
|
|
|
3
|
-
import type { ReadableToken } from "."
|
|
3
|
+
import type { MoleculeConstructor, MoleculeToken, ReadableToken } from "."
|
|
4
4
|
|
|
5
|
-
export function getState<T>(token: ReadableToken<T>): T
|
|
5
|
+
export function getState<T>(token: ReadableToken<T>): T
|
|
6
|
+
export function getState<M extends MoleculeConstructor>(
|
|
7
|
+
token: MoleculeToken<M>,
|
|
8
|
+
): InstanceType<M> | undefined
|
|
9
|
+
export function getState(token: MoleculeToken<any> | ReadableToken<any>): any {
|
|
6
10
|
return Internal.getFromStore(token, Internal.IMPLICIT.STORE)
|
|
7
11
|
}
|
package/src/molecule.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type MoleculeTransactors<K extends Json.Serializable> = Flat<
|
|
|
39
39
|
|
|
40
40
|
claim(below: MoleculeToken<any>, options: { exclusive: boolean })
|
|
41
41
|
|
|
42
|
-
join
|
|
42
|
+
join<J extends JoinToken<any, any, any, any>>(joinToken: J): J
|
|
43
43
|
|
|
44
44
|
spawn<Key extends Json.Serializable, Ctor extends MoleculeConstructor>(
|
|
45
45
|
family: MoleculeFamilyToken<Ctor>,
|
|
@@ -100,19 +100,6 @@ export function makeMolecule<M extends MoleculeConstructor>(
|
|
|
100
100
|
return makeMoleculeInStore(IMPLICIT.STORE, context, family, key, ...params)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
export function useMoleculeFromStore<M extends MoleculeConstructor>(
|
|
104
|
-
token: MoleculeToken<M>,
|
|
105
|
-
store: Store,
|
|
106
|
-
): InstanceType<M> | undefined {
|
|
107
|
-
const molecule = store.molecules.get(stringifyJson(token.key))
|
|
108
|
-
return molecule?.instance
|
|
109
|
-
}
|
|
110
|
-
export function useMolecule<M extends MoleculeConstructor>(
|
|
111
|
-
token: MoleculeToken<M>,
|
|
112
|
-
): InstanceType<M> | undefined {
|
|
113
|
-
return useMoleculeFromStore(token, IMPLICIT.STORE)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
103
|
export type MoleculeType<T extends MoleculeFamilyToken<any>> =
|
|
117
104
|
T extends MoleculeFamilyToken<infer M>
|
|
118
105
|
? M
|
package/src/transaction.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
getState,
|
|
2
3
|
makeMolecule,
|
|
3
4
|
MoleculeConstructor,
|
|
4
5
|
MoleculeFamilyToken,
|
|
@@ -78,7 +79,7 @@ export type TransactionUpdate<F extends Func> = {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
export type Transactors = Readonly<{
|
|
81
|
-
get:
|
|
82
|
+
get: typeof getState
|
|
82
83
|
set: <S, New extends S>(
|
|
83
84
|
state: WritableToken<S>,
|
|
84
85
|
newValue: New | ((oldValue: S) => New),
|
|
@@ -90,7 +91,7 @@ export type Transactors = Readonly<{
|
|
|
90
91
|
) => WritableSelectorToken<J>
|
|
91
92
|
}>
|
|
92
93
|
export type TransactorsWithRunAndEnv = Readonly<{
|
|
93
|
-
get:
|
|
94
|
+
get: typeof getState
|
|
94
95
|
set: <S, New extends S>(
|
|
95
96
|
state: WritableToken<S>,
|
|
96
97
|
newValue: New | ((oldValue: S) => New),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../../../dist/chunk-
|
|
1
|
+
import '../../../dist/chunk-S4N6XNPH.js';
|
|
2
2
|
import { Subject } from 'atom.io/internal';
|
|
3
3
|
import { stringifyJson, parseJson } from 'atom.io/json';
|
|
4
4
|
|
|
@@ -184,8 +184,7 @@ var SetRTX = class _SetRTX extends Set {
|
|
|
184
184
|
break;
|
|
185
185
|
case `clear`: {
|
|
186
186
|
const values = JSON.parse(value);
|
|
187
|
-
for (const v of values)
|
|
188
|
-
this.add(v);
|
|
187
|
+
for (const v of values) this.add(v);
|
|
189
188
|
break;
|
|
190
189
|
}
|
|
191
190
|
case `tx`: {
|
|
File without changes
|