atom.io 0.14.6 → 0.14.8
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/package.json +2 -2
- package/react/dist/index.cjs +13 -16
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.js +13 -16
- package/react/dist/index.js.map +1 -1
- package/react/src/store-hooks.ts +14 -16
- package/data/dist/index.d.cts +0 -158
- package/dist/index.d.cts +0 -245
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
- package/internal/dist/index.d.cts +0 -421
- package/introspection/dist/index.d.cts +0 -24
- package/json/dist/index.d.cts +0 -51
- package/react/dist/index.d.cts +0 -23
- package/react-devtools/dist/index.d.cts +0 -342
- package/realtime-client/dist/index.d.cts +0 -22
- package/realtime-react/dist/index.d.cts +0 -27
- package/realtime-server/dist/index.d.cts +0 -25
- package/realtime-testing/dist/index.d.cts +0 -49
- package/transceivers/set-rtx/dist/index.d.cts +0 -40
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import * as atom_io from 'atom.io';
|
|
2
|
-
import { FamilyMetadata, ƒn, TransactionUpdate, MutableAtomToken, AtomToken, StateToken, TimelineUpdate, StateUpdate, AtomFamily, ReadonlySelectorFamily, SelectorFamily, ReadonlySelectorToken, SelectorToken, TransactionToken, TimelineToken, AtomIOLogger, Logger } from 'atom.io';
|
|
3
|
-
import { Json } from 'atom.io/json';
|
|
4
|
-
|
|
5
|
-
type ClassSignature = abstract new (...args: any) => any;
|
|
6
|
-
|
|
7
|
-
type RefinementStrategy = ClassSignature | Refinement$1<unknown, any>;
|
|
8
|
-
type Supported<Refine extends RefinementStrategy> = Refine extends Refinement$1<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
|
|
9
|
-
type RefinementSupport = Record<string, RefinementStrategy>;
|
|
10
|
-
declare class Refinery<SupportedTypes extends RefinementSupport> {
|
|
11
|
-
supported: SupportedTypes;
|
|
12
|
-
constructor(supported: SupportedTypes);
|
|
13
|
-
refine(input: unknown): {
|
|
14
|
-
[K in keyof SupportedTypes]: {
|
|
15
|
-
type: K;
|
|
16
|
-
data: Supported<SupportedTypes[K]>;
|
|
17
|
-
};
|
|
18
|
-
}[keyof SupportedTypes] | null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Refinement$1<A, B extends A> {
|
|
22
|
-
(a: A): a is B;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type PlainObject = Record<keyof any, unknown>;
|
|
26
|
-
|
|
27
|
-
declare class Subject<T> {
|
|
28
|
-
Subscriber: (value: T) => void;
|
|
29
|
-
subscribers: Map<string, this[`Subscriber`]>;
|
|
30
|
-
subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
|
|
31
|
-
private unsubscribe;
|
|
32
|
-
next(value: T): void;
|
|
33
|
-
}
|
|
34
|
-
declare class StatefulSubject<T> extends Subject<T> {
|
|
35
|
-
state: T;
|
|
36
|
-
constructor(initialState: T);
|
|
37
|
-
next(value: T): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type Selector<T> = {
|
|
41
|
-
key: string;
|
|
42
|
-
type: `selector`;
|
|
43
|
-
family?: FamilyMetadata;
|
|
44
|
-
install: (store: Store) => void;
|
|
45
|
-
subject: Subject<{
|
|
46
|
-
newValue: T;
|
|
47
|
-
oldValue: T;
|
|
48
|
-
}>;
|
|
49
|
-
get: () => T;
|
|
50
|
-
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
51
|
-
};
|
|
52
|
-
type ReadonlySelector<T> = {
|
|
53
|
-
key: string;
|
|
54
|
-
type: `readonly_selector`;
|
|
55
|
-
family?: FamilyMetadata;
|
|
56
|
-
install: (store: Store) => void;
|
|
57
|
-
subject: Subject<{
|
|
58
|
-
newValue: T;
|
|
59
|
-
oldValue: T;
|
|
60
|
-
}>;
|
|
61
|
-
get: () => T;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
type Transaction<ƒ extends ƒn> = {
|
|
65
|
-
key: string;
|
|
66
|
-
type: `transaction`;
|
|
67
|
-
install: (store: Store) => void;
|
|
68
|
-
subject: Subject<TransactionUpdate<ƒ>>;
|
|
69
|
-
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
type TransactionMeta<ƒ extends ƒn> = {
|
|
73
|
-
phase: `applying` | `building`;
|
|
74
|
-
time: number;
|
|
75
|
-
update: TransactionUpdate<ƒ>;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
type primitive = boolean | number | string | null;
|
|
79
|
-
|
|
80
|
-
type Serializable = primitive | Readonly<{
|
|
81
|
-
[key: string]: Serializable;
|
|
82
|
-
}> | ReadonlyArray<Serializable>;
|
|
83
|
-
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
84
|
-
|
|
85
|
-
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
86
|
-
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
87
|
-
|
|
88
|
-
interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
|
|
89
|
-
readonly relations: [string, string[]][];
|
|
90
|
-
readonly contents: [string, Content][];
|
|
91
|
-
}
|
|
92
|
-
interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
|
|
93
|
-
readonly between: [a: ASide, b: BSide];
|
|
94
|
-
readonly cardinality: Cardinality;
|
|
95
|
-
}
|
|
96
|
-
type BaseExternalStoreConfiguration = {
|
|
97
|
-
addRelation: (a: string, b: string) => void;
|
|
98
|
-
deleteRelation: (a: string, b: string) => void;
|
|
99
|
-
replaceRelationsSafely: (a: string, bs: string[]) => void;
|
|
100
|
-
replaceRelationsUnsafely: (a: string, bs: string[]) => void;
|
|
101
|
-
getRelatedKeys: (key: string) => Set<string> | undefined;
|
|
102
|
-
has: (a: string, b?: string) => boolean;
|
|
103
|
-
};
|
|
104
|
-
type ExternalStoreWithContentConfiguration<Content extends Object$1> = {
|
|
105
|
-
getContent: (contentKey: string) => Content | undefined;
|
|
106
|
-
setContent: (contentKey: string, content: Content) => void;
|
|
107
|
-
deleteContent: (contentKey: string) => void;
|
|
108
|
-
};
|
|
109
|
-
type Empty<Obj extends object> = {
|
|
110
|
-
[Key in keyof Obj]?: undefined;
|
|
111
|
-
};
|
|
112
|
-
type ExternalStoreConfiguration<Content extends Object$1 | null> = Content extends Object$1 ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Object$1>>;
|
|
113
|
-
type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
|
|
114
|
-
externalStore?: ExternalStoreConfiguration<Content>;
|
|
115
|
-
isContent?: Refinement<unknown, Content>;
|
|
116
|
-
makeContentKey?: (a: string, b: string) => string;
|
|
117
|
-
};
|
|
118
|
-
type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
|
|
119
|
-
declare class Junction<const ASide extends string, const BSide extends string, const Content extends Object$1 | null = null> {
|
|
120
|
-
readonly a: ASide;
|
|
121
|
-
readonly b: BSide;
|
|
122
|
-
readonly cardinality: Cardinality;
|
|
123
|
-
readonly relations: Map<string, Set<string>>;
|
|
124
|
-
readonly contents: Map<string, Content>;
|
|
125
|
-
isContent: Refinement<unknown, Content> | null;
|
|
126
|
-
makeContentKey: (a: string, b: string) => string;
|
|
127
|
-
getRelatedKeys(key: string): Set<string> | undefined;
|
|
128
|
-
protected addRelation(a: string, b: string): void;
|
|
129
|
-
protected deleteRelation(a: string, b: string): void;
|
|
130
|
-
protected replaceRelationsUnsafely(a: string, bs: string[]): void;
|
|
131
|
-
protected replaceRelationsSafely(a: string, bs: string[]): void;
|
|
132
|
-
protected getContentInternal(contentKey: string): Content | undefined;
|
|
133
|
-
protected setContent(contentKey: string, content: Content): void;
|
|
134
|
-
protected deleteContent(contentKey: string): void;
|
|
135
|
-
constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
|
|
136
|
-
toJSON(): JunctionJSON<ASide, BSide, Content>;
|
|
137
|
-
set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
|
|
138
|
-
set(relation: {
|
|
139
|
-
[Key in ASide | BSide]: string;
|
|
140
|
-
}, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
|
|
141
|
-
delete(a: string, b?: string): this;
|
|
142
|
-
delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
|
|
143
|
-
getRelatedKey(key: string): string | undefined;
|
|
144
|
-
replaceRelations(a: string, relations: Content extends null ? string[] : Record<string, Content>, config?: {
|
|
145
|
-
reckless: boolean;
|
|
146
|
-
}): this;
|
|
147
|
-
getContent(a: string, b: string): Content | undefined;
|
|
148
|
-
getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
|
|
149
|
-
has(a: string, b?: string): boolean;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
interface Lineage {
|
|
153
|
-
parent: typeof this | null;
|
|
154
|
-
child: typeof this | null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
interface Transceiver<Signal extends Json.Serializable> {
|
|
158
|
-
do: (update: Signal) => void;
|
|
159
|
-
undo: (update: Signal) => void;
|
|
160
|
-
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
161
|
-
cacheUpdateNumber: number;
|
|
162
|
-
getUpdateNumber: (update: Signal) => number;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @internal Give the tracker a transceiver state and a store, and it will
|
|
167
|
-
* subscribe to the transceiver's inner value. When the inner value changes,
|
|
168
|
-
* the tracker will update its own state to reflect the change.
|
|
169
|
-
*/
|
|
170
|
-
declare class Tracker<Mutable extends Transceiver<any>> {
|
|
171
|
-
private Update;
|
|
172
|
-
private initializeState;
|
|
173
|
-
private unsubscribeFromInnerValue;
|
|
174
|
-
private observeCore;
|
|
175
|
-
private updateCore;
|
|
176
|
-
mutableState: MutableAtomToken<Mutable, Json.Serializable>;
|
|
177
|
-
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
178
|
-
constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
interface MutableAtom<T> extends Atom<T> {
|
|
182
|
-
mutable: true;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
type OperationProgress = {
|
|
186
|
-
open: false;
|
|
187
|
-
} | {
|
|
188
|
-
open: true;
|
|
189
|
-
done: Set<string>;
|
|
190
|
-
prev: Map<string, any>;
|
|
191
|
-
time: number;
|
|
192
|
-
token: StateToken<any>;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
type TimelineAtomUpdate = StateUpdate<unknown> & {
|
|
196
|
-
key: string;
|
|
197
|
-
type: `atom_update`;
|
|
198
|
-
timestamp: number;
|
|
199
|
-
family?: FamilyMetadata;
|
|
200
|
-
};
|
|
201
|
-
type TimelineSelectorUpdate = {
|
|
202
|
-
key: string;
|
|
203
|
-
type: `selector_update`;
|
|
204
|
-
timestamp: number;
|
|
205
|
-
atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
|
|
206
|
-
};
|
|
207
|
-
type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
208
|
-
key: string;
|
|
209
|
-
type: `transaction_update`;
|
|
210
|
-
timestamp: number;
|
|
211
|
-
};
|
|
212
|
-
type Timeline = {
|
|
213
|
-
type: `timeline`;
|
|
214
|
-
key: string;
|
|
215
|
-
at: number;
|
|
216
|
-
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
217
|
-
timeTraveling: `into_future` | `into_past` | null;
|
|
218
|
-
history: TimelineUpdate[];
|
|
219
|
-
selectorTime: number | null;
|
|
220
|
-
transactionKey: string | null;
|
|
221
|
-
install: (store: Store) => void;
|
|
222
|
-
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
declare class Store implements Lineage {
|
|
226
|
-
parent: Store | null;
|
|
227
|
-
child: Store | null;
|
|
228
|
-
valueMap: Map<string, any>;
|
|
229
|
-
atoms: Map<string, Atom<any> | MutableAtom<any>>;
|
|
230
|
-
selectors: Map<string, Selector<any>>;
|
|
231
|
-
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
232
|
-
trackers: Map<string, Tracker<Transceiver<any>>>;
|
|
233
|
-
families: Map<string, AtomFamily<any, any> | ReadonlySelectorFamily<any, any> | SelectorFamily<any, any>>;
|
|
234
|
-
timelines: Map<string, Timeline>;
|
|
235
|
-
transactions: Map<string, Transaction<ƒn>>;
|
|
236
|
-
atomsThatAreDefault: Set<string>;
|
|
237
|
-
timelineAtoms: Junction<"timelineKey", "atomKey", null>;
|
|
238
|
-
selectorAtoms: Junction<"selectorKey", "atomKey", null>;
|
|
239
|
-
selectorGraph: Junction<"upstreamSelectorKey", "downstreamSelectorKey", {
|
|
240
|
-
source: string;
|
|
241
|
-
}>;
|
|
242
|
-
subject: {
|
|
243
|
-
atomCreation: Subject<AtomToken<unknown>>;
|
|
244
|
-
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
245
|
-
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
246
|
-
timelineCreation: Subject<TimelineToken>;
|
|
247
|
-
transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
|
|
248
|
-
operationStatus: Subject<OperationProgress>;
|
|
249
|
-
};
|
|
250
|
-
operation: OperationProgress;
|
|
251
|
-
transactionMeta: TransactionMeta<ƒn> | null;
|
|
252
|
-
config: {
|
|
253
|
-
name: string;
|
|
254
|
-
};
|
|
255
|
-
loggers: AtomIOLogger[];
|
|
256
|
-
logger: Logger;
|
|
257
|
-
constructor(name: string, store?: Store | null);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
type Atom<T> = {
|
|
261
|
-
key: string;
|
|
262
|
-
type: `atom`;
|
|
263
|
-
mutable?: boolean;
|
|
264
|
-
family?: FamilyMetadata;
|
|
265
|
-
install: (store: Store) => void;
|
|
266
|
-
subject: Subject<{
|
|
267
|
-
newValue: T;
|
|
268
|
-
oldValue: T;
|
|
269
|
-
}>;
|
|
270
|
-
default: T | (() => T);
|
|
271
|
-
cleanup?: () => void;
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
type AtomTokenIndex = StateTokenIndex<AtomToken<unknown>>;
|
|
275
|
-
|
|
276
|
-
type FamilyNode<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = {
|
|
277
|
-
key: string;
|
|
278
|
-
familyMembers: Record<string, Token>;
|
|
279
|
-
};
|
|
280
|
-
type StateTokenIndex<Token extends AtomToken<unknown> | ReadonlySelectorToken<unknown> | SelectorToken<unknown>> = Record<string, FamilyNode<Token> | Token>;
|
|
281
|
-
|
|
282
|
-
type SelectorTokenIndex = StateTokenIndex<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
283
|
-
|
|
284
|
-
type Delta = {
|
|
285
|
-
summary: string;
|
|
286
|
-
added?: [path: string, addedStringifiedValue: string][];
|
|
287
|
-
removed?: [path: string, removedStringifiedValue: string][];
|
|
288
|
-
changed?: [path: string, delta: Delta][];
|
|
289
|
-
};
|
|
290
|
-
type Diff<T> = (a: T, b: T) => Delta;
|
|
291
|
-
type DiffTree<T> = (a: T, b: T, recurse: Differ<any, any>[`diff`]) => Delta;
|
|
292
|
-
declare class Differ<Leaf extends Record<string, any>, Tree extends Record<string, any>> {
|
|
293
|
-
leafRefinery: Refinery<Leaf>;
|
|
294
|
-
treeRefinery: Refinery<Tree>;
|
|
295
|
-
leafDiffers: {
|
|
296
|
-
[KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
|
|
297
|
-
};
|
|
298
|
-
treeDiffers: {
|
|
299
|
-
[KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
|
|
300
|
-
};
|
|
301
|
-
constructor(leafRefinery: Refinery<Leaf>, treeRefinery: Refinery<Tree>, diffFunctions: {
|
|
302
|
-
[KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
|
|
303
|
-
} & {
|
|
304
|
-
[KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
|
|
305
|
-
});
|
|
306
|
-
diff(a: unknown, b: unknown): Delta;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
declare const AtomIODevtools: () => JSX.Element;
|
|
310
|
-
|
|
311
|
-
declare const atomIndex: atom_io.ReadonlySelectorToken<AtomTokenIndex>;
|
|
312
|
-
declare const selectorIndex: atom_io.ReadonlySelectorToken<SelectorTokenIndex>;
|
|
313
|
-
declare const transactionIndex: atom_io.ReadonlySelectorToken<atom_io.TransactionToken<atom_io.ƒn>[]>;
|
|
314
|
-
declare const findTransactionLogState: atom_io.ReadonlySelectorFamily<atom_io.TransactionUpdate<atom_io.ƒn>[]>;
|
|
315
|
-
declare const timelineIndex: atom_io.ReadonlySelectorToken<atom_io.TimelineToken[]>;
|
|
316
|
-
declare const findTimelineState: atom_io.ReadonlySelectorFamily<Timeline>;
|
|
317
|
-
declare const devtoolsAreOpenState: atom_io.AtomToken<boolean>;
|
|
318
|
-
type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`;
|
|
319
|
-
declare const devtoolsViewSelectionState: atom_io.AtomToken<DevtoolsView>;
|
|
320
|
-
declare const devtoolsViewOptionsState: atom_io.AtomToken<DevtoolsView[]>;
|
|
321
|
-
declare const findViewIsOpenState: atom_io.AtomFamily<boolean, string>;
|
|
322
|
-
declare const primitiveRefinery: Refinery<{
|
|
323
|
-
number: (input: unknown) => input is number;
|
|
324
|
-
string: (input: unknown) => input is string;
|
|
325
|
-
boolean: (input: unknown) => input is boolean;
|
|
326
|
-
null: (input: unknown) => input is null;
|
|
327
|
-
}>;
|
|
328
|
-
declare const jsonTreeRefinery: Refinery<{
|
|
329
|
-
object: (input: unknown) => input is PlainObject;
|
|
330
|
-
array: (input: unknown) => input is unknown[];
|
|
331
|
-
}>;
|
|
332
|
-
declare const prettyJson: Differ<{
|
|
333
|
-
number: (input: unknown) => input is number;
|
|
334
|
-
string: (input: unknown) => input is string;
|
|
335
|
-
boolean: (input: unknown) => input is boolean;
|
|
336
|
-
null: (input: unknown) => input is null;
|
|
337
|
-
}, {
|
|
338
|
-
object: (input: unknown) => input is PlainObject;
|
|
339
|
-
array: (input: unknown) => input is unknown[];
|
|
340
|
-
}>;
|
|
341
|
-
|
|
342
|
-
export { AtomIODevtools, atomIndex, devtoolsAreOpenState, devtoolsViewOptionsState, devtoolsViewSelectionState, findTimelineState, findTransactionLogState, findViewIsOpenState, jsonTreeRefinery, prettyJson, primitiveRefinery, selectorIndex, timelineIndex, transactionIndex };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as AtomIO from 'atom.io';
|
|
2
|
-
import * as Internal from 'atom.io/internal';
|
|
3
|
-
import { Store, Transceiver } from 'atom.io/internal';
|
|
4
|
-
import { Json } from 'atom.io/json';
|
|
5
|
-
import { Socket } from 'socket.io-client';
|
|
6
|
-
|
|
7
|
-
declare const myIdState__INTERNAL: AtomIO.AtomToken<string | null>;
|
|
8
|
-
declare const myIdState: AtomIO.ReadonlySelectorToken<string | null>;
|
|
9
|
-
|
|
10
|
-
declare function pullState<J extends Json.Serializable>(token: AtomIO.StateToken<J>, socket: Socket, store: Store): () => void;
|
|
11
|
-
|
|
12
|
-
declare function pullFamilyMember<J extends Json.Serializable>(token: AtomIO.AtomToken<J>, socket: Socket, store: Store): () => void;
|
|
13
|
-
|
|
14
|
-
declare function pullMutableState<T extends Transceiver<Json.Serializable>, J extends Json.Serializable>(token: AtomIO.MutableAtomToken<T, J>, socket: Socket, store: Store): () => void;
|
|
15
|
-
|
|
16
|
-
declare function pullMutableFamilyMember<T extends Transceiver<Json.Serializable>, J extends Json.Serializable>(token: AtomIO.MutableAtomToken<T, J>, socket: Socket, store: Store): () => void;
|
|
17
|
-
|
|
18
|
-
declare function pushState<J extends Json.Serializable>(token: AtomIO.StateToken<J>, socket: Socket, subscriptionKey: string, store: Internal.Store): () => void;
|
|
19
|
-
|
|
20
|
-
declare function synchronizeTransactionResults(token: AtomIO.TransactionToken<any>, socket: Socket, store: Internal.Store): () => void;
|
|
21
|
-
|
|
22
|
-
export { myIdState, myIdState__INTERNAL, pullFamilyMember, pullMutableFamilyMember, pullMutableState, pullState, pushState, synchronizeTransactionResults };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Socket } from 'socket.io-client';
|
|
3
|
-
import * as AtomIO from 'atom.io';
|
|
4
|
-
import { Json } from 'atom.io/json';
|
|
5
|
-
import { Transceiver } from 'atom.io/internal';
|
|
6
|
-
|
|
7
|
-
declare const RealtimeContext: React.Context<{
|
|
8
|
-
socket: Socket;
|
|
9
|
-
}>;
|
|
10
|
-
declare const RealtimeProvider: React.FC<{
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
socket: Socket;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
declare function usePull<J extends Json.Serializable>(token: AtomIO.StateToken<J>): void;
|
|
16
|
-
|
|
17
|
-
declare function usePullFamilyMember<J extends Json.Serializable>(token: AtomIO.AtomToken<J>): void;
|
|
18
|
-
|
|
19
|
-
declare function usePullMutable<T extends Transceiver<Json.Serializable>, J extends Json.Serializable>(token: AtomIO.MutableAtomToken<T, J>): void;
|
|
20
|
-
|
|
21
|
-
declare function usePullMutableFamilyMember<T extends Transceiver<Json.Serializable>, J extends Json.Serializable>(token: AtomIO.MutableAtomToken<T, J>): void;
|
|
22
|
-
|
|
23
|
-
declare function usePush<J extends Json.Serializable>(token: AtomIO.StateToken<J>): void;
|
|
24
|
-
|
|
25
|
-
declare function useServerAction<ƒ extends AtomIO.ƒn>(token: AtomIO.TransactionToken<ƒ>): (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
26
|
-
|
|
27
|
-
export { RealtimeContext, RealtimeProvider, usePull, usePullFamilyMember, usePullMutable, usePullMutableFamilyMember, usePush, useServerAction };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Transceiver, Store } from 'atom.io/internal';
|
|
2
|
-
import * as SocketIO from 'socket.io';
|
|
3
|
-
import * as AtomIO from 'atom.io';
|
|
4
|
-
import { StateToken } from 'atom.io';
|
|
5
|
-
import { Json } from 'atom.io/json';
|
|
6
|
-
|
|
7
|
-
declare const useExposeSingle: ({ socket, store, }: ServerConfig) => <J extends Json.Serializable>(token: AtomIO.StateToken<J>) => () => void;
|
|
8
|
-
|
|
9
|
-
declare const useExposeFamily: ({ socket, store, }: ServerConfig) => <J extends Json.Serializable>(family: AtomIO.AtomFamily<J, Json.Serializable> | AtomIO.SelectorFamily<J, Json.Serializable>, index: AtomIO.StateToken<Set<string>>) => () => void;
|
|
10
|
-
|
|
11
|
-
declare const useExposeMutable: ({ socket, store, }: ServerConfig) => <Core extends Transceiver<Json.Serializable>, SerializableCore extends Json.Serializable>(token: AtomIO.MutableAtomToken<Core, SerializableCore>) => () => void;
|
|
12
|
-
|
|
13
|
-
declare const useExposeMutableFamily: ({ socket, store, }: ServerConfig) => <Family extends AtomIO.MutableAtomFamily<Transceiver<Json.Serializable>, Json.Serializable, Json.Serializable>>(family: Family, index: AtomIO.StateToken<Set<string>>) => () => void;
|
|
14
|
-
|
|
15
|
-
declare const useReceiveTransaction: ({ socket, store }: ServerConfig) => <ƒ extends AtomIO.ƒn>(tx: AtomIO.TransactionToken<ƒ>) => () => void;
|
|
16
|
-
declare function useSyncTransaction({ socket, store, }: ServerConfig): <ƒ extends AtomIO.ƒn>(tx: AtomIO.TransactionToken<ƒ>) => () => void;
|
|
17
|
-
|
|
18
|
-
declare const useReceiveState: ({ socket, store }: ServerConfig) => <J extends Json.Serializable>(token: StateToken<J>) => () => void;
|
|
19
|
-
|
|
20
|
-
type ServerConfig = {
|
|
21
|
-
socket: SocketIO.Socket;
|
|
22
|
-
store?: Store;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { type ServerConfig, useExposeFamily, useExposeMutable, useExposeMutableFamily, useExposeSingle, useReceiveState, useReceiveTransaction, useSyncTransaction };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { RenderResult } from '@testing-library/react';
|
|
2
|
-
import * as AtomIO from 'atom.io';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as SocketIO from 'socket.io';
|
|
5
|
-
|
|
6
|
-
type TestSetupOptions = {
|
|
7
|
-
server: (tools: {
|
|
8
|
-
socket: SocketIO.Socket;
|
|
9
|
-
silo: AtomIO.Silo;
|
|
10
|
-
}) => void;
|
|
11
|
-
};
|
|
12
|
-
type TestSetupOptions__SingleClient = TestSetupOptions & {
|
|
13
|
-
client: React.FC;
|
|
14
|
-
};
|
|
15
|
-
type TestSetupOptions__MultiClient<ClientNames extends string> = TestSetupOptions & {
|
|
16
|
-
clients: {
|
|
17
|
-
[K in ClientNames]: React.FC;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
type RealtimeTestTools = {
|
|
21
|
-
name: string;
|
|
22
|
-
silo: AtomIO.Silo;
|
|
23
|
-
dispose: () => void;
|
|
24
|
-
};
|
|
25
|
-
type RealtimeTestClient = RealtimeTestTools & {
|
|
26
|
-
renderResult: RenderResult;
|
|
27
|
-
prettyPrint: () => void;
|
|
28
|
-
reconnect: () => void;
|
|
29
|
-
disconnect: () => void;
|
|
30
|
-
};
|
|
31
|
-
type RealtimeTestServer = RealtimeTestTools & {
|
|
32
|
-
port: number;
|
|
33
|
-
};
|
|
34
|
-
type RealtimeTestAPI = {
|
|
35
|
-
server: RealtimeTestServer;
|
|
36
|
-
teardown: () => void;
|
|
37
|
-
};
|
|
38
|
-
type RealtimeTestAPI__SingleClient = RealtimeTestAPI & {
|
|
39
|
-
client: RealtimeTestClient;
|
|
40
|
-
};
|
|
41
|
-
type RealtimeTestAPI__MultiClient<ClientNames extends string> = RealtimeTestAPI & {
|
|
42
|
-
clients: Record<ClientNames, RealtimeTestClient>;
|
|
43
|
-
};
|
|
44
|
-
declare const setupRealtimeTestServer: (options: TestSetupOptions) => RealtimeTestServer;
|
|
45
|
-
declare const setupRealtimeTestClient: (options: TestSetupOptions__SingleClient, name: string, port: number) => RealtimeTestClient;
|
|
46
|
-
declare const singleClient: (options: TestSetupOptions__SingleClient) => RealtimeTestAPI__SingleClient;
|
|
47
|
-
declare const multiClient: <ClientNames extends string>(options: TestSetupOptions__MultiClient<ClientNames>) => RealtimeTestAPI__MultiClient<ClientNames>;
|
|
48
|
-
|
|
49
|
-
export { type RealtimeTestAPI, type RealtimeTestAPI__MultiClient, type RealtimeTestAPI__SingleClient, type RealtimeTestClient, type RealtimeTestServer, type RealtimeTestTools, type TestSetupOptions, type TestSetupOptions__MultiClient, type TestSetupOptions__SingleClient, multiClient, setupRealtimeTestClient, setupRealtimeTestServer, singleClient };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Transceiver, Lineage, TransceiverMode, Subject } from 'atom.io/internal';
|
|
2
|
-
import { primitive, Json } from 'atom.io/json';
|
|
3
|
-
|
|
4
|
-
type SetUpdate = `add:${string}` | `clear:${string}` | `del:${string}` | `tx:${string}`;
|
|
5
|
-
type NumberedSetUpdate = `${number}=${SetUpdate}`;
|
|
6
|
-
interface SetRTXJson<P extends primitive> extends Json.Object {
|
|
7
|
-
members: P[];
|
|
8
|
-
cache: (NumberedSetUpdate | null)[];
|
|
9
|
-
cacheLimit: number;
|
|
10
|
-
cacheIdx: number;
|
|
11
|
-
cacheUpdateNumber: number;
|
|
12
|
-
}
|
|
13
|
-
declare class SetRTX<P extends primitive> extends Set<P> implements Transceiver<NumberedSetUpdate>, Lineage {
|
|
14
|
-
mode: TransceiverMode;
|
|
15
|
-
readonly subject: Subject<SetUpdate>;
|
|
16
|
-
cacheLimit: number;
|
|
17
|
-
cache: (NumberedSetUpdate | null)[];
|
|
18
|
-
cacheIdx: number;
|
|
19
|
-
cacheUpdateNumber: number;
|
|
20
|
-
constructor(values?: Iterable<P>, cacheLimit?: number);
|
|
21
|
-
toJSON(): SetRTXJson<P>;
|
|
22
|
-
static fromJSON<P extends primitive>(json: SetRTXJson<P>): SetRTX<P>;
|
|
23
|
-
add(value: P): this;
|
|
24
|
-
clear(): void;
|
|
25
|
-
delete(value: P): boolean;
|
|
26
|
-
readonly parent: SetRTX<P> | null;
|
|
27
|
-
child: SetRTX<P> | null;
|
|
28
|
-
transactionUpdates: SetUpdate[] | null;
|
|
29
|
-
transaction(run: (child: SetRTX<P>) => boolean): void;
|
|
30
|
-
protected _subscribe(key: string, fn: (update: SetUpdate) => void): () => void;
|
|
31
|
-
subscribe(key: string, fn: (update: NumberedSetUpdate) => void): () => void;
|
|
32
|
-
emit(update: SetUpdate): void;
|
|
33
|
-
private doStep;
|
|
34
|
-
getUpdateNumber(update: NumberedSetUpdate): number;
|
|
35
|
-
do(update: NumberedSetUpdate): number | `OUT_OF_RANGE` | null;
|
|
36
|
-
undoStep(update: SetUpdate): void;
|
|
37
|
-
undo(update: NumberedSetUpdate): number | null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { type NumberedSetUpdate, SetRTX, type SetRTXJson, type SetUpdate };
|