atom.io 0.32.0 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) 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-3PQTWLQQ.js} +1 -1
  4. package/dist/{chunk-Z2UJW4NQ.js → chunk-3ZFTRSNG.js} +3 -3
  5. package/dist/{chunk-354XQWHH.js → chunk-KVI5OBF2.js} +5 -5
  6. package/dist/{chunk-GY2XQYZY.js → chunk-UQEYZ3OI.js} +45 -40
  7. package/dist/{chunk-R3ZUK5EH.js → chunk-UYYKOGZQ.js} +16 -6
  8. package/dist/{chunk-ECOMOMUN.js → chunk-VRJP2PCU.js} +10 -10
  9. package/dist/{chunk-NF7FJKJD.js → chunk-X7SD2NXU.js} +2 -1
  10. package/dist/index.d.ts +43 -514
  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 +8 -656
  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/set-state/emit-update.ts +3 -1
  21. package/internal/src/timeline/create-timeline.ts +2 -1
  22. package/internal/src/timeline/time-travel.ts +2 -1
  23. package/introspection/dist/index.d.ts +6 -922
  24. package/introspection/dist/index.js +2 -2
  25. package/json/dist/index.d.ts +5 -899
  26. package/json/dist/index.js +1 -1
  27. package/package.json +8 -8
  28. package/react/dist/index.d.ts +3 -921
  29. package/react/dist/index.js +2 -2
  30. package/react-devtools/dist/index.d.ts +1 -26
  31. package/react-devtools/dist/index.js +28 -15
  32. package/react-devtools/src/Updates.tsx +12 -0
  33. package/react-devtools/src/json-editor/editors-by-type/utilities/cast-to-json.ts +2 -1
  34. package/realtime/dist/index.d.ts +7 -202
  35. package/realtime/dist/index.js +2 -2
  36. package/realtime/src/realtime-continuity.ts +1 -0
  37. package/realtime-client/dist/index.d.ts +21 -959
  38. package/realtime-client/dist/index.js +2 -2
  39. package/realtime-react/dist/index.d.ts +12 -166
  40. package/realtime-react/dist/index.js +4 -4
  41. package/realtime-server/dist/index.d.ts +26 -971
  42. package/realtime-server/dist/index.js +3 -3
  43. package/realtime-server/src/ipc-sockets/child-socket.ts +2 -0
  44. package/realtime-server/src/realtime-server-stores/server-sync-store.ts +10 -2
  45. package/realtime-testing/dist/index.d.ts +3 -1091
  46. package/realtime-testing/dist/index.js +7 -7
  47. package/transceivers/set-rtx/dist/index.d.ts +6 -40
  48. package/transceivers/set-rtx/dist/index.js +1 -1
  49. package/transceivers/set-rtx/src/set-rtx.ts +4 -7
  50. package/web/dist/index.d.ts +1 -30
  51. package/react-devtools/src/json-editor/assets/Untitled-1.ai +2 -1436
  52. package/react-devtools/src/json-editor/assets/data-vis.ai +1 -1548
  53. package/react-devtools/src/json-editor/comp/json-editor-sketches.ai +5 -1449
