atom.io 0.32.0 → 0.32.2

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 (57) hide show
  1. package/data/dist/index.d.ts +8 -925
  2. package/data/dist/index.js +2 -2
  3. package/dist/{chunk-5F2V7S3B.js → chunk-HEEVASKG.js} +1 -1
  4. package/dist/{chunk-ECOMOMUN.js → chunk-KMBRCA5Q.js} +20 -19
  5. package/dist/{chunk-R3ZUK5EH.js → chunk-NDTM5IY3.js} +22 -11
  6. package/dist/{chunk-354XQWHH.js → chunk-QRPY4LSO.js} +5 -5
  7. package/dist/{chunk-GY2XQYZY.js → chunk-RXQWAO26.js} +50 -41
  8. package/dist/{chunk-Z2UJW4NQ.js → chunk-XN3EO2UT.js} +3 -3
  9. package/dist/{chunk-NF7FJKJD.js → chunk-YPME5OLO.js} +6 -4
  10. package/dist/index.d.ts +45 -516
  11. package/dist/index.js +1 -1
  12. package/eslint-plugin/dist/index.js +3 -3
  13. package/eslint-plugin/src/rules/explicit-state-types.ts +1 -0
  14. package/eslint-plugin/src/rules/synchronous-selector-dependencies.ts +1 -0
  15. package/eslint-plugin/src/walk.ts +1 -0
  16. package/internal/dist/index.d.ts +9 -657
  17. package/internal/dist/index.js +1 -1
  18. package/internal/src/join/join-internal.ts +1 -1
  19. package/internal/src/junction.ts +7 -4
  20. package/internal/src/lazy-map.ts +3 -1
  21. package/internal/src/set-state/emit-update.ts +3 -1
  22. package/internal/src/timeline/create-timeline.ts +2 -1
  23. package/internal/src/timeline/time-travel.ts +2 -1
  24. package/introspection/dist/index.d.ts +6 -922
  25. package/introspection/dist/index.js +2 -2
  26. package/introspection/src/auditor.ts +3 -3
  27. package/json/dist/index.d.ts +5 -899
  28. package/json/dist/index.js +1 -1
  29. package/package.json +10 -10
  30. package/react/dist/index.d.ts +3 -921
  31. package/react/dist/index.js +2 -2
  32. package/react-devtools/dist/index.d.ts +1 -26
  33. package/react-devtools/dist/index.js +28 -15
  34. package/react-devtools/src/Updates.tsx +12 -0
  35. package/react-devtools/src/json-editor/editors-by-type/utilities/cast-to-json.ts +2 -1
  36. package/realtime/dist/index.d.ts +8 -203
  37. package/realtime/dist/index.js +2 -2
  38. package/realtime/src/realtime-continuity.ts +5 -1
  39. package/realtime-client/dist/index.d.ts +21 -959
  40. package/realtime-client/dist/index.js +2 -2
  41. package/realtime-react/dist/index.d.ts +12 -166
  42. package/realtime-react/dist/index.js +4 -4
  43. package/realtime-server/dist/index.d.ts +27 -972
  44. package/realtime-server/dist/index.js +3 -3
  45. package/realtime-server/src/ipc-sockets/child-socket.ts +2 -0
  46. package/realtime-server/src/ipc-sockets/custom-socket.ts +6 -1
  47. package/realtime-server/src/realtime-server-stores/server-sync-store.ts +10 -2
  48. package/realtime-testing/dist/index.d.ts +3 -1091
  49. package/realtime-testing/dist/index.js +7 -7
  50. package/src/logger.ts +12 -4
  51. package/transceivers/set-rtx/dist/index.d.ts +6 -40
  52. package/transceivers/set-rtx/dist/index.js +1 -1
  53. package/transceivers/set-rtx/src/set-rtx.ts +4 -7
  54. package/web/dist/index.d.ts +1 -30
  55. package/react-devtools/src/json-editor/assets/Untitled-1.ai +2 -1436
  56. package/react-devtools/src/json-editor/assets/data-vis.ai +1 -1548
  57. package/react-devtools/src/json-editor/comp/json-editor-sketches.ai +5 -1449
