atom.io 0.18.3 → 0.19.1

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.
Files changed (56) hide show
  1. package/data/dist/index.cjs +173 -1
  2. package/data/dist/index.d.ts +52 -21
  3. package/data/dist/index.js +12 -331
  4. package/data/src/join.ts +321 -53
  5. package/dist/{chunk-CVBEVTM5.js → chunk-7VCCW45K.js} +1 -39
  6. package/dist/chunk-7ZR244C2.js +489 -0
  7. package/dist/index.cjs +1 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +1 -0
  10. package/internal/dist/index.cjs +1 -1
  11. package/internal/dist/index.d.ts +1 -1
  12. package/internal/dist/index.js +1 -1
  13. package/internal/src/mutable/tracker.ts +1 -1
  14. package/internal/src/set-state/become.ts +1 -1
  15. package/internal/src/subscribe/subscribe-to-state.ts +2 -2
  16. package/internal/src/timeline/add-atom-to-timeline.ts +3 -3
  17. package/internal/src/transaction/build-transaction.ts +1 -1
  18. package/introspection/dist/index.cjs +3 -2
  19. package/introspection/dist/index.d.ts +4 -4
  20. package/introspection/dist/index.js +3 -2
  21. package/introspection/src/attach-atom-index.ts +5 -4
  22. package/introspection/src/index.ts +3 -3
  23. package/json/dist/index.d.ts +1 -1
  24. package/json/dist/index.js +2 -2
  25. package/package.json +18 -19
  26. package/react-devtools/dist/index.cjs +218 -927
  27. package/react-devtools/dist/index.css +0 -18
  28. package/react-devtools/dist/index.d.ts +4 -4
  29. package/react-devtools/dist/index.js +181 -833
  30. package/react-devtools/src/AtomIODevtools.tsx +2 -1
  31. package/react-devtools/src/Button.tsx +3 -1
  32. package/react-devtools/src/StateEditor.tsx +13 -16
  33. package/react-devtools/src/StateIndex.tsx +22 -19
  34. package/react-devtools/src/TimelineIndex.tsx +11 -4
  35. package/react-devtools/src/TransactionIndex.tsx +10 -3
  36. package/react-devtools/src/Updates.tsx +10 -3
  37. package/realtime/dist/index.cjs +4 -2
  38. package/realtime/dist/index.d.ts +1 -96
  39. package/realtime/dist/index.js +5 -3
  40. package/realtime/src/shared-room-store.ts +5 -3
  41. package/realtime-react/dist/index.cjs +1 -1
  42. package/realtime-react/dist/index.js +1 -1
  43. package/realtime-react/src/use-single-effect.ts +1 -1
  44. package/realtime-server/dist/index.cjs +162 -18
  45. package/realtime-server/dist/index.d.ts +2 -92
  46. package/realtime-server/dist/index.js +31 -17
  47. package/realtime-server/src/ipc-sockets/child-socket.ts +1 -1
  48. package/realtime-server/src/realtime-continuity-synchronizer.ts +8 -6
  49. package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +22 -10
  50. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +2 -2
  51. package/realtime-testing/dist/index.cjs +48 -6
  52. package/realtime-testing/dist/index.js +10 -3
  53. package/realtime-testing/src/setup-realtime-test.tsx +9 -3
  54. package/src/silo.ts +4 -0
  55. package/src/validators.ts +2 -2
  56. /package/dist/{chunk-VAE5OCKN.js → chunk-BF4MVQF6.js} +0 -0
@@ -53,7 +53,7 @@ export const AtomIODevtools = (): JSX.Element => {
53
53
  borderColor: `#0000`,
54
54
  maxHeight: 28,
55
55
  maxWidth: 33,
56
- }
56
+ }
57
57
  }
58
58
  >