package/dist/index.d.ts CHANGED
@@ -1,478 +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
- declare class CircularBuffer<T> {
26
- protected _buffer: T[];
27
- protected _index: number;
28
- constructor(array: T[]);
29
- constructor(length: number);
30
- get buffer(): ReadonlyArray<T | undefined>;
31
- get index(): number;
32
- add(item: T): void;
33
- copy(): CircularBuffer<T>;
34
- }
35
-
36
- type Func = (...parameters: any[]) => any;
37
- type Flat<R extends {
38
- [K in PropertyKey]: any;
39
- }> = {
40
- [K in keyof R]: R[K];
41
- };
42
- type Count<N extends number, A extends any[] = []> = [
43
- ...A,
44
- any
45
- ][`length`] extends N ? A[`length`] : A[`length`] | Count<N, [...A, any]>;
46
- type Each<E extends any[]> = {
47
- [P in Count<E[`length`]>]: E[P];
48
- };
49
- type Refinement<A, B extends A> = (a: A) => a is B;
50
-
51
- type JunctionEntriesBase<AType extends string, BType extends string, Content extends Json.Object | null> = {
52
- readonly relations: ([AType, BType[]] | [BType, AType[]])[];
53
- readonly contents: [string, Content][];
54
- };
55
- interface JunctionEntries<AType extends string, BType extends string, Content extends Json.Object | null> extends Json.Object, JunctionEntriesBase<AType, BType, Content> {
56
- }
57
- type JunctionSchemaBase<ASide extends string, BSide extends string> = {
58
- readonly between: [a: ASide, b: BSide];
59
- readonly cardinality: `1:1` | `1:n` | `n:n`;
60
- };
61
- interface JunctionSchema<ASide extends string, BSide extends string> extends Json.Object, JunctionSchemaBase<ASide, BSide> {
62
- }
63
- type BaseExternalStoreConfiguration = {
64
- addRelation: (a: string, b: string) => void;
65
- deleteRelation: (a: string, b: string) => void;
66
- replaceRelationsSafely: (a: string, bs: string[]) => void;
67
- replaceRelationsUnsafely: (a: string, bs: string[]) => void;
68
- getRelatedKeys(key: string): Set<string> | undefined;
69
- has: (a: string, b?: string) => boolean;
70
- };
71
- type ExternalStoreWithContentConfiguration<Content extends Json.Object> = {
72
- getContent: (contentKey: string) => Content | undefined;
73
- setContent: (contentKey: string, content: Content) => void;
74
- deleteContent: (contentKey: string) => void;
75
- };
76
- type Empty<Obj extends object> = {
77
- [Key in keyof Obj]?: undefined;
78
- };
79
- type ExternalStoreConfiguration<Content extends Json.Object | null> = Content extends Json.Object ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Json.Object>>;
80
- type JunctionAdvancedConfiguration<AType extends string, BType extends string, Content extends Json.Object | null> = {
81
- warn?: (...args: any[]) => void;
82
- externalStore?: ExternalStoreConfiguration<Content>;
83
- isAType?: Refinement<string, AType>;
84
- isBType?: Refinement<string, BType>;
85
- isContent?: Refinement<unknown, Content>;
86
- makeContentKey?: (a: AType, b: BType) => string;
87
- };
88
- type JunctionJSON<ASide extends string, AType extends string, BSide extends string, BType extends string, Content extends Json.Object | null> = JunctionEntries<AType, BType, Content> & JunctionSchema<ASide, BSide>;
89
- declare class Junction<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Content extends Json.Object | null = null> {
90
- readonly a: ASide;
91
- readonly b: BSide;
92
- readonly cardinality: `1:1` | `1:n` | `n:n`;
93
- readonly relations: Map<AType | BType, Set<AType> | Set<BType>>;
94
- readonly contents: Map<string, Content>;
95
- isAType?: Refinement<string, AType> | null;
96
- isBType?: Refinement<string, BType> | null;
97
- isContent: Refinement<unknown, Content> | null;
98
- makeContentKey: (a: AType, b: BType) => string;
99
- warn?: (...args: any[]) => void;
100
- getRelatedKeys(key: AType): Set<BType> | undefined;
101
- getRelatedKeys(key: BType): Set<AType> | undefined;
102
- getRelatedKeys(key: AType | BType): Set<AType> | Set<BType> | undefined;
103
- protected addRelation(a: AType, b: BType): void;
104
- protected deleteRelation(a: AType, b: BType): void;
105
- protected replaceRelationsUnsafely(a: AType, bs: BType[]): void;
106
- protected replaceRelationsUnsafely(b: BType, as: AType[]): void;
107
- protected replaceRelationsSafely(a: AType, bs: BType[]): void;
108
- protected replaceRelationsSafely(b: BType, as: AType[]): void;
109
- protected getContentInternal(contentKey: string): Content | undefined;
110
- protected setContent(contentKey: string, content: Content): void;
111
- protected deleteContent(contentKey: string): void;
112
- constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<NoInfer<AType>, NoInfer<BType>, Content>>, config?: JunctionAdvancedConfiguration<AType, BType, Content>);
113
- toJSON(): JunctionJSON<ASide, AType, BSide, BType, Content>;
114
- set(a: AType, ...rest: Content extends null ? [b: BType] : [b: BType, content: Content]): this;
115
- set(relation: {
116
- [Key in ASide]: AType;
117
- } & {
118
- [Key in BSide]: BType;
119
- }, ...rest: Content extends null ? [] | [void?: undefined] : [content: Content]): this;
120
- delete(a: AType, b?: BType): this;
121
- delete(b: BType, a?: AType): this;
122
- delete(relation: {
123
- [Key in ASide]: AType;
124
- } | {
125
- [Key in BSide]: BType;
126
- } | ({
127
- [Key in ASide]: AType;
128
- } & {
129
- [Key in BSide]: BType;
130
- }), b?: undefined): this;
131
- getRelatedKey(key: AType): BType | undefined;
132
- getRelatedKey(key: BType): AType | undefined;
133
- replaceRelations(a: AType, relations: Content extends null ? BType[] : Record<BType, Content>, config?: {
134
- reckless: boolean;
135
- }): this;
136
- replaceRelations(b: BType, relations: Content extends null ? AType[] : Record<AType, Content>, config?: {
137
- reckless: boolean;
138
- }): this;
139
- getContent(a: AType, b: BType): Content | undefined;
140
- getRelationEntries(input: Record<ASide, AType>): [BType, Content][];
141
- getRelationEntries(input: Record<BSide, BType>): [AType, Content][];
142
- has(a: AType, b?: BType): boolean;
143
- has(b: BType, a?: AType): boolean;
144
- }
145
-
146
- declare class Subject<T> {
147
- Subscriber: (value: T) => void;
148
- subscribers: Map<string, this[`Subscriber`]>;
149
- subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
150
- private unsubscribe;
151
- next(value: T): void;
152
- }
153
- declare class StatefulSubject<T> extends Subject<T> {
154
- state: T;
155
- constructor(initialState: T);
156
- next(value: T): void;
157
- }
158
-
159
- type Transaction<F extends Func> = {
160
- key: string;
161
- type: `transaction`;
162
- install: (store: Store) => void;
163
- subject: Subject<TransactionUpdate<F>>;
164
- run: (parameters: Parameters<F>, id?: string) => ReturnType<F>;
165
- };
166
-
167
- type TransactionProgress<F extends Func> = {
168
- phase: `applying` | `building`;
169
- update: TransactionUpdate<F>;
170
- toolkit: ActorToolkit;
171
- };
172
- type TransactionEpoch = {
173
- epoch: Map<string, number>;
174
- actionContinuities: Junction<`continuity`, string, `action`, string>;
175
- };
176
-
177
- type SetUpdate = `add:${string}` | `clear:${string}` | `del:${string}` | `tx:${string}`;
178
- type NumberedSetUpdate = `${number}=${SetUpdate}`;
179
- interface SetRTXJson<P extends primitive> extends Json.Object {
180
- members: P[];
181
- cache: (NumberedSetUpdate | null)[];
182
- cacheLimit: number;
183
- cacheIdx: number;
184
- cacheUpdateNumber: number;
185
- }
186
- declare class SetRTX<P extends primitive> extends Set<P> implements Transceiver<NumberedSetUpdate>, Lineage {
187
- mode: TransceiverMode;
188
- readonly subject: Subject<SetUpdate>;
189
- cacheLimit: number;
190
- cache: (NumberedSetUpdate | null)[];
191
- cacheIdx: number;
192
- cacheUpdateNumber: number;
193
- constructor(values?: Iterable<P>, cacheLimit?: number);
194
- toJSON(): SetRTXJson<P>;
195
- static fromJSON<P extends primitive>(json: SetRTXJson<P>): SetRTX<P>;
196
- add(value: P): this;
197
- clear(): void;
198
- delete(value: P): boolean;
199
- readonly parent: SetRTX<P> | null;
200
- child: SetRTX<P> | null;
201
- transactionUpdates: SetUpdate[] | null;
202
- transaction(run: (child: SetRTX<P>) => boolean): void;
203
- protected _subscribe(key: string, fn: (update: SetUpdate) => void): () => void;
204
- subscribe(key: string, fn: (update: NumberedSetUpdate) => void): () => void;
205
- emit(update: SetUpdate): void;
206
- private doStep;
207
- getUpdateNumber(update: NumberedSetUpdate): number;
208
- do(update: NumberedSetUpdate): number | `OUT_OF_RANGE` | null;
209
- undoStep(update: SetUpdate): void;
210
- undo(update: NumberedSetUpdate): number | null;
211
- }
212
-
213
- type Molecule<K extends Canonical> = {
214
- readonly key: K;
215
- readonly stringKey: stringified<K>;
216
- readonly dependsOn: `all` | `any`;
217
- };
218
-
219
- type JoinStateFamilies<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 ? {
220
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
221
- AType,
222
- Content
223
- ] | null, BType>;
224
- } & {
225
- readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
226
- BType,
227
- Content
228
- ] | null, AType>;
229
- } : {}) & {
230
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
231
- } & {
232
- readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType | null, AType>;
233
- } : Cardinality extends `1:n` ? (Content extends Json.Object ? {
234
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
235
- AType,
236
- Content
237
- ] | null, BType>;
238
- } & {
239
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
240
- BType,
241
- Content
242
- ][], AType>;
243
- } : {}) & {
244
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
245
- } & {
246
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
247
- } : Cardinality extends `n:n` ? (Content extends Json.Object ? {
248
- readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
249
- AType,
250
- Content
251
- ][], BType>;
252
- } & {
253
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
254
- BType,
255
- Content
256
- ][], AType>;
257
- } : {}) & {
258
- readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType[], BType>;
259
- } & {
260
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
261
- } : never;
262
- declare class Join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object | null = null, const ContentKey extends CompoundTypedKey<`content`, ASide, BSide> = CompoundTypedKey<`content`, ASide, BSide>> {
263
- private toolkit;
264
- options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>;
265
- defaultContent: Content | undefined;
266
- molecules: Map<string, Molecule<any>>;
267
- relations: Junction<ASide, AType, BSide, BType, Content>;
268
- states: JoinStateFamilies<ASide, AType, BSide, BType, Cardinality, Content>;
269
- core: {
270
- relatedKeysAtoms: MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
271
- };
272
- transact(toolkit: SetterToolkit, run: (join: Join<ASide, AType, BSide, BType, Cardinality, Content>) => void): void;
273
- store: Store;
274
- realm: Anarchy;
275
- [Symbol.dispose](): void;
276
- constructor(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content | undefined, store?: Store);
277
- }
278
-
279
- interface Lineage {
280
- parent: typeof this | null;
281
- child: typeof this | null;
282
- }
283
-
284
- type OperationProgress = {
285
- open: false;
286
- } | {
287
- open: true;
288
- done: Set<string>;
289
- prev: Map<string, any>;
290
- time: number;
291
- token: WritableToken<any>;
292
- };
293
-
294
- type TimelineAtomUpdate<ManagedAtom extends TimelineManageable> = Flat<StateUpdate<TokenType<ManagedAtom>> & {
295
- key: string;
296
- type: `atom_update`;
297
- timestamp: number;
298
- family?: FamilyMetadata;
299
- }>;
300
- type TimelineSelectorUpdate<ManagedAtom extends TimelineManageable> = {
301
- key: string;
302
- type: `selector_update`;
303
- timestamp: number;
304
- atomUpdates: Omit<TimelineAtomUpdate<ManagedAtom>, `timestamp`>[];
305
- };
306
- type TimelineTransactionUpdate = Flat<TransactionUpdate<Func> & {
307
- key: string;
308
- type: `transaction_update`;
309
- timestamp: number;
310
- }>;
311
- type TimelineStateCreation<T extends ReadableToken<any>> = Flat<StateCreation<T> & {
312
- timestamp: number;
313
- }>;
314
- type TimelineStateDisposal<T extends ReadableToken<any>> = Flat<StateDisposal<T> & {
315
- timestamp: number;
316
- }>;
317
- type TimelineMoleculeCreation = Flat<MoleculeCreation & {
318
- timestamp: number;
319
- }>;
320
- type TimelineMoleculeDisposal = Flat<MoleculeDisposal & {
321
- timestamp: number;
322
- }>;
323
- type Timeline<ManagedAtom extends TimelineManageable> = {
324
- type: `timeline`;
325
- key: string;
326
- at: number;
327
- shouldCapture?: (update: TimelineUpdate<ManagedAtom>, timeline: Timeline<ManagedAtom>) => boolean;
328
- timeTraveling: `into_future` | `into_past` | null;
329
- history: TimelineUpdate<ManagedAtom>[];
330
- selectorTime: number | null;
331
- transactionKey: string | null;
332
- install: (store: Store) => void;
333
- subject: Subject<TimelineUpdate<ManagedAtom> | `redo` | `undo`>;
334
- subscriptions: Map<string, () => void>;
335
- };
336
-
337
- declare class Store implements Lineage {
338
- parent: Store | null;
339
- child: Store | null;
340
- valueMap: Map<string, any>;
341
- defaults: Map<string, any>;
342
- atoms: Map<string, Atom<any>>;
343
- selectors: Map<string, WritableSelector<any>>;
344
- readonlySelectors: Map<string, ReadonlySelector<any>>;
345
- atomsThatAreDefault: Set<string>;
346
- selectorAtoms: Junction<"selectorKey", string, "atomKey", string, null>;
347
- selectorGraph: Junction<"upstreamSelectorKey", string, "downstreamSelectorKey", string, {
348
- source: string;
349
- }>;
350
- trackers: Map<string, Tracker<Transceiver<any>>>;
351
- families: Map<string, MutableAtomFamily<any, any, any> | ReadonlySelectorFamily<any, any> | RegularAtomFamily<any, any> | WritableSelectorFamily<any, any>>;
352
- joins: Map<string, Join<any, any, any, any, any, any, `T$--content==${any}::${string}++${any}::${string}`>>;
353
- transactions: Map<string, Transaction<Func>>;
354
- transactionMeta: TransactionEpoch | TransactionProgress<Func>;
355
- timelines: Map<string, Timeline<any>>;
356
- timelineTopics: Junction<"timelineKey", string, "topicKey", string, {
357
- topicType: `atom_family` | `atom` | `molecule_family` | `molecule`;
358
- }>;
359
- disposalTraces: CircularBuffer<{
360
- key: string;
361
- trace: string;
362
- }>;
363
- molecules: Map<string, Molecule<Canonical>>;
364
- moleculeJoins: Junction<"moleculeKey", stringified<Canonical>, "joinKey", string, null>;
365
- moleculeGraph: Junction<"upstreamMoleculeKey", stringified<Canonical> | "root", "downstreamMoleculeKey", stringified<Canonical>, {
366
- source: stringified<Canonical>;
367
- }>;
368
- moleculeData: Junction<"moleculeKey", stringified<Canonical>, "stateFamilyKey", string, null>;
369
- miscResources: Map<string, Disposable>;
370
- on: {
371
- atomCreation: Subject<AtomToken<unknown>>;
372
- atomDisposal: Subject<AtomToken<unknown>>;
373
- selectorCreation: Subject<ReadonlySelectorToken<unknown> | WritableSelectorToken<unknown>>;
374
- selectorDisposal: Subject<ReadonlySelectorToken<unknown> | WritableSelectorToken<unknown>>;
375
- timelineCreation: Subject<TimelineToken<unknown>>;
376
- transactionCreation: Subject<TransactionToken<Func>>;
377
- transactionApplying: StatefulSubject<TransactionProgress<Func> | null>;
378
- operationClose: Subject<OperationProgress>;
379
- moleculeCreation: Subject<MoleculeCreation>;
380
- moleculeDisposal: Subject<MoleculeDisposal>;
381
- };
382
- operation: OperationProgress;
383
- config: {
384
- name: string;
385
- lifespan: `ephemeral` | `immortal`;
386
- };
387
- loggers: AtomIOLogger[];
388
- logger: Logger;
389
- constructor(config: Store[`config`], store?: Store | null);
390
- }
391
-
392
- interface Transceiver<S extends Json.Serializable> {
393
- do: (update: S) => number | `OUT_OF_RANGE` | null;
394
- undo: (update: S) => void;
395
- subscribe: (key: string, fn: (update: S) => void) => () => void;
396
- cacheUpdateNumber: number;
397
- getUpdateNumber: (update: S) => number;
398
- }
399
- type TransceiverMode = `playback` | `record` | `transaction`;
400
-
401
- /**
402
- * @internal Give the tracker a transceiver state and a store, and it will
403
- * subscribe to the transceiver's inner value. When the inner value changes,
404
- * the tracker will update its own state to reflect the change.
405
- */
406
- declare class Tracker<Mutable extends Transceiver<any>> {
407
- private Update;
408
- private initializeState;
409
- private unsubscribeFromInnerValue;
410
- private unsubscribeFromState;
411
- private observeCore;
412
- private updateCore;
413
- mutableState: MutableAtomToken<Mutable, Json.Serializable>;
414
- latestUpdateState: RegularAtomToken<typeof this.Update | null>;
415
- [Symbol.dispose]: () => void;
416
- constructor(mutableState: MutableAtomToken<Mutable, Json.Serializable>, store: Store);
417
- }
418
-
419
- type EnvironmentData = {
420
- store: Store;
421
- };
422
-
423
- type AtomIOState = {
424
- key: string;
425
- family?: FamilyMetadata;
426
- install: (store: Store) => void;
427
- subject: Subject<{
428
- newValue: any;
429
- oldValue: any;
430
- }>;
431
- };
432
- type RegularAtom<T> = AtomIOState & {
433
- type: `atom`;
434
- default: T | (() => T);
435
- cleanup?: () => void;
436
- };
437
- type MutableAtom<T extends Transceiver<any>, J extends Json.Serializable> = AtomIOState & JsonInterface<T, J> & {
438
- type: `mutable_atom`;
439
- default: T | (() => T);
440
- cleanup?: () => void;
441
- };
442
- type Atom<T> = RegularAtom<T> | (T extends Transceiver<any> ? MutableAtom<T, any> : never);
443
- type WritableSelector<T> = AtomIOState & {
444
- type: `selector`;
445
- get: () => T;
446
- set: (newValue: T | ((oldValue: T) => T)) => void;
447
- };
448
- type ReadonlySelector<T> = AtomIOState & {
449
- type: `readonly_selector`;
450
- get: () => T;
451
- };
452
- type RegularAtomFamily<T, K extends Canonical> = RegularAtomFamilyToken<T, K> & {
453
- (key: K): RegularAtomToken<T>;
454
- subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>;
455
- install: (store: Store) => void;
456
- internalRoles: string[] | undefined;
457
- };
458
- type MutableAtomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = JsonInterface<T, J> & MutableAtomFamilyToken<T, J, K> & {
459
- (key: K): MutableAtomToken<T, J>;
460
- subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>;
461
- install: (store: Store) => void;
462
- internalRoles: string[] | undefined;
463
- };
464
- type WritableSelectorFamily<T, K extends Canonical> = WritableSelectorFamilyToken<T, K> & ((key: K) => WritableSelectorToken<T>) & {
465
- default: (key: K) => T;
466
- subject: Subject<StateCreation<WritableSelectorToken<T>> | StateDisposal<WritableSelectorToken<T>>>;
467
- install: (store: Store) => void;
468
- internalRoles: string[] | undefined;
469
- };
470
- type ReadonlySelectorFamily<T, K extends Canonical> = ReadonlySelectorFamilyToken<T, K> & ((key: K) => ReadonlySelectorToken<T>) & {
471
- default: (key: K) => T;
472
- subject: Subject<StateCreation<ReadonlySelectorToken<T>> | StateDisposal<ReadonlySelectorToken<T>>>;
473
- install: (store: Store) => void;
474
- internalRoles: string[] | undefined;
475
- };
1
+ import { Transceiver, Func, EnvironmentData, TimelineAtomUpdate, TimelineMoleculeCreation, TimelineMoleculeDisposal, TimelineSelectorUpdate, TimelineStateCreation, TimelineStateDisposal, TimelineTransactionUpdate, Timeline, JunctionSchemaBase, JunctionEntriesBase, Refinement, Store, Junction, Each, Flat } from 'atom.io/internal';
2
+ import { Canonical, Json, JsonInterface, stringified } from 'atom.io/json';
3
+ import { getState as getState$1, setState as setState$1, findState as findState$1, MutableAtomFamilyToken as MutableAtomFamilyToken$1, MutableAtomToken as MutableAtomToken$1, RegularAtomFamilyToken as RegularAtomFamilyToken$1, RegularAtomToken as RegularAtomToken$1, WritableSelectorFamilyToken as WritableSelectorFamilyToken$1, WritableSelectorToken as WritableSelectorToken$1, ReadonlySelectorFamilyToken as ReadonlySelectorFamilyToken$1, ReadonlySelectorToken as ReadonlySelectorToken$1, WritableFamilyToken as WritableFamilyToken$1, WritableToken as WritableToken$1, ReadableFamilyToken as ReadableFamilyToken$1, ReadableToken as ReadableToken$1 } from 'atom.io';
4
+ import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
476
5
 