@@ -1,655 +1,7 @@
1
- type primitive = boolean | number | string | null;
2
- declare namespace Json {
3
- namespace Tree {
4
- type Array<Element = unknown> = ReadonlyArray<Element>;
5
- type Object<K extends string = string, V = unknown> = Record<K, V>;
6
- type Fork = Array | Object;
7
- type Leaf = primitive;
8
- type Node = Fork | Leaf;
9
- }
10
- type Serializable = primitive | Readonly<{
11
- [key: string]: Serializable;
12
- }> | ReadonlyArray<Serializable>;
13
- type Object<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
14
- type Array<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
15
- }
16
- type stringified<J extends Json.Serializable> = J extends string ? `"${J}"` : J extends number ? `${J}` : J extends true ? `true` : J extends false ? `false` : J extends boolean ? `false` | `true` : J extends null ? `null` : string & {
17
- __json?: J;
18
- };
19
- type Canonical = primitive | ReadonlyArray<Canonical>;
20
- type JsonInterface<T, J extends Json.Serializable = Json.Serializable> = {
21
- toJson: (t: T) => J;
22
- fromJson: (json: J) => T;
23
- };
24
-
25
- /** @public */
26
- type Effectors<T> = {
27
- /**
28
- * Set the value of the atom
29
- * @param next - The new value of the atom, or a setter function
30
- */
31
- setSelf: <New extends T>(next: New | Setter<T, New>) => void;
32
- /** Subscribe to changes to the atom */
33
- onSet: (callback: (options: {
34
- newValue: T;
35
- oldValue: T;
36
- }) => void) => void;
37
- };
38
- /**
39
- * @public
40
- * A function that runs side effects when the atom is set
41
- * @param tools - {@link Effectors} that can be used to run side effects
42
- * @returns
43
- * Optionally, a cleanup function that will be called when the atom is disposed
44
- */
45
- type AtomEffect<T> = (tools: Effectors<T>) => (() => void) | void;
46
- /** @public */
47
- type RegularAtomOptions<T> = {
48
- /** The unique identifier of the atom */
49
- key: string;
50
- /** The starting value of the atom */
51
- default: T | (() => T);
52
- /** Hooks used to run side effects when the atom is set */
53
- effects?: AtomEffect<T>[];
54
- };
55
- type MutableAtomOptions<T extends Transceiver<any>, J extends Json.Serializable> = JsonInterface<T, J> & Omit<RegularAtomOptions<T>, `default`> & {
56
- default: () => T;
57
- mutable: true;
58
- };
59
- /** @public */
60
- type RegularAtomFamilyOptions<T, K extends Canonical> = {
61
- /** The unique identifier of the atom family */
62
- key: string;
63
- /** The starting value of the atom family */
64
- default: T | ((key: K) => T);
65
- /** Hooks used to run side effects when an atom in the family is set */
66
- effects?: (key: K) => AtomEffect<T>[];
67
- };
68
- type RegularAtomFamilyToken<T, K extends Canonical> = {
69
- key: string;
70
- type: `atom_family`;
71
- __T?: T;
72
- __K?: K;
73
- };
74
- type MutableAtomFamilyOptions<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = JsonInterface<T, J> & {
75
- key: string;
76
- default: (key: K) => T;
77
- effects?: (key: K) => AtomEffect<T>[];
78
- mutable: true;
79
- };
80
- type MutableAtomFamilyToken<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = {
81
- key: string;
82
- type: `mutable_atom_family`;
83
- __T?: T;
84
- __J?: J;
85
- __K?: K;
86
- };
87
- type AtomFamilyToken<T, K extends Canonical = Canonical> = MutableAtomFamilyToken<T extends Transceiver<any> ? T : never, any, K> | RegularAtomFamilyToken<T, K>;
88
-
89
- type TransactionToken<F extends Func> = {
90
- key: string;
91
- type: `transaction`;
92
- __F?: F;
93
- };
94
- type StateCreation<Token extends ReadableToken<any>> = {
95
- type: `state_creation`;
96
- token: Token;
97
- };
98
- type AtomDisposal<Token extends ReadableToken<any>> = {
99
- type: `state_disposal`;
100
- subType: `atom`;
101
- token: Token;
102
- value: TokenType<Token>;
103
- };
104
- type SelectorDisposal<Token extends ReadableToken<any>> = {
105
- type: `state_disposal`;
106
- subType: `selector`;
107
- token: Token;
108
- };
109
- type StateDisposal<Token extends ReadableToken<any>> = AtomDisposal<Token> | SelectorDisposal<Token>;
110
- type MoleculeCreation = {
111
- type: `molecule_creation`;
112
- key: Canonical;
113
- provenance: Canonical;
114
- };
115
- type MoleculeDisposal = {
116
- type: `molecule_disposal`;
117
- key: Canonical;
118
- provenance: stringified<Canonical>[];
119
- values: [key: string, value: any][];
120
- };
121
- type MoleculeTransfer = {
122
- type: `molecule_transfer`;
123
- key: Canonical;
124
- from: Canonical[];
125
- to: Canonical[];
126
- };
127
- type TransactionUpdateContent = KeyedStateUpdate<unknown> | MoleculeCreation | MoleculeDisposal | MoleculeTransfer | StateCreation<ReadableToken<unknown>> | StateDisposal<ReadableToken<unknown>> | TransactionUpdate<Func>;
128
- type TransactionUpdate<F extends Func> = {
129
- type: `transaction_update`;
130
- key: string;
131
- id: string;
132
- epoch: number;
133
- updates: TransactionUpdateContent[];
134
- params: Parameters<F>;
135
- output: ReturnType<F>;
136
- };
137
- type GetterToolkit = Pick<SetterToolkit, `find` | `get` | `json`>;
138
- type SetterToolkit = Readonly<{
139
- get: typeof getState;
140
- set: typeof setState;
141
- find: typeof findState;
142
- json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
143
- }>;
144
- type ActorToolkit = Readonly<{
145
- get: typeof getState;
146
- set: typeof setState;
147
- find: typeof findState;
148
- json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
149
- dispose: typeof disposeState;
150
- run: typeof runTransaction;
151
- env: () => EnvironmentData;
152
- }>;
153
- type Read<F extends Func> = (toolkit: GetterToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
154
- type Write<F extends Func> = (toolkit: SetterToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
155
- type Transact<F extends Func> = (toolkit: ActorToolkit, ...parameters: Parameters<F>) => ReturnType<F>;
156
- type TransactionOptions<F extends Func> = {
157
- key: string;
158
- do: Transact<F>;
159
- };
160
- declare function runTransaction<F extends Func>(token: TransactionToken<F>, id?: string): (...parameters: Parameters<F>) => ReturnType<F>;
161
-
162
- type WritableSelectorOptions<T> = {
163
- key: string;
164
- get: Read<() => T>;
165
- set: Write<(newValue: T) => void>;
166
- };
167
- type ReadonlySelectorOptions<T> = {
168
- key: string;
169
- get: Read<() => T>;
170
- };
171
- type WritableSelectorFamilyOptions<T, K extends Canonical> = {
172
- key: string;
173
- get: (key: K) => Read<() => T>;
174
- set: (key: K) => Write<(newValue: T) => void>;
175
- };
176
- type ReadonlySelectorFamilyOptions<T, K extends Canonical> = {
177
- key: string;
178
- get: (key: K) => Read<() => T>;
179
- };
180
- type WritableSelectorFamilyToken<T, K extends Canonical> = {
181
- key: string;
182
- type: `selector_family`;
183
- __T?: T;
184
- __K?: K;
185
- };
186
- type ReadonlySelectorFamilyToken<T, K extends Canonical> = {
187
- key: string;
188
- type: `readonly_selector_family`;
189
- __T?: T;
190
- __K?: K;
191
- };
192
- type SelectorFamilyToken<T, K extends Canonical> = ReadonlySelectorFamilyToken<T, K> | WritableSelectorFamilyToken<T, K>;
193
-
194
- type TimelineManageable = AtomFamilyToken<any, any> | AtomToken<any>;
195
- type AtomOnly<M extends TimelineManageable> = M extends AtomFamilyToken<any, any> ? AtomToken<any> : M extends AtomToken<any> ? M : never;
196
- type TimelineToken<M> = {
197
- key: string;
198
- type: `timeline`;
199
- __M?: M;
200
- };
201
- type TimelineOptions<ManagedAtom extends TimelineManageable> = {
202
- key: string;
203
- scope: ManagedAtom[];
204
- shouldCapture?: (update: TimelineUpdate<ManagedAtom>, timeline: Timeline<TimelineManageable>) => boolean;
205
- };
206
- type TimelineUpdate<ManagedAtom extends TimelineManageable> = TimelineAtomUpdate<ManagedAtom> | TimelineMoleculeCreation | TimelineMoleculeDisposal | TimelineSelectorUpdate<ManagedAtom> | TimelineStateCreation<AtomOnly<ManagedAtom>> | TimelineStateDisposal<AtomOnly<ManagedAtom>> | TimelineTransactionUpdate;
207
-
208
- /**
209
- * @public
210
- * Disposes of a state in the implicit store
211
- * @param token - The token of the state to dispose
212
- * @overload Default
213
- */
214
- declare function disposeState(token: ReadableToken<any>): void;
215
- /**
216
- * @public
217
- * Disposes of a state family in the implicit store
218
- * @param token - The token of the state family to dispose
219
- * @param key - The unique key of the state to dispose
220
- */
221
- declare function disposeState<K extends Canonical>(token: ReadableFamilyToken<any, K>, key: K): void;
222
-
223
- /**
224
- * @public
225
- * Finds a {@link MutableAtomToken} in the store
226
- * @param token - A {@link MutableAtomFamilyToken}
227
- * @param key - The key of the state
228
- * @returns
229
- * The current value of the state
230
- * @overload Mutable Atom
231
- */
232
- declare function findState<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical, Key extends K>(token: MutableAtomFamilyToken<T, J, K>, key: Key): MutableAtomToken<T, J, K>;
233
- /**
234
- * @public
235
- * Finds a state in the store
236
- * @param token - The token of the state family
237
- * @param key - The key of the state
238
- * @returns
239
- * The current value of the state
240
- * @overload Regular Atom
241
- */
242
- declare function findState<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K>;
243
- /**
244
- * @public
245
- * Finds a state in the store
246
- * @param token - The token of the state family
247
- * @param key - The key of the state
248
- * @returns
249
- * The current value of the state
250
- * @overload Writable Selector
251
- */
252
- declare function findState<T, K extends Canonical, Key extends K>(token: WritableSelectorFamilyToken<T, K>, key: Key): WritableSelectorToken<T, K>;
253
- /**
254
- * @public
255
- * Finds a state in the store
256
- * @param token - The token of the state family
257
- * @param key - The key of the state
258
- * @returns
259
- * The current value of the state
260
- * @overload Readonly Selector
261
- */
262
- declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlySelectorFamilyToken<T, K>, key: Key): ReadonlySelectorToken<T, K>;
263
- /**
264
- * @public
265
- * Finds a state in the store
266
- * @param token - The token of the state family
267
- * @param key - The key of the state
268
- * @returns
269
- * The current value of the state
270
- * @overload Writable State
271
- */
272
- declare function findState<T, K extends Canonical, Key extends K>(token: WritableFamilyToken<T, K>, key: Key): WritableToken<T, K>;
273
- /**
274
- * @public
275
- * Finds a {@link ReadableToken} in the store
276
- * @param token - A {@link ReadableFamilyToken}
277
- * @param key - The key of the state
278
- * @returns
279
- * The current value of the state
280
- * @overload Unknown
281
- * @default
282
- */
283
- declare function findState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): ReadableToken<T, K>;
284
-
285
- /**
286
- * @public
287
- * Get the current value of a state
288
- * @param token - The token of the state to get
289
- * @return The current value of the state
290
- * @overload Default
291
- * @default
292
- */
293
- declare function getState<T>(token: ReadableToken<T>): T;
294
- /**
295
- * @public
296
- * Get the current value of a state family
297
- * @param token - The token of a state family
298
- * @param key - The unique key of the state to get
299
- * @return The current value of the state
300
- * @overload Streamlined
301
- */
302
- declare function getState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): T;
303
-
304
- type SetUpdate = `add:${string}` | `clear:${string}` | `del:${string}` | `tx:${string}`;
305
- type NumberedSetUpdate = `${number}=${SetUpdate}`;
306
- interface SetRTXJson<P extends primitive> extends Json.Object {
307
- members: P[];
308
- cache: (NumberedSetUpdate | null)[];
309
- cacheLimit: number;
310
- cacheIdx: number;
311
- cacheUpdateNumber: number;
312
- }
313
- declare class SetRTX<P extends primitive> extends Set<P> implements Transceiver<NumberedSetUpdate>, Lineage {
314
- mode: TransceiverMode;
315
- readonly subject: Subject<SetUpdate>;
316
- cacheLimit: number;
317
- cache: (NumberedSetUpdate | null)[];
318
- cacheIdx: number;
319
- cacheUpdateNumber: number;
320
- constructor(values?: Iterable<P>, cacheLimit?: number);
321
- toJSON(): SetRTXJson<P>;
322
- static fromJSON<P extends primitive>(json: SetRTXJson<P>): SetRTX<P>;
323
- add(value: P): this;
324
- clear(): void;
325
- delete(value: P): boolean;
326
- readonly parent: SetRTX<P> | null;
327
- child: SetRTX<P> | null;
328
- transactionUpdates: SetUpdate[] | null;
329
- transaction(run: (child: SetRTX<P>) => boolean): void;
330
- protected _subscribe(key: string, fn: (update: SetUpdate) => void): () => void;
331
- subscribe(key: string, fn: (update: NumberedSetUpdate) => void): () => void;
332
- emit(update: SetUpdate): void;
333
- private doStep;
334
- getUpdateNumber(update: NumberedSetUpdate): number;
335
- do(update: NumberedSetUpdate): number | `OUT_OF_RANGE` | null;
336
- undoStep(update: SetUpdate): void;
337
- undo(update: NumberedSetUpdate): number | null;
338
- }
339
-
340
- interface JoinOptions<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> extends JunctionSchemaBase<ASide, BSide>, Partial<JunctionEntriesBase<AType, BType, Content>> {
341
- readonly key: string;
342
- readonly cardinality: Cardinality;
343
- readonly isAType: Refinement<string, AType>;
344
- readonly isBType: Refinement<string, BType>;
345
- }
346
- type JoinToken<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null = null> = {
347
- key: string;
348
- type: `join`;
349
- cardinality: Cardinality;
350
- a: ASide;
351
- b: BSide;
352
- __aType?: AType;
353
- __bType?: BType;
354
- __content?: Content;
355
- };
356
- type JoinStates<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
357
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
358
- AType,
359
- Content
360
- ] | null, BType>;
361
- } & {
362
- readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
363
- BType,
364
- Content
365
- ] | null, AType>;
366
- } : {}) & {
367
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
368
- } & {
369
- readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType | null, AType>;
370
- } : Cardinality extends `1:n` ? (Content extends Json.Object ? {
371
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
372
- AType,
373
- Content
374
- ] | null, BType>;
375
- } & {
376
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
377
- BType,
378
- Content
379
- ][], AType>;
380
- } : {}) & {
381
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
382
- } & {
383
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
384
- } : Cardinality extends `n:n` ? (Content extends Json.Object ? {
385
- readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
386
- AType,
387
- Content
388
- ][], BType>;
389
- } & {
390
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
391
- BType,
392
- Content
393
- ][], AType>;
394
- } : {}) & {
395
- readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType[], BType>;
396
- } & {
397
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
398
- } : never;
399
-
400
- declare const LoggerIconDictionary: {
401
- readonly "\u231B": "Timeline event fully captured";
402
- readonly "\u23E9": "Timeline redo";
403
- readonly "\u23EA": "Timeline undo";
404
- readonly "\u23ED\uFE0F": "Transaction redo";
405
- readonly "\u23EE\uFE0F": "Transaction undo";
406
- readonly "\u23F3": "Timeline event partially captured";
407
- readonly "\u23F9\uFE0F": "Time-travel complete";
408
- readonly "\u2705": "Realtime transaction success";
409
- readonly "\u2728": "Computation complete";
410
- readonly "\u274C": "Conflict prevents attempted action";
411
- readonly "\u2B55": "Operation start";
412
- readonly "\uD83D\uDD34": "Operation complete";
413
- readonly "\u2757": "Operation blocked";
414
- readonly "\uD83D\uDFE2": "Operation unblocked";
415
- readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
416
- readonly "\uD83D\uDC40": "Subscription added";
417
- readonly "\uD83D\uDC4B": "Greeting";
418
- readonly "\uD83D\uDC4D": "Realtime acknowledgment";
419
- readonly "\uD83D\uDC6A": "Family member added";
420
- readonly "\uD83D\uDC81": "Notice";
421
- readonly "\uD83D\uDCA5": "Caught";
422
- readonly "\uD83D\uDCC1": "Stow update";
423
- readonly "\uD83D\uDCC3": "Copy mutable";
424
- readonly "\uD83D\uDCD6": "Read state";
425
- readonly "\uD83D\uDCDD": "Write state";
426
- readonly "\uD83D\uDCE2": "Notify subscribers";
427
- readonly "\uD83D\uDD04": "Realtime transaction synchronized";
428
- readonly "\uD83D\uDD0C": "Register dependency";
429
- readonly "\uD83D\uDD0D": "Discover root";
430
- readonly "\uD83D\uDD25": "Delete state";
431
- readonly "\uD83D\uDD27": "Create mutable atom";
432
- readonly "\uD83D\uDD28": "Create immutable atom";
433
- readonly "\uD83D\uDDD1": "Evict cached value";
434
- readonly "\uD83D\uDE48": "Subscription canceled";
435
- readonly "\uD83D\uDE80": "Performance measure";
436
- readonly "\uD83D\uDEC4": "Apply transaction";
437
- readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
438
- readonly "\uD83D\uDEEB": "Begin transaction";
439
- readonly "\uD83D\uDEEC": "Complete transaction";
440
- readonly "\uD83E\uDDEE": "Computing selector";
441
- readonly "\uD83E\uDDF9": "Prepare to evict";
442
- readonly "\uD83E\uDE82": "Abort transaction";
443
- readonly "\uD83E\uDD1E": "Realtime optimistic update enqueued";
444
- readonly "\uD83D\uDC48": "Realtime confirmed update enqueued";
445
- readonly "\uD83E\uDDD1\u200D\u2696\uFE0F": "Realtime update beginning reconciliation";
446
- readonly "\uD83D\uDECE\uFE0F": "Realtime transaction received";
447
- readonly "\uD83D\uDD2D": "Determining realtime perspective";
448
- readonly "\uD83D\uDD8C": "Redacting realtime update";
449
- readonly "\uD83D\uDC41": "Determining perspective";
450
- };
451
- type LoggerIcon = keyof typeof LoggerIconDictionary;
452
- type TokenDenomination = `atom_family` | `atom` | `continuity` | `molecule_family` | `molecule` | `mutable_atom_family` | `mutable_atom` | `readonly_selector_family` | `readonly_selector` | `selector_family` | `selector` | `state` | `timeline` | `transaction` | `unknown`;
453
- declare const LOG_LEVELS: readonly ["info", "warn", "error"];
454
- type LogLevel = (typeof LOG_LEVELS)[number];
455
- type LogFn = (icon: LoggerIcon, denomination: TokenDenomination, tokenKey: string, message: string, ...rest: unknown[]) => void;
456
- type LogFilter = (...params: Parameters<LogFn>) => boolean;
457
- type Logger = Record<LogLevel, LogFn>;
458
- declare class AtomIOLogger implements Logger {
459
- logLevel: `error` | `info` | `warn` | null;
460
- private readonly filter?;
461
- private readonly logger;
462
- constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
463
- error: LogFn;
464
- info: LogFn;
465
- warn: LogFn;
466
- }
467
-
468
- declare const $claim: unique symbol;
469
- type Claim<K extends Canonical> = K & {
470
- [$claim]?: true;
471
- };
472
- declare class Realm<H extends Hierarchy> {
473
- store: Store;
474
- constructor(store?: Store);
475
- allocate<V extends Vassal<H>, A extends Above<V, H>>(provenance: A, key: V, attachmentStyle?: `all` | `any`): Claim<V>;
476
- fuse<C extends CompoundFrom<H>, T extends C extends CompoundTypedKey<infer t, any, any> ? t : never, A extends C extends CompoundTypedKey<any, infer v, any> ? v : never, B extends C extends CompoundTypedKey<any, any, infer m> ? m : never>(type: T, reagentA: SingularTypedKey<A>, reagentB: SingularTypedKey<B>): Claim<CompoundTypedKey<T, A, B>>;
477
- deallocate<V extends Vassal<H>>(claim: Claim<V>): void;
478
- claim<V extends Exclude<Vassal<H>, CompoundTypedKey>, A extends Above<V, H>>(newProvenance: A, claim: Claim<V>, exclusive?: `exclusive`): Claim<V>;
479
- }
480
- declare class Anarchy {
481
- store: Store;
482
- realm: Realm<any>;
483
- constructor(store?: Store);
484
- allocate(provenance: Canonical, key: Canonical, attachmentStyle?: `all` | `any`): void;
485
- deallocate(key: Canonical): void;
486
- claim(newProvenance: Canonical, key: Canonical, exclusive?: `exclusive`): void;
487
- }
488
- declare const T$ = "T$";
489
- type T$ = typeof T$;
490
- type TypeTag<T extends string> = `${T$}--${T}`;
491
- type SingularTypedKey<T extends string = string> = `${T}::${string}`;
492
- type CompoundTypedKey<A extends string = string, B extends string = string, C extends string = string> = `${TypeTag<A>}==${SingularTypedKey<B>}++${SingularTypedKey<C>}`;
493
- type TypedKey<A extends string = string, B extends string = string, C extends string = string> = CompoundTypedKey<A, B, C> | SingularTypedKey<A>;
494
- type Scope = SingularTypedKey[];
495
- type MutualFealty = {
496
- above: Scope;
497
- below: CompoundTypedKey;
498
- };
499
- type ExclusiveFealty = {
500
- above: TypedKey | `root`;
501
- below: Scope;
502
- };
503
- type Fealty = ExclusiveFealty | MutualFealty;
504
- type Hierarchy<F extends Fealty[] = Fealty[]> = Each<F>;
505
- type Vassal<H extends Hierarchy> = {
506
- [K in keyof H]: H[K] extends MutualFealty ? H[K][`below`] : H[K] extends {
507
- below: Array<infer V>;
508
- } ? V extends TypedKey ? V : never : never;
509
- }[keyof H];
510
- type Above<TK extends TypedKey, H extends Hierarchy> = {
511
- [K in keyof H]: H[K] extends MutualFealty ? TK extends H[K][`below`] ? H[K][`above`] : never : H[K] extends {
512
- below: Array<infer V>;
513
- } ? TK extends V ? H[K] extends ExclusiveFealty ? H[K][`above`] : never : never : never;
514
- }[keyof H];
515
- type CompoundFrom<H extends Hierarchy> = {
516
- [K in keyof H]: H[K] extends MutualFealty ? H[K][`below`] : never;
517
- }[keyof H];
518
-
519
- /**
520
- * @public
521
- * A function that sets the value of a state.
522
- * @param oldValue - The current value of the state.
523
- * @returns
524
- * The new value of the state.
525
- */
526
- type Setter<T, New extends T> = (oldValue: T) => New;
527
- /**
528
- * @public
529
- * Set the value of a state into the implicit store.
530
- * @param token - An atom or writable selector token.
531
- * @param value - The new value of the state.
532
- * @overload Default
533
- * @default
534
- */
535
- declare function setState<T, New extends T>(token: WritableToken<T>, value: New | Setter<T, New>): void;
536
- /**
537
- * @public
538
- * Set the value of a state into the implicit store.
539
- * @param token - An atom family or writable selector family token.
540
- * @param key - The unique key of the state to set.
541
- * @param value - The new value of the state.
542
- * @overload Streamlined
543
- */
544
- declare function setState<T, K extends Canonical, New extends T, Key extends K>(token: WritableFamilyToken<T, K>, key: Key, value: New | Setter<T, New>): void;
545
-
546
- type StateUpdate<T> = {
547
- newValue: T;
548
- oldValue: T;
549
- };
550
- type KeyedStateUpdate<T> = Flat<StateUpdate<T> & {
551
- key: string;
552
- type: `atom_update` | `selector_update`;
553
- family?: FamilyMetadata;
554
- }>;
555
- type UpdateHandler<T> = (update: StateUpdate<T>) => void;
556
- type TransactionUpdateHandler<F extends Func> = (data: TransactionUpdate<F>) => void;
557
-
558
- type TokenType<Comparison extends ReadableFamilyToken<any, any> | ReadableToken<any>> = Comparison extends ReadableToken<infer RepresentedValue> ? RepresentedValue : Comparison extends ReadableFamilyToken<infer RepresentedValue, any> ? RepresentedValue : never;
559
-
560
- /**
561
- * @public
562
- * A token is an object that uniquely identifies a particular state, family, timeline, or transaction.
563
- *
564
- * While they represent one of these resources, they are not the resource itself. Think of them like paper currency representing money in the bank.
565
- *
566
- * Tokens are returned from resource creation functions, such as {@link atom} and {@link transaction}.
567
- *
568
- * Tokens can be used as parameters to functions that take a token, such as {@link getState}, {@link setState}, or {@link runTransaction}.
569
- *
570
- * Tokens are fully serializable, so they can be passed between processes.
571
- */
572
- type AtomIOToken = ReadableFamilyToken<any, any> | ReadableToken<any> | TimelineToken<any> | TransactionToken<any>;
573
- /** @public */
574
- type RegularAtomToken<T, K extends Canonical = any> = {
575
- /** The unique identifier of the atom. */
576
- key: string;
577
- /** Discriminator. */
578
- type: `atom`;
579
- /** Present if the atom belongs to a family. */
580
- family?: FamilyMetadata<K>;
581
- /** Never present. This is a marker that preserves the type of the atom's value. */
582
- __T?: T;
583
- };
584
- /** @public */
585
- type MutableAtomToken<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical = any> = {
586
- /** The unique identifier of the atom. */
587
- key: string;
588
- /** Discriminator. */
589
- type: `mutable_atom`;
590
- /** Present if the atom belongs to a family. */
591
- family?: FamilyMetadata<K>;
592
- /** Never present. This is a marker that preserves the JSON form of the atom's transceiver value. */
593
- __J?: J;
594
- /** Never present. This is a marker that preserves the type of the atom's transceiver value. */
595
- __U?: T extends Transceiver<infer Update> ? Update : never;
596
- };
597
- /** @public */
598
- type AtomToken<T, K extends Canonical = any> = MutableAtomToken<T extends Transceiver<any> ? T : never, any, K> | RegularAtomToken<T, K>;
599
- /** @public */
600
- type WritableSelectorToken<T, K extends Canonical = any> = {
601
- /** The unique identifier of the selector. */
602
- key: string;
603
- /** Discriminator. */
604
- type: `selector`;
605
- /** Present if the selector belongs to a family. */
606
- family?: FamilyMetadata<K>;
607
- /** Never present. This is a marker that preserves the type of the selector's value. */
608
- __T?: T;
609
- };
610
- /** @public */
611
- type ReadonlySelectorToken<T, K extends Canonical = any> = {
612
- /** The unique identifier of the selector. */
613
- key: string;
614
- /** Discriminator. */
615
- type: `readonly_selector`;
616
- /** Present if the selector belongs to a family. */
617
- family?: FamilyMetadata<K>;
618
- /** Never present. This is a marker that preserves the type of the selector's value. */
619
- __T?: T;
620
- };
621
- /** @public */
622
- type SelectorToken<T, K extends Canonical = any> = ReadonlySelectorToken<T, K> | WritableSelectorToken<T, K>;
623
- /**
624
- * @public
625
- * These states can be set.
626
- */
627
- type WritableToken<T, K extends Canonical = any> = AtomToken<T, K> | WritableSelectorToken<T, K>;
628
- /**
629
- * @public
630
- * These states cannot be set.
631
- */
632
- type ReadableToken<T, K extends Canonical = any> = AtomToken<T, K> | SelectorToken<T, K>;
633
- /**
634
- * @public
635
- * States belonging to this family can be set.
636
- */
637
- type WritableFamilyToken<T, K extends Canonical> = AtomFamilyToken<T, K> | WritableSelectorFamilyToken<T, K>;
638
- /**
639
- * @public
640
- * States belonging to this family cannot be set.
641
- */
642
- type ReadableFamilyToken<T, K extends Canonical> = AtomFamilyToken<T, K> | SelectorFamilyToken<T, K>;
643
- /**
644
- * @public
645
- * Identifies a state's connection to its family.
646
- */
647
- type FamilyMetadata<K extends Canonical = any> = {
648
- /** The family's unique key. */
649
- key: string;
650
- /** The family member's unique identifier, in the form of a string. */
651
- subKey: stringified<K>;
652
- };
1
+ import { MutableAtomFamilyToken, MutableAtomToken, RegularAtomFamilyToken, RegularAtomToken, AtomFamilyToken, AtomToken, WritableSelectorFamilyToken, WritableSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, SelectorFamilyToken, SelectorToken, WritableFamilyToken, WritableToken, ReadableFamilyToken, ReadableToken, TransactionToken, TransactionUpdate, TransactionOptions, ActorToolkit, TimelineManageable, TimelineToken, AtomIOToken, JoinToken, JoinStates, Hierarchy, Vassal, Above, Claim, CompoundFrom, CompoundTypedKey, SingularTypedKey, JoinOptions, SetterToolkit, Anarchy, TimelineUpdate, StateUpdate, TokenType, FamilyMetadata, StateCreation, StateDisposal, MoleculeCreation, MoleculeDisposal, TimelineOptions, AtomIOLogger, Logger, MutableAtomOptions, MutableAtomFamilyOptions, RegularAtomOptions, RegularAtomFamilyOptions, ReadonlySelectorFamilyOptions, WritableSelectorFamilyOptions, KeyedStateUpdate, MoleculeTransfer, ReadonlySelectorOptions, WritableSelectorOptions, UpdateHandler, TransactionUpdateHandler } from 'atom.io';
2
+ import { Json, Canonical, stringified, JsonInterface } from 'atom.io/json';
3
+ import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
4
+ import { Store as Store$1, Func as Func$1 } from 'atom.io/internal';
653
5
 
