atom.io 0.40.8 → 0.40.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-Cl8Af3a2.js → chunk-CTAAG5j7.js} +3 -1
- package/dist/eslint-plugin/index.js +2 -3
- package/dist/eslint-plugin/index.js.map +1 -1
- package/dist/internal/index.d.ts +4 -3
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +1129 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/react-devtools/index.js.map +1 -1
- package/dist/realtime/index.d.ts +29 -5
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime/index.js +46 -3
- package/dist/realtime/index.js.map +1 -1
- package/dist/realtime-client/index.d.ts +1 -2
- package/dist/realtime-client/index.d.ts.map +1 -1
- package/dist/realtime-client/index.js +1 -2
- package/dist/realtime-client/index.js.map +1 -1
- package/dist/realtime-react/index.d.ts +4 -4
- package/dist/realtime-react/index.d.ts.map +1 -1
- package/dist/realtime-react/index.js +1 -2
- package/dist/realtime-react/index.js.map +1 -1
- package/dist/realtime-server/index.d.ts +5 -16
- package/dist/realtime-server/index.d.ts.map +1 -1
- package/dist/realtime-server/index.js +6 -10
- package/dist/realtime-server/index.js.map +1 -1
- package/dist/realtime-testing/index.d.ts +2 -2
- package/dist/realtime-testing/index.d.ts.map +1 -1
- package/dist/realtime-testing/index.js +2 -2
- package/dist/realtime-testing/index.js.map +1 -1
- package/dist/transceivers/set-rtx/index.d.ts +1 -1
- package/dist/transceivers/set-rtx/index.d.ts.map +1 -1
- package/dist/transceivers/set-rtx/index.js +2 -2
- package/dist/transceivers/set-rtx/index.js.map +1 -1
- package/dist/transceivers/u-list/index.d.ts +29 -0
- package/dist/transceivers/u-list/index.d.ts.map +1 -0
- package/dist/transceivers/u-list/index.js +87 -0
- package/dist/transceivers/u-list/index.js.map +1 -0
- package/package.json +8 -4
- package/src/internal/mutable/tracker.ts +21 -21
- package/src/internal/mutable/transceiver.ts +4 -4
- package/src/internal/set-state/index.ts +1 -0
- package/src/{realtime-server → realtime}/employ-socket.ts +2 -2
- package/src/realtime/index.ts +2 -0
- package/src/realtime/shared-room-store.ts +12 -11
- package/src/realtime-client/continuity/register-and-attempt-confirmed-update.ts +1 -1
- package/src/realtime-client/push-state.ts +1 -2
- package/src/realtime-react/use-single-effect.ts +1 -1
- package/src/realtime-server/continuity/continuity-store.ts +1 -1
- package/src/realtime-server/continuity/provide-outcomes.ts +2 -2
- package/src/realtime-server/continuity/provide-perspectives.ts +1 -2
- package/src/realtime-server/continuity/provide-startup-payloads.ts +3 -3
- package/src/realtime-server/continuity/receive-action-requests.ts +2 -4
- package/src/realtime-server/continuity/track-acknowledgements.ts +2 -3
- package/src/realtime-server/index.ts +0 -1
- package/src/realtime-server/ipc-sockets/custom-socket.ts +1 -2
- package/src/realtime-server/ipc-sockets/parent-socket.ts +2 -4
- package/src/realtime-server/realtime-family-provider.ts +1 -1
- package/src/realtime-server/realtime-mutable-family-provider.ts +1 -1
- package/src/realtime-server/realtime-mutable-provider.ts +1 -1
- package/src/realtime-server/realtime-server-stores/server-room-external-store.ts +2 -2
- package/src/realtime-server/realtime-server-stores/server-user-store.ts +8 -9
- package/src/realtime-server/realtime-state-provider.ts +1 -1
- package/src/realtime-server/realtime-state-receiver.ts +3 -6
- package/src/realtime-server/server-config.ts +1 -2
- package/src/realtime-testing/setup-realtime-test.tsx +3 -4
- package/src/transceivers/set-rtx/set-rtx.ts +3 -3
- package/src/transceivers/u-list/index.ts +1 -0
- package/src/transceivers/u-list/u-list.ts +123 -0
- package/dist/employ-socket-D6wgByWh.js +0 -12
- package/dist/employ-socket-D6wgByWh.js.map +0 -1
- package/dist/has-role-CMlaUlaf.js +0 -1133
- package/dist/has-role-CMlaUlaf.js.map +0 -1
- package/dist/is-fn-DY1wZ-md.js +0 -10
- package/dist/is-fn-DY1wZ-md.js.map +0 -1
- package/dist/mutex-store-CSvxY9i3.js +0 -11
- package/dist/mutex-store-CSvxY9i3.js.map +0 -1
- package/dist/shared-room-store-BfW3nWif.js +0 -31
- package/dist/shared-room-store-BfW3nWif.js.map +0 -1
- package/dist/shared-room-store-D2o4ZLjC.d.ts +0 -15
- package/dist/shared-room-store-D2o4ZLjC.d.ts.map +0 -1
- /package/src/{realtime-server → realtime}/socket-interface.ts +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Subject } from "atom.io/internal";
|
|
2
|
+
import { stringifyJson } from "atom.io/json";
|
|
3
|
+
|
|
4
|
+
//#region src/transceivers/u-list/u-list.ts
|
|
5
|
+
var UList = class UList extends Set {
|
|
6
|
+
mode = `record`;
|
|
7
|
+
subject = new Subject();
|
|
8
|
+
constructor(values) {
|
|
9
|
+
super(values);
|
|
10
|
+
if (values instanceof UList) {}
|
|
11
|
+
}
|
|
12
|
+
READONLY_VIEW = this;
|
|
13
|
+
toJSON() {
|
|
14
|
+
return { members: [...this] };
|
|
15
|
+
}
|
|
16
|
+
static fromJSON(json) {
|
|
17
|
+
return new UList(json.members);
|
|
18
|
+
}
|
|
19
|
+
add(value) {
|
|
20
|
+
const result = super.add(value);
|
|
21
|
+
if (this.mode === `record`) this.emit(`add:${stringifyJson(value)}`);
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
clear() {
|
|
25
|
+
const capturedContents = this.mode === `record` ? [...this] : null;
|
|
26
|
+
super.clear();
|
|
27
|
+
if (capturedContents) this.emit(`clear:${stringifyJson(capturedContents)}`);
|
|
28
|
+
}
|
|
29
|
+
delete(value) {
|
|
30
|
+
const result = super.delete(value);
|
|
31
|
+
if (this.mode === `record`) this.emit(`del:${stringifyJson(value)}`);
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
subscribe(key, fn) {
|
|
35
|
+
return this.subject.subscribe(key, fn);
|
|
36
|
+
}
|
|
37
|
+
emit(update) {
|
|
38
|
+
this.subject.next(update);
|
|
39
|
+
}
|
|
40
|
+
doStep(update) {
|
|
41
|
+
const typeValueBreak = update.indexOf(`:`);
|
|
42
|
+
const type = update.substring(0, typeValueBreak);
|
|
43
|
+
const value = update.substring(typeValueBreak + 1);
|
|
44
|
+
switch (type) {
|
|
45
|
+
case `add`:
|
|
46
|
+
this.add(JSON.parse(value));
|
|
47
|
+
break;
|
|
48
|
+
case `del`:
|
|
49
|
+
this.delete(JSON.parse(value));
|
|
50
|
+
break;
|
|
51
|
+
case `clear`: this.clear();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
do(update) {
|
|
55
|
+
this.mode = `playback`;
|
|
56
|
+
this.doStep(update);
|
|
57
|
+
this.mode = `record`;
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
undoStep(update) {
|
|
61
|
+
const breakpoint = update.indexOf(`:`);
|
|
62
|
+
const type = update.substring(0, breakpoint);
|
|
63
|
+
const value = update.substring(breakpoint + 1);
|
|
64
|
+
switch (type) {
|
|
65
|
+
case `add`:
|
|
66
|
+
this.delete(JSON.parse(value));
|
|
67
|
+
break;
|
|
68
|
+
case `del`:
|
|
69
|
+
this.add(JSON.parse(value));
|
|
70
|
+
break;
|
|
71
|
+
case `clear`: {
|
|
72
|
+
const values = JSON.parse(value);
|
|
73
|
+
for (const v of values) this.add(v);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
undo(update) {
|
|
78
|
+
this.mode = `playback`;
|
|
79
|
+
this.undoStep(update);
|
|
80
|
+
this.mode = `record`;
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { UList };
|
|
87
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/transceivers/u-list/u-list.ts"],"sourcesContent":["import type { Transceiver, TransceiverMode } from \"atom.io/internal\"\nimport { Subject } from \"atom.io/internal\"\nimport type { Json, primitive, stringified } from \"atom.io/json\"\nimport { stringifyJson } from \"atom.io/json\"\n\nexport type UListUpdateType = `add` | `clear` | `del`\nexport type UListUpdate<P extends primitive> =\n\t| `${`add` | `del`}:${stringified<P>}`\n\t| `clear:${stringified<P[]>}`\n\nexport interface UListJson<P extends primitive> extends Json.Object {\n\tmembers: P[]\n}\nexport class UList<P extends primitive>\n\textends Set<P>\n\timplements Transceiver<ReadonlySet<P>, UListUpdate<P>, UListJson<P>>\n{\n\tpublic mode: TransceiverMode = `record`\n\tpublic readonly subject: Subject<UListUpdate<P>> = new Subject<\n\t\tUListUpdate<P>\n\t>()\n\n\tpublic constructor(values?: Iterable<P>) {\n\t\tsuper(values)\n\t\tif (values instanceof UList) {\n\t\t}\n\t}\n\n\tpublic readonly READONLY_VIEW: ReadonlySet<P> = this\n\n\tpublic toJSON(): UListJson<P> {\n\t\treturn {\n\t\t\tmembers: [...this],\n\t\t}\n\t}\n\n\tpublic static fromJSON<P extends primitive>(json: UListJson<P>): UList<P> {\n\t\treturn new UList<P>(json.members)\n\t}\n\n\tpublic add(value: P): this {\n\t\tconst result = super.add(value)\n\t\tif (this.mode === `record`) {\n\t\t\tthis.emit(`add:${stringifyJson<P>(value)}`)\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic clear(): void {\n\t\tconst capturedContents = this.mode === `record` ? [...this] : null\n\t\tsuper.clear()\n\t\tif (capturedContents) {\n\t\t\tthis.emit(`clear:${stringifyJson(capturedContents)}`)\n\t\t}\n\t}\n\n\tpublic delete(value: P): boolean {\n\t\tconst result = super.delete(value)\n\t\tif (this.mode === `record`) {\n\t\t\tthis.emit(`del:${stringifyJson<P>(value)}`)\n\t\t}\n\t\treturn result\n\t}\n\n\tpublic subscribe(\n\t\tkey: string,\n\t\tfn: (update: UListUpdate<P>) => void,\n\t): () => void {\n\t\treturn this.subject.subscribe(key, fn)\n\t}\n\n\tpublic emit(update: UListUpdate<P>): void {\n\t\tthis.subject.next(update)\n\t}\n\n\tprivate doStep(update: UListUpdate<P>): void {\n\t\tconst typeValueBreak = update.indexOf(`:`)\n\t\tconst type = update.substring(0, typeValueBreak) as UListUpdateType\n\t\tconst value = update.substring(typeValueBreak + 1)\n\t\tswitch (type) {\n\t\t\tcase `add`:\n\t\t\t\tthis.add(JSON.parse(value))\n\t\t\t\tbreak\n\t\t\tcase `del`:\n\t\t\t\tthis.delete(JSON.parse(value))\n\t\t\t\tbreak\n\t\t\tcase `clear`:\n\t\t\t\tthis.clear()\n\t\t}\n\t}\n\n\tpublic do(update: UListUpdate<P>): null {\n\t\tthis.mode = `playback`\n\t\tthis.doStep(update)\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n\n\tpublic undoStep(update: UListUpdate<P>): void {\n\t\tconst breakpoint = update.indexOf(`:`)\n\t\tconst type = update.substring(0, breakpoint) as UListUpdateType\n\t\tconst value = update.substring(breakpoint + 1)\n\t\tswitch (type) {\n\t\t\tcase `add`:\n\t\t\t\tthis.delete(JSON.parse(value))\n\t\t\t\tbreak\n\t\t\tcase `del`:\n\t\t\t\tthis.add(JSON.parse(value))\n\t\t\t\tbreak\n\t\t\tcase `clear`: {\n\t\t\t\tconst values = JSON.parse(value) as P[]\n\t\t\t\tfor (const v of values) this.add(v)\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic undo(update: UListUpdate<P>): number | null {\n\t\tthis.mode = `playback`\n\t\tthis.undoStep(update)\n\t\tthis.mode = `record`\n\t\treturn null\n\t}\n}\n"],"mappings":";;;;AAaA,IAAa,QAAb,MAAa,cACJ,IAET;CACC,AAAO,OAAwB;CAC/B,AAAgB,UAAmC,IAAI,SAEpD;CAEH,AAAO,YAAY,QAAsB;AACxC,QAAM,OAAO;AACb,MAAI,kBAAkB,OAAO;;CAI9B,AAAgB,gBAAgC;CAEhD,AAAO,SAAuB;AAC7B,SAAO,EACN,SAAS,CAAC,GAAG,KAAK,EAClB;;CAGF,OAAc,SAA8B,MAA8B;AACzE,SAAO,IAAI,MAAS,KAAK,QAAQ;;CAGlC,AAAO,IAAI,OAAgB;EAC1B,MAAM,SAAS,MAAM,IAAI,MAAM;AAC/B,MAAI,KAAK,SAAS,SACjB,MAAK,KAAK,OAAO,cAAiB,MAAM,GAAG;AAE5C,SAAO;;CAGR,AAAO,QAAc;EACpB,MAAM,mBAAmB,KAAK,SAAS,WAAW,CAAC,GAAG,KAAK,GAAG;AAC9D,QAAM,OAAO;AACb,MAAI,iBACH,MAAK,KAAK,SAAS,cAAc,iBAAiB,GAAG;;CAIvD,AAAO,OAAO,OAAmB;EAChC,MAAM,SAAS,MAAM,OAAO,MAAM;AAClC,MAAI,KAAK,SAAS,SACjB,MAAK,KAAK,OAAO,cAAiB,MAAM,GAAG;AAE5C,SAAO;;CAGR,AAAO,UACN,KACA,IACa;AACb,SAAO,KAAK,QAAQ,UAAU,KAAK,GAAG;;CAGvC,AAAO,KAAK,QAA8B;AACzC,OAAK,QAAQ,KAAK,OAAO;;CAG1B,AAAQ,OAAO,QAA8B;EAC5C,MAAM,iBAAiB,OAAO,QAAQ,IAAI;EAC1C,MAAM,OAAO,OAAO,UAAU,GAAG,eAAe;EAChD,MAAM,QAAQ,OAAO,UAAU,iBAAiB,EAAE;AAClD,UAAQ,MAAR;GACC,KAAK;AACJ,SAAK,IAAI,KAAK,MAAM,MAAM,CAAC;AAC3B;GACD,KAAK;AACJ,SAAK,OAAO,KAAK,MAAM,MAAM,CAAC;AAC9B;GACD,KAAK,QACJ,MAAK,OAAO;;;CAIf,AAAO,GAAG,QAA8B;AACvC,OAAK,OAAO;AACZ,OAAK,OAAO,OAAO;AACnB,OAAK,OAAO;AACZ,SAAO;;CAGR,AAAO,SAAS,QAA8B;EAC7C,MAAM,aAAa,OAAO,QAAQ,IAAI;EACtC,MAAM,OAAO,OAAO,UAAU,GAAG,WAAW;EAC5C,MAAM,QAAQ,OAAO,UAAU,aAAa,EAAE;AAC9C,UAAQ,MAAR;GACC,KAAK;AACJ,SAAK,OAAO,KAAK,MAAM,MAAM,CAAC;AAC9B;GACD,KAAK;AACJ,SAAK,IAAI,KAAK,MAAM,MAAM,CAAC;AAC3B;GACD,KAAK,SAAS;IACb,MAAM,SAAS,KAAK,MAAM,MAAM;AAChC,SAAK,MAAM,KAAK,OAAQ,MAAK,IAAI,EAAE;;;;CAKtC,AAAO,KAAK,QAAuC;AAClD,OAAK,OAAO;AACZ,OAAK,SAAS,OAAO;AACrB,OAAK,OAAO;AACZ,SAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.9",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/estree": "1.0.8",
|
|
71
71
|
"@types/http-proxy": "1.17.16",
|
|
72
72
|
"@types/npmlog": "7.0.0",
|
|
73
|
-
"@types/react": "19.1.
|
|
73
|
+
"@types/react": "19.1.13",
|
|
74
74
|
"@types/tmp": "0.2.6",
|
|
75
75
|
"@typescript-eslint/parser": "8.43.0",
|
|
76
76
|
"@typescript-eslint/rule-tester": "8.43.0",
|
|
@@ -90,13 +90,13 @@
|
|
|
90
90
|
"preact": "10.27.1",
|
|
91
91
|
"react": "19.1.1",
|
|
92
92
|
"react-dom": "19.1.1",
|
|
93
|
-
"react-router-dom": "7.
|
|
93
|
+
"react-router-dom": "7.9.0",
|
|
94
94
|
"recoverage": "0.1.11",
|
|
95
95
|
"socket.io": "4.8.1",
|
|
96
96
|
"socket.io-client": "4.8.1",
|
|
97
97
|
"storybook": "9.1.5",
|
|
98
98
|
"tmp": "0.2.5",
|
|
99
|
-
"tsdown": "0.15.
|
|
99
|
+
"tsdown": "0.15.1",
|
|
100
100
|
"typescript": "5.9.2",
|
|
101
101
|
"vite": "7.1.5",
|
|
102
102
|
"vite-tsconfig-paths": "5.1.4",
|
|
@@ -170,6 +170,10 @@
|
|
|
170
170
|
"import": "./dist/transceivers/set-rtx/index.js",
|
|
171
171
|
"types": "./dist/transceivers/set-rtx/index.d.ts"
|
|
172
172
|
},
|
|
173
|
+
"./transceivers/u-list": {
|
|
174
|
+
"import": "./dist/transceivers/u-list/index.js",
|
|
175
|
+
"types": "./dist/transceivers/u-list/index.d.ts"
|
|
176
|
+
},
|
|
173
177
|
"./web": {
|
|
174
178
|
"import": "./dist/web/index.js",
|
|
175
179
|
"types": "./dist/web/index.d.ts"
|
|
@@ -136,27 +136,27 @@ export class Tracker<T extends Transceiver<any, any, any>> {
|
|
|
136
136
|
return
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
const mutable = getFromStore(target, mutableState)
|
|
140
|
-
const updateNumber = mutable.getUpdateNumber(newValue)
|
|
141
|
-
const eventOffset = updateNumber - mutable.cacheUpdateNumber
|
|
142
|
-
if (newValue && eventOffset === 1) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
} else {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
139
|
+
// const mutable = getFromStore(target, mutableState)
|
|
140
|
+
// const updateNumber = mutable.getUpdateNumber(newValue)
|
|
141
|
+
// const eventOffset = updateNumber - mutable.cacheUpdateNumber
|
|
142
|
+
// if (newValue && eventOffset === 1) {
|
|
143
|
+
setIntoStore(
|
|
144
|
+
target,
|
|
145
|
+
mutableState,
|
|
146
|
+
(transceiver) => (transceiver.do(newValue), transceiver),
|
|
147
|
+
)
|
|
148
|
+
// } else {
|
|
149
|
+
// const expected = mutable.cacheUpdateNumber + 1
|
|
150
|
+
// target.logger.info(
|
|
151
|
+
// `❌`,
|
|
152
|
+
// `mutable_atom`,
|
|
153
|
+
// mutableState.key,
|
|
154
|
+
// `could not be updated. Expected update number`,
|
|
155
|
+
// expected,
|
|
156
|
+
// `but got`,
|
|
157
|
+
// updateNumber,
|
|
158
|
+
// )
|
|
159
|
+
// }
|
|
160
160
|
},
|
|
161
161
|
{ inboundTracker: true },
|
|
162
162
|
),
|
|
@@ -9,8 +9,8 @@ export interface Transceiver<
|
|
|
9
9
|
do: (update: S) => number | `OUT_OF_RANGE` | null
|
|
10
10
|
undo: (update: S) => void
|
|
11
11
|
subscribe: (key: string, fn: (update: S) => void) => () => void
|
|
12
|
-
cacheUpdateNumber: number
|
|
13
|
-
getUpdateNumber: (update: S) => number
|
|
12
|
+
// cacheUpdateNumber: number
|
|
13
|
+
// getUpdateNumber: (update: S) => number
|
|
14
14
|
toJSON: () => J
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -31,8 +31,8 @@ export function isTransceiver(
|
|
|
31
31
|
`do` in value &&
|
|
32
32
|
`undo` in value &&
|
|
33
33
|
`subscribe` in value &&
|
|
34
|
-
`cacheUpdateNumber` in value &&
|
|
35
|
-
`getUpdateNumber` in value &&
|
|
34
|
+
// `cacheUpdateNumber` in value &&
|
|
35
|
+
// `getUpdateNumber` in value &&
|
|
36
36
|
`READONLY_VIEW` in value &&
|
|
37
37
|
`toJSON` in value
|
|
38
38
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { Socket } from "atom.io/realtime"
|
|
2
|
+
import type { Events } from "atom.io/realtime-server"
|
|
3
3
|
|
|
4
4
|
export function employSocket<I extends Events, K extends string & keyof I>(
|
|
5
5
|
socket: Socket,
|
package/src/realtime/index.ts
CHANGED
|
@@ -4,19 +4,20 @@ import type {
|
|
|
4
4
|
ReadonlyPureSelectorFamilyToken,
|
|
5
5
|
} from "atom.io"
|
|
6
6
|
import { getInternalRelations, join, mutableAtom, selectorFamily } from "atom.io"
|
|
7
|
-
import {
|
|
7
|
+
import { UList } from "atom.io/transceivers/u-list"
|
|
8
8
|
|
|
9
|
-
export const usersInThisRoomIndex: MutableAtomToken<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export const usersInThisRoomIndex: MutableAtomToken<UList<string>> = mutableAtom<
|
|
10
|
+
UList<string>
|
|
11
|
+
>({
|
|
12
|
+
key: `usersInRoomIndex`,
|
|
13
|
+
class: UList,
|
|
14
|
+
})
|
|
14
15
|
|
|
15
|
-
export const roomIndex: MutableAtomToken<
|
|
16
|
-
|
|
16
|
+
export const roomIndex: MutableAtomToken<UList<string>> = mutableAtom<
|
|
17
|
+
UList<string>
|
|
17
18
|
>({
|
|
18
19
|
key: `roomIndex`,
|
|
19
|
-
class:
|
|
20
|
+
class: UList,
|
|
20
21
|
})
|
|
21
22
|
|
|
22
23
|
export type UserInRoomMeta = {
|
|
@@ -44,9 +45,9 @@ export const usersInRooms: JoinToken<
|
|
|
44
45
|
)
|
|
45
46
|
|
|
46
47
|
export const usersInMyRoomView: ReadonlyPureSelectorFamilyToken<
|
|
47
|
-
MutableAtomToken<
|
|
48
|
+
MutableAtomToken<UList<string>>[],
|
|
48
49
|
string
|
|
49
|
-
> = selectorFamily<MutableAtomToken<
|
|
50
|
+
> = selectorFamily<MutableAtomToken<UList<string>>[], string>({
|
|
50
51
|
key: `usersInMyRoomView`,
|
|
51
52
|
get:
|
|
52
53
|
(myUsername) =>
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
setEpochNumberOfContinuity,
|
|
8
8
|
setIntoStore,
|
|
9
9
|
} from "atom.io/internal"
|
|
10
|
+
import type { Socket } from "atom.io/realtime"
|
|
10
11
|
import {
|
|
11
12
|
confirmedUpdateQueue,
|
|
12
13
|
optimisticUpdateQueue,
|
|
13
14
|
} from "atom.io/realtime-client"
|
|
14
|
-
import type { Socket } from "atom.io/realtime-server"
|
|
15
15
|
|
|
16
16
|
export const useRegisterAndAttemptConfirmedUpdate =
|
|
17
17
|
(
|
|
@@ -2,8 +2,7 @@ import type { WritableToken } from "atom.io"
|
|
|
2
2
|
import type { Store } from "atom.io/internal"
|
|
3
3
|
import { setIntoStore, subscribeToState } from "atom.io/internal"
|
|
4
4
|
import type { Json } from "atom.io/json"
|
|
5
|
-
import { mutexAtoms } from "atom.io/realtime
|
|
6
|
-
import { employSocket } from "atom.io/realtime-server/employ-socket"
|
|
5
|
+
import { employSocket, mutexAtoms } from "atom.io/realtime"
|
|
7
6
|
import type { Socket } from "socket.io-client"
|
|
8
7
|
|
|
9
8
|
export function pushState<J extends Json.Serializable>(
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
} from "atom.io"
|
|
6
6
|
import { atomFamily } from "atom.io"
|
|
7
7
|
|
|
8
|
-
import type { UserKey } from "../realtime-server-stores
|
|
8
|
+
import type { UserKey } from "../realtime-server-stores"
|
|
9
9
|
|
|
10
10
|
export function redactTransactionUpdateContent(
|
|
11
11
|
visibleStateKeys: string[],
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
subscribeToTransaction,
|
|
8
8
|
} from "atom.io/internal"
|
|
9
9
|
import type { Json } from "atom.io/json"
|
|
10
|
-
import type { ContinuityToken } from "atom.io/realtime"
|
|
10
|
+
import type { ContinuityToken, Socket } from "atom.io/realtime"
|
|
11
11
|
|
|
12
|
-
import type {
|
|
12
|
+
import type { UserKey } from ".."
|
|
13
13
|
import {
|
|
14
14
|
redactTransactionUpdateContent,
|
|
15
15
|
unacknowledgedUpdatesAtoms,
|
|
@@ -5,9 +5,8 @@ import {
|
|
|
5
5
|
getJsonToken,
|
|
6
6
|
subscribeToState,
|
|
7
7
|
} from "atom.io/internal"
|
|
8
|
-
import type { ContinuityToken } from "atom.io/realtime"
|
|
8
|
+
import type { ContinuityToken, Socket } from "atom.io/realtime"
|
|
9
9
|
|
|
10
|
-
import type { Socket } from ".."
|
|
11
10
|
import type { UserKey } from "../realtime-server-stores"
|
|
12
11
|
|
|
13
12
|
export function providePerspectives(
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
isRootStore,
|
|
7
7
|
} from "atom.io/internal"
|
|
8
8
|
import type { Json } from "atom.io/json"
|
|
9
|
-
import type { ContinuityToken } from "atom.io/realtime"
|
|
9
|
+
import type { ContinuityToken, Socket } from "atom.io/realtime"
|
|
10
|
+
import { employSocket } from "atom.io/realtime"
|
|
10
11
|
|
|
11
|
-
import type {
|
|
12
|
-
import { employSocket } from "../employ-socket"
|
|
12
|
+
import type { UserKey } from ".."
|
|
13
13
|
|
|
14
14
|
export function provideStartupPayloads(
|
|
15
15
|
store: Store,
|
|
@@ -2,10 +2,8 @@ import type { TransactionOutcomeEvent, TransactionToken } from "atom.io"
|
|
|
2
2
|
import type { Store } from "atom.io/internal"
|
|
3
3
|
import { actUponStore } from "atom.io/internal"
|
|
4
4
|
import type { Json, JsonIO } from "atom.io/json"
|
|
5
|
-
import type { ContinuityToken } from "atom.io/realtime"
|
|
6
|
-
|
|
7
|
-
import { employSocket } from "../employ-socket"
|
|
8
|
-
import type { Socket } from "../socket-interface"
|
|
5
|
+
import type { ContinuityToken, Socket } from "atom.io/realtime"
|
|
6
|
+
import { employSocket } from "atom.io/realtime"
|
|
9
7
|
|
|
10
8
|
export function receiveActionRequests(
|
|
11
9
|
store: Store,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Store } from "atom.io/internal"
|
|
2
2
|
import { getFromStore, setIntoStore } from "atom.io/internal"
|
|
3
|
-
import type { ContinuityToken } from "atom.io/realtime"
|
|
3
|
+
import type { ContinuityToken, Socket } from "atom.io/realtime"
|
|
4
|
+
import { employSocket } from "atom.io/realtime"
|
|
4
5
|
|
|
5
|
-
import { employSocket } from "../employ-socket"
|
|
6
6
|
import type { UserKey } from "../realtime-server-stores"
|
|
7
|
-
import type { Socket } from "../socket-interface"
|
|
8
7
|
import { unacknowledgedUpdatesAtoms } from "./continuity-store"
|
|
9
8
|
|
|
10
9
|
export function trackAcknowledgements(
|
|
@@ -3,7 +3,7 @@ import type { Readable, Writable } from "node:stream"
|
|
|
3
3
|
import { Subject } from "atom.io/internal"
|
|
4
4
|
import type { Json } from "atom.io/json"
|
|
5
5
|
import { parseJson, stringifyJson } from "atom.io/json"
|
|
6
|
-
import {
|
|
6
|
+
import { UList } from "atom.io/transceivers/u-list"
|
|
7
7
|
|
|
8
8
|
import type { UserKey } from "../realtime-server-stores"
|
|
9
9
|
import type { StderrLog } from "./child-socket"
|
|
@@ -76,9 +76,7 @@ export class ParentSocket<
|
|
|
76
76
|
this.proc.stderr.write(
|
|
77
77
|
stringifyJson(
|
|
78
78
|
args.map((arg) =>
|
|
79
|
-
arg instanceof
|
|
80
|
-
? `{ ${arg.toJSON().members.join(` | `)} }`
|
|
81
|
-
: arg,
|
|
79
|
+
arg instanceof UList ? `{ ${arg.toJSON().members.join(` | `)} }` : arg,
|
|
82
80
|
),
|
|
83
81
|
) + `\x03`,
|
|
84
82
|
)
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from "atom.io/internal"
|
|
8
8
|
import type { Canonical, Json, stringified } from "atom.io/json"
|
|
9
9
|
import { stringifyJson } from "atom.io/json"
|
|
10
|
+
import { employSocket } from "atom.io/realtime"
|
|
10
11
|
|
|
11
12
|
import type { ServerConfig } from "."
|
|
12
|
-
import { employSocket } from "./employ-socket"
|
|
13
13
|
|
|
14
14
|
export type FamilyProvider = ReturnType<typeof realtimeAtomFamilyProvider>
|
|
15
15
|
export function realtimeAtomFamilyProvider({
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
} from "atom.io/internal"
|
|
11
11
|
import type { Canonical, stringified } from "atom.io/json"
|
|
12
12
|
import { stringifyJson } from "atom.io/json"
|
|
13
|
+
import { employSocket } from "atom.io/realtime"
|
|
13
14
|
|
|
14
15
|
import type { ServerConfig } from "."
|
|
15
|
-
import { employSocket } from "./employ-socket"
|
|
16
16
|
|
|
17
17
|
export type MutableFamilyProvider = ReturnType<
|
|
18
18
|
typeof realtimeMutableFamilyProvider
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
subscribeToState,
|
|
9
9
|
} from "atom.io/internal"
|
|
10
10
|
import type { Json } from "atom.io/json"
|
|
11
|
+
import { employSocket } from "atom.io/realtime"
|
|
11
12
|
|
|
12
13
|
import type { ServerConfig } from "."
|
|
13
|
-
import { employSocket } from "./employ-socket"
|
|
14
14
|
|
|
15
15
|
export type MutableProvider = ReturnType<typeof realtimeMutableProvider>
|
|
16
16
|
export function realtimeMutableProvider({
|
|
@@ -4,8 +4,8 @@ import { spawn } from "node:child_process"
|
|
|
4
4
|
import type { TransactionIO, TransactionToken } from "atom.io"
|
|
5
5
|
import { transaction } from "atom.io"
|
|
6
6
|
import { editRelationsInStore } from "atom.io/internal"
|
|
7
|
-
import type { UserInRoomMeta } from "atom.io/realtime
|
|
8
|
-
import { roomIndex, usersInRooms } from "atom.io/realtime
|
|
7
|
+
import type { UserInRoomMeta } from "atom.io/realtime"
|
|
8
|
+
import { roomIndex, usersInRooms } from "atom.io/realtime"
|
|
9
9
|
|
|
10
10
|
import { ChildSocket } from "../ipc-sockets"
|
|
11
11
|
import type { RoomKey } from "./server-user-store"
|
|
@@ -6,9 +6,8 @@ import type {
|
|
|
6
6
|
RegularAtomFamilyToken,
|
|
7
7
|
} from "atom.io"
|
|
8
8
|
import { atomFamily, join, mutableAtom, selectorFamily } from "atom.io"
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import type { Socket } from ".."
|
|
9
|
+
import type { Socket } from "atom.io/realtime"
|
|
10
|
+
import { UList } from "atom.io/transceivers/u-list"
|
|
12
11
|
|
|
13
12
|
export type SocketKey = `socket::${string}`
|
|
14
13
|
export type UserKey = `user::${string}`
|
|
@@ -29,17 +28,17 @@ export const socketAtoms: RegularAtomFamilyToken<Socket | null, SocketKey> =
|
|
|
29
28
|
default: null,
|
|
30
29
|
})
|
|
31
30
|
|
|
32
|
-
export const socketIndex: MutableAtomToken<
|
|
33
|
-
|
|
31
|
+
export const socketIndex: MutableAtomToken<UList<SocketKey>> = mutableAtom<
|
|
32
|
+
UList<SocketKey>
|
|
34
33
|
>({
|
|
35
34
|
key: `socketsIndex`,
|
|
36
|
-
class:
|
|
35
|
+
class: UList,
|
|
37
36
|
})
|
|
38
|
-
export const userIndex: MutableAtomToken<
|
|
39
|
-
|
|
37
|
+
export const userIndex: MutableAtomToken<UList<UserKey>> = mutableAtom<
|
|
38
|
+
UList<UserKey>
|
|
40
39
|
>({
|
|
41
40
|
key: `usersIndex`,
|
|
42
|
-
class:
|
|
41
|
+
class: UList,
|
|
43
42
|
})
|
|
44
43
|
export const usersOfSockets: JoinToken<
|
|
45
44
|
`user`,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as AtomIO from "atom.io"
|
|
2
2
|
import { getFromStore, IMPLICIT, subscribeToState } from "atom.io/internal"
|
|
3
3
|
import type { Json } from "atom.io/json"
|
|
4
|
+
import { employSocket } from "atom.io/realtime"
|
|
4
5
|
|
|
5
6
|
import type { ServerConfig } from "."
|
|
6
|
-
import { employSocket } from "./employ-socket"
|
|
7
7
|
|
|
8
8
|
export type StateProvider = ReturnType<typeof realtimeStateProvider>
|
|
9
9
|
export function realtimeStateProvider({
|
|
@@ -3,18 +3,15 @@ import {
|
|
|
3
3
|
findInStore,
|
|
4
4
|
getFromStore,
|
|
5
5
|
IMPLICIT,
|
|
6
|
+
operateOnStore,
|
|
7
|
+
OWN_OP,
|
|
6
8
|
setIntoStore,
|
|
7
9
|
subscribeToState,
|
|
8
10
|
} from "atom.io/internal"
|
|
9
|
-
import {
|
|
10
|
-
operateOnStore,
|
|
11
|
-
OWN_OP,
|
|
12
|
-
} from "atom.io/internal/set-state/operate-on-store"
|
|
13
11
|
import type { Json } from "atom.io/json"
|
|
14
|
-
import { mutexAtoms } from "atom.io/realtime
|
|
12
|
+
import { employSocket, mutexAtoms } from "atom.io/realtime"
|
|
15
13
|
|
|
16
14
|
import type { ServerConfig } from "."
|
|
17
|
-
import { employSocket } from "./employ-socket"
|
|
18
15
|
|
|
19
16
|
export type StateReceiver = ReturnType<typeof realtimeStateReceiver>
|
|
20
17
|
export function realtimeStateReceiver({
|
|
@@ -19,7 +19,7 @@ import * as AR from "atom.io/react"
|
|
|
19
19
|
import * as RTC from "atom.io/realtime-client"
|
|
20
20
|
import * as RTR from "atom.io/realtime-react"
|
|
21
21
|
import * as RTS from "atom.io/realtime-server"
|
|
22
|
-
import {
|
|
22
|
+
import { UList } from "atom.io/transceivers/u-list"
|
|
23
23
|
import * as Happy from "happy-dom"
|
|
24
24
|
import * as React from "react"
|
|
25
25
|
import * as SocketIO from "socket.io"
|
|
@@ -45,9 +45,8 @@ function prefixLogger(store: Store, prefix: string) {
|
|
|
45
45
|
if (param instanceof ChildProcess) {
|
|
46
46
|
params[idx] = `ChildProcess:${param.pid}`
|
|
47
47
|
}
|
|
48
|
-
if (param instanceof
|
|
49
|
-
params[idx] =
|
|
50
|
-
`SetRTX(${param.size}) {${[...param].join(`, `)}} at ${param.cacheIdx}`
|
|
48
|
+
if (param instanceof UList) {
|
|
49
|
+
params[idx] = `UList(${param.size}) {${[...param].join(`, `)}}`
|
|
51
50
|
}
|
|
52
51
|
idx++
|
|
53
52
|
}
|
|
@@ -5,7 +5,7 @@ import { stringifyJson } from "atom.io/json"
|
|
|
5
5
|
|
|
6
6
|
export type SetUpdateType = `add` | `clear` | `del` | `tx`
|
|
7
7
|
export type SetUpdate = `${SetUpdateType}:${string}`
|
|
8
|
-
export type NumberedSetUpdate = `${number}=${SetUpdate}`
|
|
8
|
+
export type NumberedSetUpdate = `${number | `*`}=${SetUpdate}`
|
|
9
9
|
|
|
10
10
|
export interface SetRTXView<P extends primitive> extends ReadonlySet<P> {
|
|
11
11
|
readonly cache: ReadonlyArray<NumberedSetUpdate | null>
|
|
@@ -182,8 +182,8 @@ export class SetRTX<P extends primitive>
|
|
|
182
182
|
const updateNumber = Number(update.substring(0, breakpoint))
|
|
183
183
|
const eventOffset = updateNumber - this.cacheUpdateNumber
|
|
184
184
|
const isFuture = eventOffset > 0
|
|
185
|
-
if (isFuture) {
|
|
186
|
-
if (eventOffset === 1) {
|
|
185
|
+
if (isFuture || Number.isNaN(eventOffset)) {
|
|
186
|
+
if (eventOffset === 1 || Number.isNaN(eventOffset)) {
|
|
187
187
|
this.mode = `playback`
|
|
188
188
|
const innerUpdate = update.substring(breakpoint + 1) as SetUpdate
|
|
189
189
|
this.doStep(innerUpdate)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./u-list"
|