477
6
  /**
478
7
  * @public
@@ -611,15 +140,15 @@ type TransactionUpdate<F extends Func> = {
611
140
  };
612
141
  type GetterToolkit = Pick<SetterToolkit, `find` | `get` | `json`>;
613
142
  type SetterToolkit = Readonly<{
614
- get: typeof getState;
615
- set: typeof setState;
616
- find: typeof findState;
143
+ get: typeof getState$1;
144
+ set: typeof setState$1;
145
+ find: typeof findState$1;
617
146
  json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
618
147
  }>;
619
148
  type ActorToolkit = Readonly<{
620
- get: typeof getState;
621
- set: typeof setState;
622
- find: typeof findState;
149
+ get: typeof getState$1;
150
+ set: typeof setState$1;
151
+ find: typeof findState$1;
623
152
  json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
624
153
  dispose: typeof disposeState;
625
154
  run: typeof runTransaction;
@@ -732,7 +261,7 @@ declare function disposeState<K extends Canonical>(token: ReadableFamilyToken<an
732
261
  * The current value of the state
733
262
  * @overload Mutable Atom
734
263
  */
735
- 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>;
264
+ declare function findState<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical, Key extends K>(token: MutableAtomFamilyToken$1<T, J, K>, key: Key): MutableAtomToken$1<T, J, K>;
736
265
  /**
737
266
  * @public
738
267
  * Finds a state in the store
@@ -742,7 +271,7 @@ declare function findState<T extends Transceiver<any>, J extends Json.Serializab
742
271
  * The current value of the state
743
272
  * @overload Regular Atom
744
273
  */