654
6
  declare class CircularBuffer<T> {
655
7
  protected _buffer: T[];
@@ -1270,8 +622,8 @@ type StateKey<T> = AtomKey<T> | ReadonlySelectorKey<T> | SelectorKey<T>;
1270
622
  declare const isStateKey: (store: Store, key: string) => key is StateKey<unknown>;
1271
623
 
1272
624
  declare class LazyMap<K, V> extends Map<K, V> {
1273
- protected readonly source: Map<K, V>;
1274
625
  deleted: Set<K>;
626
+ protected readonly source: Map<K, V>;
1275
627
  constructor(source: Map<K, V>);
1276
628
  get(key: K): V | undefined;
1277
629
  set(key: K, value: V): this;
@@ -1314,10 +666,10 @@ declare function setIntoStore<T, K extends Canonical, New extends T>(store: Stor
1314
666
 
1315
667
  declare const recallState: <T>(store: Store, state: ReadableState<T>) => T;
1316
668
 
1317
- declare function subscribeInStore<T>(store: Store, token: ReadableToken<T>, handleUpdate: UpdateHandler<T>, key?: string): () => void;
1318
- declare function subscribeInStore<F extends Func>(store: Store, token: TransactionToken<F>, handleUpdate: TransactionUpdateHandler<F>, key?: string): () => void;
1319
- declare function subscribeInStore<M extends TimelineManageable>(store: Store, token: TimelineToken<M>, handleUpdate: (update: TimelineUpdate<M> | `redo` | `undo`) => void, key?: string): () => void;
1320
- declare function subscribeInStore<M extends TimelineManageable>(store: Store, token: ReadableToken<any> | TimelineToken<M> | TransactionToken<any>, handleUpdate: TransactionUpdateHandler<any> | UpdateHandler<any> | ((update: TimelineUpdate<M> | `redo` | `undo`) => void), key?: string): () => void;
669
+ declare function subscribeInStore<T>(store: Store$1, token: ReadableToken<T>, handleUpdate: UpdateHandler<T>, key?: string): () => void;
670
+ declare function subscribeInStore<F extends Func$1>(store: Store$1, token: TransactionToken<F>, handleUpdate: TransactionUpdateHandler<F>, key?: string): () => void;
671
+ declare function subscribeInStore<M extends TimelineManageable>(store: Store$1, token: TimelineToken<M>, handleUpdate: (update: TimelineUpdate<M> | `redo` | `undo`) => void, key?: string): () => void;
672
+ declare function subscribeInStore<M extends TimelineManageable>(store: Store$1, token: ReadableToken<any> | TimelineToken<M> | TransactionToken<any>, handleUpdate: TransactionUpdateHandler<any> | UpdateHandler<any> | ((update: TimelineUpdate<M> | `redo` | `undo`) => void), key?: string): () => void;
1321
673
 
1322
674
  declare const subscribeToRootAtoms: <T>(store: Store, selector: Selector<T>) => (() => void)[];
1323
675