59
59
  {devtoolsAreOpen ? (
@@ -65,6 +65,7 @@ export const AtomIODevtools = (): JSX.Element => {
65
65
  <button
66
66
  key={viewOption}
67
67
  type="button"
68
+ data-testid={`view-${viewOption}`}
68
69
  className={viewOption === devtoolsView ? `active` : ``}
69
70
  onClick={() => setDevtoolsView(viewOption)}
70
71
  disabled={viewOption === devtoolsView}
@@ -5,10 +5,12 @@ export const OpenClose: FC<{
5
5
  isOpen: boolean
6
6
  setIsOpen: (next: Modify<boolean> | boolean) => void
7
7
  disabled?: boolean
8
- }> = ({ isOpen, setIsOpen, disabled }) => {
8
+ testid: string
9
+ }> = ({ isOpen, setIsOpen, disabled, testid }) => {
9
10
  return (
10
11
  <button
11
12
  type="button"
13
+ data-testid={testid}
12
14
  className={`carat ${isOpen ? `open` : `closed`}`}
13
15
  onClick={() => setIsOpen((isOpen) => !isOpen)}
14
16
  disabled={disabled}
@@ -3,9 +3,7 @@ import { useI, useO } from "atom.io/react"
3
3
  import type { FC } from "react"
4
4
 
5
5
  import { fallback } from "~/packages/anvl/src/function"
6
- import { Join } from "~/packages/anvl/src/join"
7
6
  import { isJson } from "~/packages/anvl/src/refinement"
8
- import { RelationEditor } from "~/packages/hamr/react-data-designer/src"
9
7
  import { ElasticInput } from "~/packages/hamr/react-elastic-input/src"
10
8
  import { JsonEditor } from "~/packages/hamr/react-json-editor/src"
11
9
 
@@ -16,19 +14,20 @@ export const StateEditor: FC<{
16
14
  const data = useO(token)
17
15
  return isJson(data) ? (
18
16
  <JsonEditor data={data} set={set} schema={true} />
19
- ) : data instanceof Join ? (
20
- <RelationEditor data={data} set={set} />
21
17
  ) : (
22
18
  <div className="json_editor">
23
19
  <ElasticInput
24
20
  value={
25
- data instanceof Set
26
- ? `Set { ${JSON.stringify([...data]).slice(1, -1)} }`
27
- : data instanceof Map
28
- ? `Map ` + JSON.stringify([...data])
29
- : Object.getPrototypeOf(data).constructor.name +
30
- ` ` +
31
- fallback(() => JSON.stringify(data), `?`)
21
+ data !== null &&
22
+ typeof data === `object` &&
23
+ `toJson` in data &&
24
+ typeof data.toJson === `function`
25
+ ? JSON.stringify(data.toJson())
26
+ : data instanceof Set
27
+ ? `Set { ${JSON.stringify([...data]).slice(1, -1)} }`
28
+ : Object.getPrototypeOf(data).constructor.name +
29
+ ` ` +
30
+ fallback(() => JSON.stringify(data), `?`)
32
31
  }
33
32
  disabled={true}
34
33
  />
@@ -53,11 +52,9 @@ export const ReadonlySelectorViewer: FC<{
53
52
  value={
54
53
  data instanceof Set
55
54
  ? `Set ` + JSON.stringify([...data])
56
- : data instanceof Map
57
- ? `Map ` + JSON.stringify([...data])
58
- : Object.getPrototypeOf(data).constructor.name +
59
- ` ` +
60
- JSON.stringify(data)
55
+ : Object.getPrototypeOf(data).constructor.name +
56
+ ` ` +
57
+ JSON.stringify(data)
61
58
  }
62
59
  disabled={true}
63
60
  />
@@ -1,9 +1,10 @@
1
1
  import type {
2
+ AtomToken,
2
3
  ReadonlySelectorToken,
3
4
  RegularAtomToken,
4
5
  WritableSelectorToken,
5
6
  } from "atom.io"
6
- import { getState, selectorFamily } from "atom.io"
7
+ import { findState, getState, selectorFamily } from "atom.io"
7
8
  import type { FamilyNode, WritableTokenIndex } from "atom.io/introspection"
8
9
  import { useI, useO } from "atom.io/react"
9
10
  import type { FC } from "react"
@@ -34,8 +35,8 @@ const findStateTypeState = selectorFamily<string, { key: string }>({
34
35
 
35
36
  export const StateIndexLeafNode: FC<{
36
37
  node:
38
+ | AtomToken<unknown>
37
39
  | ReadonlySelectorToken<unknown>
38
- | RegularAtomToken<unknown>
39
40
  | WritableSelectorToken<unknown>
40
41
  isOpenState: RegularAtomToken<boolean>
41
42
  typeState: ReadonlySelectorToken<string>
@@ -53,6 +54,7 @@ export const StateIndexLeafNode: FC<{
53
54
  <header>
54
55
  <button.OpenClose
55
56
  isOpen={isOpen && !isPrimitive}
57
+ testid={`open-close-state-${node.key}`}
56
58
  setIsOpen={setIsOpen}
57
59
  disabled={isPrimitive}
58
60
  />
@@ -63,7 +65,7 @@ export const StateIndexLeafNode: FC<{
63
65
  <h2>{node.family?.subKey ?? node.key}</h2>
64
66
  <span className="type detail">({stateType})</span>
65
67
  </label>
66
- {isPrimitive ? <StoreEditor token={node} /> : null}
68
+ <StoreEditor token={node} />
67
69
  </header>
68
70
  {isOpen && !isPrimitive ? (
69
71
  <main>
@@ -75,8 +77,8 @@ export const StateIndexLeafNode: FC<{
75
77
  }
76
78
  export const StateIndexTreeNode: FC<{
77
79
  node: FamilyNode<
80
+ | AtomToken<unknown>
78
81
  | ReadonlySelectorToken<unknown>
79
- | RegularAtomToken<unknown>
80
82
  | WritableSelectorToken<unknown>
81
83
  >
82
84
  isOpenState: RegularAtomToken<boolean>
@@ -84,13 +86,17 @@ export const StateIndexTreeNode: FC<{
84
86
  const setIsOpen = useI(isOpenState)
85
87
  const isOpen = useO(isOpenState)
86
88
  for (const [key, childNode] of recordToEntries(node.familyMembers)) {
87
- findViewIsOpenState(key)
88
- findStateTypeState(childNode)
89
+ findState(findViewIsOpenState, key)
90
+ findState(findStateTypeState, childNode)
89
91
  }
90
92
  return (
91
93
  <>
92
94
  <header>
93
- <button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />
95
+ <button.OpenClose
96
+ isOpen={isOpen}
97
+ testid={`open-close-state-family-${node.key}`}
98
+ setIsOpen={setIsOpen}
99
+ />
94
100
  <label>
95
101
  <h2>{node.key}</h2>
96
102
  <span className="type detail"> (family)</span>
@@ -101,10 +107,10 @@ export const StateIndexTreeNode: FC<{
101
107
  <StateIndexNode
102
108
  key={key}
103
109
  node={childNode}
104
- isOpenState={findViewIsOpenState(childNode.key)}
105
- typeState={findStateTypeState(childNode)}
110
+ isOpenState={findState(findViewIsOpenState, childNode.key)}
111
+ typeState={findState(findStateTypeState, childNode)}
106
112
  />
107
- ))
113
+ ))
108
114
  : null}
109
115
  </>
110
116
  )
@@ -112,18 +118,15 @@ export const StateIndexTreeNode: FC<{
112
118
 
113
119
  export const StateIndexNode: FC<{
114
120
  node: WritableTokenIndex<
121
+ | AtomToken<unknown>
115
122
  | ReadonlySelectorToken<unknown>
116
- | RegularAtomToken<unknown>
117
123
  | WritableSelectorToken<unknown>
118
124
  >[string]
119
125
  isOpenState: RegularAtomToken<boolean>
120
126
  typeState: ReadonlySelectorToken<string>
121
127
  }> = ({ node, isOpenState, typeState }) => {
122
- if (node.key.startsWith(`👁‍🗨`)) {
123
- return null
124
- }
125
128
  return (
126
- <section className="node state">
129
+ <section className="node state" data-testid={`state-${node.key}`}>
127
130
  {`type` in node ? (
128
131
  <StateIndexLeafNode
129
132
  node={node}
@@ -140,15 +143,15 @@ export const StateIndexNode: FC<{
140
143
  export const StateIndex: FC<{
141
144
  tokenIndex: ReadonlySelectorToken<
142
145
  WritableTokenIndex<
146
+ | AtomToken<unknown>
143
147
  | ReadonlySelectorToken<unknown>
144
- | RegularAtomToken<unknown>
145
148
  | WritableSelectorToken<unknown>
146
149
  >
147
150
  >
148
151
  }> = ({ tokenIndex }) => {
149
152
  const tokenIds = useO(tokenIndex)
150
153
  return (
151
- <article className="index state_index">
154
+ <article className="index state_index" data-testid="state-index">
152
155
  {Object.entries(tokenIds)
153
156
  .filter(([key]) => !key.startsWith(`👁‍🗨`))
154
157
  .sort()
@@ -157,8 +160,8 @@ export const StateIndex: FC<{
157
160
  <StateIndexNode
158
161
  key={key}
159
162
  node={node}
160
- isOpenState={findViewIsOpenState(node.key)}
161
- typeState={findStateTypeState(node)}
163
+ isOpenState={findState(findViewIsOpenState, node.key)}
164
+ typeState={findState(findStateTypeState, node)}
162
165
  />
163
166
  )
164
167
  })}
@@ -26,9 +26,13 @@ export const TimelineLog: FC<{
26
26
  const setIsOpen = useI(isOpenState)
27
27
 
28
28
  return (
29
- <section className="node timeline_log">
29
+ <section className="node timeline_log" data-testid={`timeline-${token.key}`}>
30
30
  <header>
31
- <button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />
31
+ <button.OpenClose
32
+ isOpen={isOpen}
33
+ testid={`open-close-timeline-${token.key}`}
34
+ setIsOpen={setIsOpen}
35
+ />
32
36
  <label>
33
37
  <h2>{token.key}</h2>
34
38
  <span className="detail length">
@@ -58,7 +62,10 @@ export const TimelineLog: FC<{
58
62
  {timeline.history.map((update, index) => (
59
63
  <Fragment key={update.key + index + timeline.at}>
60
64
  {index === timeline.at ? <YouAreHere /> : null}
61
- <article.TimelineUpdate timelineUpdate={update} />
65
+ <article.TimelineUpdate
66
+ timelineUpdate={update}
67
+ serialNumber={index}
68
+ />
62
69
  {index === timeline.history.length - 1 &&
63
70
  timeline.at === timeline.history.length ? (
64
71
  <YouAreHere />
@@ -74,7 +81,7 @@ export const TimelineLog: FC<{
74
81
  export const TimelineIndex: FC = () => {
75
82
  const tokenIds = useO(timelineIndex)
76
83
  return (
77
- <article className="index timeline_index">
84
+ <article className="index timeline_index" data-testid="timeline-index">
78
85
  {tokenIds
79
86
  .filter((token) => !token.key.startsWith(`👁‍🗨`))
80
87
  .map((token) => {
@@ -27,9 +27,16 @@ export const TransactionLog: FC<{
27
27
  const setIsOpen = useI(isOpenState)
28
28
 
29
29
  return (
30
- <section className="node transaction_log">
30
+ <section
31
+ className="node transaction_log"
32
+ data-testid={`transaction-${token.key}`}
33
+ >
31
34
  <header>
32
- <button.OpenClose isOpen={isOpen} setIsOpen={setIsOpen} />
35
+ <button.OpenClose
36
+ isOpen={isOpen}
37
+ testid={`open-close-transaction-${token.key}`}
38
+ setIsOpen={setIsOpen}
39
+ />
33
40
  <label>
34
41
  <h2>{token.key}</h2>
35
42
  <span className="detail length">({log.length})</span>
@@ -53,7 +60,7 @@ export const TransactionLog: FC<{
53
60
  export const TransactionIndex: FC = () => {
54
61
  const tokenIds = useO(transactionIndex)
55
62
  return (
56
- <article className="index transaction_index">
63
+ <article className="index transaction_index" data-testid="transaction-index">
57
64
  {tokenIds
58
65
  .filter((token) => !token.key.startsWith(`👁‍🗨`))
59
66
  .map((token) => {
@@ -36,7 +36,10 @@ const TransactionUpdateFC: React.FC<{
36
36
  transactionUpdate: TransactionUpdate<ƒn>
37
37
  }> = ({ serialNumber, transactionUpdate }) => {
38
38
  return (
39
- <article className="node transaction_update">
39
+ <article
40
+ className="node transaction_update"
41
+ data-testid={`transaction-update-${transactionUpdate.key}-${serialNumber}`}
42
+ >
40
43
  <header>
41
44
  <h4>{serialNumber}</h4>
42
45
  </header>
@@ -104,9 +107,13 @@ const TransactionUpdateFC: React.FC<{
104
107
 
105
108
  export const TimelineUpdateFC: React.FC<{
106
109
  timelineUpdate: TimelineUpdate<any>
107
- }> = ({ timelineUpdate }) => {
110
+ serialNumber: number
111
+ }> = ({ timelineUpdate, serialNumber }) => {
108
112
  return (
109
- <article className="node timeline_update">
113
+ <article
114
+ className="node timeline_update"
115
+ data-testid={`timeline-update-${timelineUpdate.key}-${serialNumber}`}
116
+ >
110
117
  <header>
111
118
  <h4>
112
119
  {timelineUpdate.timestamp}: {timelineUpdate.type} ({timelineUpdate.key}
@@ -103,8 +103,10 @@ var usersInRooms = data.join(
103
103
  );
104
104
  var usersInMyRoomView = atom_io.selectorFamily({
105
105
  key: `usersInMyRoomView`,
106
- get: (username) => ({ find }) => {
107
- return [find(usersInRooms.core.findRelatedKeysState, username)];
106
+ get: (myUsername) => ({ find }) => {
107
+ const usersInRoomsAtoms = data.getInternalRelations(usersInRooms);
108
+ const myRoomIndex = find(usersInRoomsAtoms, myUsername);
109
+ return [myRoomIndex];
108
110
  }
109
111
  });
110
112
 
@@ -2,7 +2,6 @@ import * as atom_io from 'atom.io';
2
2
  import { AtomFamilyToken, ReadableFamilyToken, ReadableToken, AtomToken, TransactionToken, MutableAtomToken } from 'atom.io';
3
3
  import { Json } from 'atom.io/json';
4
4
  import * as atom_io_data from 'atom.io/data';
5
- import * as atom_io_internal from 'atom.io/internal';
6
5
  import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
7
6
 
8
7
  declare class InvariantMap<K, V> extends Map<K, V> {
@@ -40,107 +39,13 @@ type ContinuityOptions = {
40
39
  };
41
40
  declare function continuity(options: ContinuityOptions): ContinuityToken;
42
41
 
43
- type primitive = boolean | number | string | null;
44
-
45
- type Serializable = primitive | Readonly<{
46
- [key: string]: Serializable;
47
- }> | ReadonlyArray<Serializable>;
48
- type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
49
-
50
- type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
51
- type Cardinality = `1:1` | `1:n` | `n:n`;
52
-
53
- interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
54
- readonly relations: [string, string[]][];
55
- readonly contents: [string, Content][];
56
- }
57
- interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
58
- readonly between: [a: ASide, b: BSide];
59
- readonly cardinality: Cardinality;
60
- }
61
- type BaseExternalStoreConfiguration = {
62
- addRelation: (a: string, b: string) => void;
63
- deleteRelation: (a: string, b: string) => void;
64
- replaceRelationsSafely: (a: string, bs: string[]) => void;
65
- replaceRelationsUnsafely: (a: string, bs: string[]) => void;
66
- getRelatedKeys: (key: string) => Set<string> | undefined;
67
- has: (a: string, b?: string) => boolean;
68
- };
69
- type ExternalStoreWithContentConfiguration<Content extends Object$1> = {
70
- getContent: (contentKey: string) => Content | undefined;
71
- setContent: (contentKey: string, content: Content) => void;
72
- deleteContent: (contentKey: string) => void;
73
- };
74
- type Empty<Obj extends object> = {
75
- [Key in keyof Obj]?: undefined;
76
- };
77
- type ExternalStoreConfiguration<Content extends Object$1 | null> = Content extends Object$1 ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Object$1>>;
78
- type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
79
- externalStore?: ExternalStoreConfiguration<Content>;
80
- isContent?: Refinement<unknown, Content>;
81
- makeContentKey?: (a: string, b: string) => string;
82
- };
83
- type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
84
- declare class Junction<const ASide extends string, const BSide extends string, const Content extends Object$1 | null = null> {
85
- readonly a: ASide;
86
- readonly b: BSide;
87
- readonly cardinality: Cardinality;
88
- readonly relations: Map<string, Set<string>>;
89
- readonly contents: Map<string, Content>;
90
- isContent: Refinement<unknown, Content> | null;
91
- makeContentKey: (a: string, b: string) => string;
92
- getRelatedKeys(key: string): Set<string> | undefined;
93
- protected addRelation(a: string, b: string): void;
94
- protected deleteRelation(a: string, b: string): void;
95
- protected replaceRelationsUnsafely(a: string, bs: string[]): void;
96
- protected replaceRelationsSafely(a: string, bs: string[]): void;
97
- protected getContentInternal(contentKey: string): Content | undefined;
98
- protected setContent(contentKey: string, content: Content): void;
99
- protected deleteContent(contentKey: string): void;
100
- constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
101
- toJSON(): JunctionJSON<ASide, BSide, Content>;
102
- set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
103
- set(relation: {
104
- [Key in ASide | BSide]: string;
105
- }, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
106
- delete(a: string, b?: string): this;
107
- delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
108
- getRelatedKey(key: string): string | undefined;
109
- replaceRelations(a: string, relations: Content extends null ? string[] : Record<string, Content>, config?: {
110
- reckless: boolean;
111
- }): this;
112
- getContent(a: string, b: string): Content | undefined;
113
- getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
114
- has(a: string, b?: string): boolean;
115
- }
116
-
117
42
  declare const usersInThisRoomIndex: MutableAtomToken<SetRTX<string>, SetRTXJson<string>>;
118
43
  declare const roomIndex: MutableAtomToken<SetRTX<string>, SetRTXJson<string>>;
119
44
  type UserInRoomMeta = {
120
45
  enteredAtEpoch: number;
121
46
  };
122
47
  declare const DEFAULT_USER_IN_ROOM_META: UserInRoomMeta;
123
- declare const usersInRooms: {
124
- readonly relations: Junction<"room", "user", UserInRoomMeta>;
125
- readonly states: {
126
- readonly roomEntryOfUser: atom_io.ReadonlySelectorFamily<[string, UserInRoomMeta] | null, string>;
127
- } & {
128
- readonly userEntriesOfRoom: atom_io.ReadonlySelectorFamily<[string, UserInRoomMeta][], string>;
129
- } & {
130
- readonly roomKeyOfUser: atom_io.ReadonlySelectorFamily<string | null, string>;
131
- } & {
132
- readonly userKeysOfRoom: atom_io.ReadonlySelectorFamily<string[], string>;
133
- };
134
- readonly in: (store: atom_io_internal.Store) => atom_io_data.Join<"room", "user", "1:n", UserInRoomMeta>;
135
- readonly transact: (transactors: Readonly<{
136
- get: <S>(state: atom_io.ReadonlySelectorToken<S> | atom_io.WritableToken<S>) => S;
137
- set: <S_1, New extends S_1>(state: atom_io.WritableToken<S_1>, newValue: New | ((oldValue: S_1) => New)) => void;
138
- find: typeof atom_io.findState;
139
- }>, run: (join: atom_io_data.Join<"room", "user", "1:n", UserInRoomMeta>) => void) => void;
140
- readonly core: {
141
- readonly findRelatedKeysState: atom_io.MutableAtomFamily<SetRTX<string>, SetRTXJson<string>, string>;
142
- };
143
- };
48
+ declare const usersInRooms: atom_io_data.JoinToken<"room", "user", "1:n", UserInRoomMeta>;
144
49
  declare const usersInMyRoomView: atom_io.ReadonlySelectorFamilyTokenWithCall<MutableAtomToken<SetRTX<string>, SetRTXJson<string>>[], string>;
145
50
 
146
51
  export { type ContinuityOptions, type ContinuityToken, DEFAULT_USER_IN_ROOM_META, InvariantMap, type PerspectiveToken, SyncGroup, type UserInRoomMeta, continuity, roomIndex, usersInMyRoomView, usersInRooms, usersInThisRoomIndex };
@@ -1,7 +1,7 @@
1
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
- import { join } from 'atom.io/data';
4
+ import { join, getInternalRelations } from 'atom.io/data';
5
5
  import { SetRTX } from 'atom.io/transceivers/set-rtx';
6
6
 
7
7
  var InvariantMap = class extends Map {
@@ -101,8 +101,10 @@ var usersInRooms = join(
101
101
  );
102
102
  var usersInMyRoomView = selectorFamily({
103
103
  key: `usersInMyRoomView`,
104
- get: (username) => ({ find }) => {
105
- return [find(usersInRooms.core.findRelatedKeysState, username)];
104
+ get: (myUsername) => ({ find }) => {
105
+ const usersInRoomsAtoms = getInternalRelations(usersInRooms);
106
+ const myRoomIndex = find(usersInRoomsAtoms, myUsername);
107
+ return [myRoomIndex];
106
108
  }
107
109
  });
108
110
 
@@ -1,6 +1,6 @@
1
1
  import type { MutableAtomToken } from "atom.io"
2
2
  import { atom, selectorFamily } from "atom.io"
3
- import { join } from "atom.io/data"
3
+ import { getInternalRelations, join } from "atom.io/data"
4
4
  import type { SetRTXJson } from "atom.io/transceivers/set-rtx"
5
5
  import { SetRTX } from "atom.io/transceivers/set-rtx"
6
6
 
@@ -41,8 +41,10 @@ export const usersInMyRoomView = selectorFamily<
41
41
  >({
42
42
  key: `usersInMyRoomView`,
43
43
  get:
44
- (username) =>
44
+ (myUsername) =>
45
45
  ({ find }) => {
46
- return [find(usersInRooms.core.findRelatedKeysState, username)]
46
+ const usersInRoomsAtoms = getInternalRelations(usersInRooms)
47
+ const myRoomIndex = find(usersInRoomsAtoms, myUsername)
48
+ return [myRoomIndex]
47
49
  },
48
50
  })
@@ -47,7 +47,7 @@ var RealtimeProvider = ({ children, socket }) => {
47
47
  return /* @__PURE__ */ jsxRuntime.jsx(RealtimeContext.Provider, { value: { socket, services }, children });
48
48
  };
49
49
  var { NODE_ENV } = process.env;
50
- var IN_DEV = NODE_ENV === `development` || NODE_ENV === `test`;
50
+ var IN_DEV = NODE_ENV === `development`;
51
51
  function noop() {
52
52
  }
53
53
  function useSingleEffect(effect, deps) {
@@ -25,7 +25,7 @@ var RealtimeProvider = ({ children, socket }) => {
25
25
  return /* @__PURE__ */ jsx(RealtimeContext.Provider, { value: { socket, services }, children });
26
26
  };
27
27
  var { NODE_ENV } = process.env;
28
- var IN_DEV = NODE_ENV === `development` || NODE_ENV === `test`;
28
+ var IN_DEV = NODE_ENV === `development`;
29
29
  function noop() {
30
30
  }
31
31
  function useSingleEffect(effect, deps) {
@@ -1,7 +1,7 @@
1
1
  import * as React from "react"
2
2
 
3
3
  const { NODE_ENV } = process.env
4
- const IN_DEV = NODE_ENV === `development` || NODE_ENV === `test`
4
+ const IN_DEV = NODE_ENV === `development`
5
5
 
6
6
  function noop() {}
7
7