745
- declare function findState<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K>;
274
+ declare function findState<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken$1<T, K>, key: Key): RegularAtomToken$1<T, K>;
746
275
  /**
747
276
  * @public
748
277
  * Finds a state in the store
@@ -752,7 +281,7 @@ declare function findState<T, K extends Canonical, Key extends K>(token: Regular
752
281
  * The current value of the state
753
282
  * @overload Writable Selector
754
283
  */
755
- declare function findState<T, K extends Canonical, Key extends K>(token: WritableSelectorFamilyToken<T, K>, key: Key): WritableSelectorToken<T, K>;
284
+ declare function findState<T, K extends Canonical, Key extends K>(token: WritableSelectorFamilyToken$1<T, K>, key: Key): WritableSelectorToken$1<T, K>;
756
285
  /**
757
286
  * @public
758
287
  * Finds a state in the store
@@ -762,7 +291,7 @@ declare function findState<T, K extends Canonical, Key extends K>(token: Writabl
762
291
  * The current value of the state
763
292
  * @overload Readonly Selector
764
293
  */
765
- declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlySelectorFamilyToken<T, K>, key: Key): ReadonlySelectorToken<T, K>;
294
+ declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlySelectorFamilyToken$1<T, K>, key: Key): ReadonlySelectorToken$1<T, K>;
766
295
  /**
767
296
  * @public
768
297
  * Finds a state in the store
@@ -772,7 +301,7 @@ declare function findState<T, K extends Canonical, Key extends K>(token: Readonl
772
301
  * The current value of the state
773
302
  * @overload Writable State
774
303
  */
775
- declare function findState<T, K extends Canonical, Key extends K>(token: WritableFamilyToken<T, K>, key: Key): WritableToken<T, K>;
304
+ declare function findState<T, K extends Canonical, Key extends K>(token: WritableFamilyToken$1<T, K>, key: Key): WritableToken$1<T, K>;
776
305
  /**
777
306
  * @public
778
307
  * Finds a {@link ReadableToken} in the store
@@ -783,7 +312,7 @@ declare function findState<T, K extends Canonical, Key extends K>(token: Writabl
783
312
  * @overload Unknown
784
313
  * @default
785
314
  */
786
- declare function findState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): ReadableToken<T, K>;
315
+ declare function findState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken$1<T, K>, key: Key): ReadableToken$1<T, K>;
787
316
 
788
317
  /**
789
318
  * @public
@@ -823,51 +352,51 @@ type JoinToken<ASide extends string, AType extends string, BSide extends string,
823
352
  declare function join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, null>, defaultContent?: undefined, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, null>;
824
353
  declare function join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, Content>;
825
354
  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 ? {
826
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
355
+ readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken$1<[
827
356
  AType,
828
357
  Content
829
358
  ] | null, BType>;
830
359
  } & {
831
- readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
360
+ readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorToken$1<[
832
361
  BType,
833
362
  Content
834
363
  ] | null, AType>;
835
364
  } : {}) & {
836
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
365
+ readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken$1<AType | null, BType>;
837
366
  } & {
838
- readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType | null, AType>;
367
+ readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorToken$1<BType | null, AType>;
839
368
  } : Cardinality extends `1:n` ? (Content extends Json.Object ? {
840
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
369
+ readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken$1<[
841
370
  AType,
842
371
  Content
843
372
  ] | null, BType>;
844
373
  } & {
845
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
374
+ readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken$1<[
846
375
  BType,
847
376
  Content
848
377
  ][], AType>;
849
378
  } : {}) & {
850
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
379
+ readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken$1<AType | null, BType>;
851
380
  } & {
852
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
381
+ readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken$1<BType[], AType>;
853
382
  } : Cardinality extends `n:n` ? (Content extends Json.Object ? {
854
- readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
383
+ readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorToken$1<[
855
384
  AType,
856
385
  Content
857
386
  ][], BType>;
858
387
  } & {
859
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
388
+ readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken$1<[
860
389
  BType,
861
390
  Content
862
391
  ][], AType>;
863
392
  } : {}) & {
864
- readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType[], BType>;
393
+ readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorToken$1<AType[], BType>;
865
394
  } & {
866
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
395
+ readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken$1<BType[], AType>;
867
396
  } : never;
868
397
  declare function findRelations<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>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, key: AType | BType): JoinStates<ASide, AType, BSide, BType, Cardinality, Content>;
869
398
  declare function editRelations<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>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, change: (relations: Junction<ASide, AType, BSide, BType, Content>) => void): void;
870
- declare function getInternalRelations<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>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
399
+ declare function getInternalRelations<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>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>): MutableAtomFamilyToken$1<SetRTX<string>, SetRTXJson<string>, string>;
871
400
 
872
401
  declare const LoggerIconDictionary: {
873
402
  readonly "\u231B": "Timeline event fully captured";
@@ -1033,7 +562,7 @@ declare class Silo {
1033
562
  selectorFamily: typeof selectorFamily;
1034
563
  transaction: typeof transaction;
1035
564
  timeline: typeof timeline;
1036
- findState: typeof findState;
565
+ findState: typeof findState$1;
1037
566
  getState: typeof getState;
1038
567
  setState: typeof setState;
1039
568
  disposeState: typeof disposeState;
@@ -1060,19 +589,19 @@ declare function subscribe<T>(token: ReadableToken<T>, handleUpdate: UpdateHandl
1060
589
  declare function subscribe<F extends Func>(token: TransactionToken<F>, handleUpdate: TransactionUpdateHandler<F>, key?: string): () => void;
1061
590
  declare function subscribe<M extends TimelineManageable>(token: TimelineToken<M>, handleUpdate: (update: TimelineUpdate<M> | `redo` | `undo`) => void, key?: string): () => void;
1062
591
 
1063
- type TokenType<Comparison extends ReadableFamilyToken<any, any> | ReadableToken<any>> = Comparison extends ReadableToken<infer RepresentedValue> ? RepresentedValue : Comparison extends ReadableFamilyToken<infer RepresentedValue, any> ? RepresentedValue : never;
1064
- declare function isToken<KnownToken extends RegularAtomToken<any>>(knownToken: KnownToken, unknownToken: ReadableToken<any>): unknownToken is RegularAtomToken<TokenType<KnownToken>>;
1065
- declare function isToken<KnownToken extends MutableAtomToken<any, any>>(knownToken: KnownToken, unknownToken: ReadableToken<any>): unknownToken is MutableAtomToken<TokenType<KnownToken>, any>;
1066
- declare function isToken<KnownToken extends WritableSelectorToken<any>>(knownToken: KnownToken, unknownToken: ReadableToken<any>): unknownToken is WritableSelectorToken<TokenType<KnownToken>>;
1067
- declare function isToken<KnownToken extends ReadonlySelectorToken<any>>(knownToken: KnownToken, unknownToken: ReadableToken<any>): unknownToken is ReadonlySelectorToken<TokenType<KnownToken>>;
1068
- declare function isToken<KnownToken extends WritableToken<any>>(knownToken: KnownToken, unknownToken: ReadableToken<any>): unknownToken is WritableToken<TokenType<KnownToken>>;
1069
- declare function isToken<KnownToken extends ReadableToken<any>>(knownToken: KnownToken, unknownToken: ReadableToken<any>): unknownToken is ReadableToken<TokenType<KnownToken>>;
1070
- declare function belongsTo<Family extends RegularAtomFamilyToken<any, any>>(family: Family, unknownToken: ReadableToken<any>): unknownToken is RegularAtomToken<TokenType<Family>>;
1071
- declare function belongsTo<Family extends MutableAtomFamilyToken<any, any, any>>(family: Family, unknownToken: ReadableToken<any>): unknownToken is MutableAtomToken<TokenType<Family>, any>;
1072
- declare function belongsTo<Family extends WritableSelectorFamilyToken<any, any>>(family: Family, unknownToken: ReadableToken<any>): unknownToken is WritableSelectorToken<TokenType<Family>>;
1073
- declare function belongsTo<Family extends ReadonlySelectorFamilyToken<any, any>>(family: Family, unknownToken: ReadableToken<any>): unknownToken is ReadonlySelectorToken<TokenType<Family>>;
1074
- declare function belongsTo<Family extends WritableFamilyToken<any, any>>(family: Family, unknownToken: ReadableToken<any>): unknownToken is WritableToken<TokenType<Family>>;
1075
- declare function belongsTo<Family extends ReadableFamilyToken<any, any>>(family: Family, unknownToken: ReadableToken<any>): unknownToken is ReadableToken<TokenType<Family>>;
592
+ type TokenType<Comparison extends ReadableFamilyToken$1<any, any> | ReadableToken$1<any>> = Comparison extends ReadableToken$1<infer RepresentedValue> ? RepresentedValue : Comparison extends ReadableFamilyToken$1<infer RepresentedValue, any> ? RepresentedValue : never;
593
+ declare function isToken<KnownToken extends RegularAtomToken$1<any>>(knownToken: KnownToken, unknownToken: ReadableToken$1<any>): unknownToken is RegularAtomToken$1<TokenType<KnownToken>>;
594
+ declare function isToken<KnownToken extends MutableAtomToken$1<any, any>>(knownToken: KnownToken, unknownToken: ReadableToken$1<any>): unknownToken is MutableAtomToken$1<TokenType<KnownToken>, any>;
595
+ declare function isToken<KnownToken extends WritableSelectorToken$1<any>>(knownToken: KnownToken, unknownToken: ReadableToken$1<any>): unknownToken is WritableSelectorToken$1<TokenType<KnownToken>>;
596
+ declare function isToken<KnownToken extends ReadonlySelectorToken$1<any>>(knownToken: KnownToken, unknownToken: ReadableToken$1<any>): unknownToken is ReadonlySelectorToken$1<TokenType<KnownToken>>;
597
+ declare function isToken<KnownToken extends WritableToken$1<any>>(knownToken: KnownToken, unknownToken: ReadableToken$1<any>): unknownToken is WritableToken$1<TokenType<KnownToken>>;
598
+ declare function isToken<KnownToken extends ReadableToken$1<any>>(knownToken: KnownToken, unknownToken: ReadableToken$1<any>): unknownToken is ReadableToken$1<TokenType<KnownToken>>;
599
+ declare function belongsTo<Family extends RegularAtomFamilyToken$1<any, any>>(family: Family, unknownToken: ReadableToken$1<any>): unknownToken is RegularAtomToken$1<TokenType<Family>>;
600
+ declare function belongsTo<Family extends MutableAtomFamilyToken$1<any, any, any>>(family: Family, unknownToken: ReadableToken$1<any>): unknownToken is MutableAtomToken$1<TokenType<Family>, any>;
601
+ declare function belongsTo<Family extends WritableSelectorFamilyToken$1<any, any>>(family: Family, unknownToken: ReadableToken$1<any>): unknownToken is WritableSelectorToken$1<TokenType<Family>>;
602
+ declare function belongsTo<Family extends ReadonlySelectorFamilyToken$1<any, any>>(family: Family, unknownToken: ReadableToken$1<any>): unknownToken is ReadonlySelectorToken$1<TokenType<Family>>;
603
+ declare function belongsTo<Family extends WritableFamilyToken$1<any, any>>(family: Family, unknownToken: ReadableToken$1<any>): unknownToken is WritableToken$1<TokenType<Family>>;
604
+ declare function belongsTo<Family extends ReadableFamilyToken$1<any, any>>(family: Family, unknownToken: ReadableToken$1<any>): unknownToken is ReadableToken$1<TokenType<Family>>;
1076
605
 
1077
606
  /**
1078
607
  * @public