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
@@ -1,925 +1,8 @@
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
- };
1
+ import * as AtomIO from 'atom.io';
2
+ import { Store } from 'atom.io/internal';
3
+ import { Canonical, stringified } from 'atom.io/json';
24
4
 
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
- };
476
-
477
- type RegularAtomFamilyToken<T, K extends Canonical> = {
478
- key: string;
479
- type: `atom_family`;
480
- __T?: T;
481
- __K?: K;
482
- };
483
- type MutableAtomFamilyToken<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical> = {
484
- key: string;
485
- type: `mutable_atom_family`;
486
- __T?: T;
487
- __J?: J;
488
- __K?: K;
489
- };
490
- type AtomFamilyToken<T, K extends Canonical = Canonical> = MutableAtomFamilyToken<T extends Transceiver<any> ? T : never, any, K> | RegularAtomFamilyToken<T, K>;
491
-
492
- type TransactionToken<F extends Func> = {
493
- key: string;
494
- type: `transaction`;
495
- __F?: F;
496
- };
497
- type StateCreation<Token extends ReadableToken<any>> = {
498
- type: `state_creation`;
499
- token: Token;
500
- };
501
- type AtomDisposal<Token extends ReadableToken<any>> = {
502
- type: `state_disposal`;
503
- subType: `atom`;
504
- token: Token;
505
- value: TokenType<Token>;
506
- };
507
- type SelectorDisposal<Token extends ReadableToken<any>> = {
508
- type: `state_disposal`;
509
- subType: `selector`;
510
- token: Token;
511
- };
512
- type StateDisposal<Token extends ReadableToken<any>> = AtomDisposal<Token> | SelectorDisposal<Token>;
513
- type MoleculeCreation = {
514
- type: `molecule_creation`;
515
- key: Canonical;
516
- provenance: Canonical;
517
- };
518
- type MoleculeDisposal = {
519
- type: `molecule_disposal`;
520
- key: Canonical;
521
- provenance: stringified<Canonical>[];
522
- values: [key: string, value: any][];
523
- };
524
- type MoleculeTransfer = {
525
- type: `molecule_transfer`;
526
- key: Canonical;
527
- from: Canonical[];
528
- to: Canonical[];
529
- };
530
- type TransactionUpdateContent = KeyedStateUpdate<unknown> | MoleculeCreation | MoleculeDisposal | MoleculeTransfer | StateCreation<ReadableToken<unknown>> | StateDisposal<ReadableToken<unknown>> | TransactionUpdate<Func>;
531
- type TransactionUpdate<F extends Func> = {
532
- type: `transaction_update`;
533
- key: string;
534
- id: string;
535
- epoch: number;
536
- updates: TransactionUpdateContent[];
537
- params: Parameters<F>;
538
- output: ReturnType<F>;
539
- };
540
- type SetterToolkit = Readonly<{
541
- get: typeof getState;
542
- set: typeof setState;
543
- find: typeof findState;
544
- json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
545
- }>;
546
- type ActorToolkit = Readonly<{
547
- get: typeof getState;
548
- set: typeof setState;
549
- find: typeof findState;
550
- json: <T extends Transceiver<any>, J extends Json.Serializable>(state: MutableAtomToken<T, J>) => WritableSelectorToken<J>;
551
- dispose: typeof disposeState;
552
- run: typeof runTransaction;
553
- env: () => EnvironmentData;
554
- }>;
555
- declare function runTransaction<F extends Func>(token: TransactionToken<F>, id?: string): (...parameters: Parameters<F>) => ReturnType<F>;
556
-
557
- type WritableSelectorFamilyToken<T, K extends Canonical> = {
558
- key: string;
559
- type: `selector_family`;
560
- __T?: T;
561
- __K?: K;
562
- };
563
- type ReadonlySelectorFamilyToken<T, K extends Canonical> = {
564
- key: string;
565
- type: `readonly_selector_family`;
566
- __T?: T;
567
- __K?: K;
568
- };
569
- type SelectorFamilyToken<T, K extends Canonical> = ReadonlySelectorFamilyToken<T, K> | WritableSelectorFamilyToken<T, K>;
570
-
571
- type TimelineManageable = AtomFamilyToken<any, any> | AtomToken<any>;
572
- type AtomOnly<M extends TimelineManageable> = M extends AtomFamilyToken<any, any> ? AtomToken<any> : M extends AtomToken<any> ? M : never;
573
- type TimelineToken<M> = {
574
- key: string;
575
- type: `timeline`;
576
- __M?: M;
577
- };
578
- type TimelineUpdate<ManagedAtom extends TimelineManageable> = TimelineAtomUpdate<ManagedAtom> | TimelineMoleculeCreation | TimelineMoleculeDisposal | TimelineSelectorUpdate<ManagedAtom> | TimelineStateCreation<AtomOnly<ManagedAtom>> | TimelineStateDisposal<AtomOnly<ManagedAtom>> | TimelineTransactionUpdate;
579
-
580
- /**
581
- * @public
582
- * Disposes of a state in the implicit store
583
- * @param token - The token of the state to dispose
584
- * @overload Default
585
- */
586
- declare function disposeState(token: ReadableToken<any>): void;
587
- /**
588
- * @public
589
- * Disposes of a state family in the implicit store
590
- * @param token - The token of the state family to dispose
591
- * @param key - The unique key of the state to dispose
592
- */
593
- declare function disposeState<K extends Canonical>(token: ReadableFamilyToken<any, K>, key: K): void;
594
-
595
- /**
596
- * @public
597
- * Finds a {@link MutableAtomToken} in the store
598
- * @param token - A {@link MutableAtomFamilyToken}
599
- * @param key - The key of the state
600
- * @returns
601
- * The current value of the state
602
- * @overload Mutable Atom
603
- */
604
- 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>;
605
- /**
606
- * @public
607
- * Finds a state in the store
608
- * @param token - The token of the state family
609
- * @param key - The key of the state
610
- * @returns
611
- * The current value of the state
612
- * @overload Regular Atom
613
- */
614
- declare function findState<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K>;
615
- /**
616
- * @public
617
- * Finds a state in the store
618
- * @param token - The token of the state family
619
- * @param key - The key of the state
620
- * @returns
621
- * The current value of the state
622
- * @overload Writable Selector
623
- */
624
- declare function findState<T, K extends Canonical, Key extends K>(token: WritableSelectorFamilyToken<T, K>, key: Key): WritableSelectorToken<T, K>;
625
- /**
626
- * @public
627
- * Finds a state in the store
628
- * @param token - The token of the state family
629
- * @param key - The key of the state
630
- * @returns
631
- * The current value of the state
632
- * @overload Readonly Selector
633
- */
634
- declare function findState<T, K extends Canonical, Key extends K>(token: ReadonlySelectorFamilyToken<T, K>, key: Key): ReadonlySelectorToken<T, K>;
635
- /**
636
- * @public
637
- * Finds a state in the store
638
- * @param token - The token of the state family
639
- * @param key - The key of the state
640
- * @returns
641
- * The current value of the state
642
- * @overload Writable State
643
- */
644
- declare function findState<T, K extends Canonical, Key extends K>(token: WritableFamilyToken<T, K>, key: Key): WritableToken<T, K>;
645
- /**
646
- * @public
647
- * Finds a {@link ReadableToken} in the store
648
- * @param token - A {@link ReadableFamilyToken}
649
- * @param key - The key of the state
650
- * @returns
651
- * The current value of the state
652
- * @overload Unknown
653
- * @default
654
- */
655
- declare function findState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): ReadableToken<T, K>;
656
-
657
- /**
658
- * @public
659
- * Get the current value of a state
660
- * @param token - The token of the state to get
661
- * @return The current value of the state
662
- * @overload Default
663
- * @default
664
- */
665
- declare function getState<T>(token: ReadableToken<T>): T;
666
- /**
667
- * @public
668
- * Get the current value of a state family
669
- * @param token - The token of a state family
670
- * @param key - The unique key of the state to get
671
- * @return The current value of the state
672
- * @overload Streamlined
673
- */
674
- declare function getState<T, K extends Canonical, Key extends K>(token: ReadableFamilyToken<T, K>, key: Key): T;
675
-
676
- 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>> {
677
- readonly key: string;
678
- readonly cardinality: Cardinality;
679
- readonly isAType: Refinement<string, AType>;
680
- readonly isBType: Refinement<string, BType>;
681
- }
682
-
683
- declare const LoggerIconDictionary: {
684
- readonly "\u231B": "Timeline event fully captured";
685
- readonly "\u23E9": "Timeline redo";
686
- readonly "\u23EA": "Timeline undo";
687
- readonly "\u23ED\uFE0F": "Transaction redo";
688
- readonly "\u23EE\uFE0F": "Transaction undo";
689
- readonly "\u23F3": "Timeline event partially captured";
690
- readonly "\u23F9\uFE0F": "Time-travel complete";
691
- readonly "\u2705": "Realtime transaction success";
692
- readonly "\u2728": "Computation complete";
693
- readonly "\u274C": "Conflict prevents attempted action";
694
- readonly "\u2B55": "Operation start";
695
- readonly "\uD83D\uDD34": "Operation complete";
696
- readonly "\u2757": "Operation blocked";
697
- readonly "\uD83D\uDFE2": "Operation unblocked";
698
- readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
699
- readonly "\uD83D\uDC40": "Subscription added";
700
- readonly "\uD83D\uDC4B": "Greeting";
701
- readonly "\uD83D\uDC4D": "Realtime acknowledgment";
702
- readonly "\uD83D\uDC6A": "Family member added";
703
- readonly "\uD83D\uDC81": "Notice";
704
- readonly "\uD83D\uDCA5": "Caught";
705
- readonly "\uD83D\uDCC1": "Stow update";
706
- readonly "\uD83D\uDCC3": "Copy mutable";
707
- readonly "\uD83D\uDCD6": "Read state";
708
- readonly "\uD83D\uDCDD": "Write state";
709
- readonly "\uD83D\uDCE2": "Notify subscribers";
710
- readonly "\uD83D\uDD04": "Realtime transaction synchronized";
711
- readonly "\uD83D\uDD0C": "Register dependency";
712
- readonly "\uD83D\uDD0D": "Discover root";
713
- readonly "\uD83D\uDD25": "Delete state";
714
- readonly "\uD83D\uDD27": "Create mutable atom";
715
- readonly "\uD83D\uDD28": "Create immutable atom";
716
- readonly "\uD83D\uDDD1": "Evict cached value";
717
- readonly "\uD83D\uDE48": "Subscription canceled";
718
- readonly "\uD83D\uDE80": "Performance measure";
719
- readonly "\uD83D\uDEC4": "Apply transaction";
720
- readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
721
- readonly "\uD83D\uDEEB": "Begin transaction";
722
- readonly "\uD83D\uDEEC": "Complete transaction";
723
- readonly "\uD83E\uDDEE": "Computing selector";
724
- readonly "\uD83E\uDDF9": "Prepare to evict";
725
- readonly "\uD83E\uDE82": "Abort transaction";
726
- readonly "\uD83E\uDD1E": "Realtime optimistic update enqueued";
727
- readonly "\uD83D\uDC48": "Realtime confirmed update enqueued";
728
- readonly "\uD83E\uDDD1\u200D\u2696\uFE0F": "Realtime update beginning reconciliation";
729
- readonly "\uD83D\uDECE\uFE0F": "Realtime transaction received";
730
- readonly "\uD83D\uDD2D": "Determining realtime perspective";
731
- readonly "\uD83D\uDD8C": "Redacting realtime update";
732
- readonly "\uD83D\uDC41": "Determining perspective";
733
- };
734
- type LoggerIcon = keyof typeof LoggerIconDictionary;
735
- 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`;
736
- declare const LOG_LEVELS: readonly ["info", "warn", "error"];
737
- type LogLevel = (typeof LOG_LEVELS)[number];
738
- type LogFn = (icon: LoggerIcon, denomination: TokenDenomination, tokenKey: string, message: string, ...rest: unknown[]) => void;
739
- type LogFilter = (...params: Parameters<LogFn>) => boolean;
740
- type Logger = Record<LogLevel, LogFn>;
741
- declare class AtomIOLogger implements Logger {
742
- logLevel: `error` | `info` | `warn` | null;
743
- private readonly filter?;
744
- private readonly logger;
745
- constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
746
- error: LogFn;
747
- info: LogFn;
748
- warn: LogFn;
749
- }
750
-
751
- declare const $claim: unique symbol;
752
- type Claim<K extends Canonical> = K & {
753
- [$claim]?: true;
754
- };
755
- declare class Realm<H extends Hierarchy> {
756
- store: Store;
757
- constructor(store?: Store);
758
- allocate<V extends Vassal<H>, A extends Above<V, H>>(provenance: A, key: V, attachmentStyle?: `all` | `any`): Claim<V>;
759
- 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>>;
760
- deallocate<V extends Vassal<H>>(claim: Claim<V>): void;
761
- claim<V extends Exclude<Vassal<H>, CompoundTypedKey>, A extends Above<V, H>>(newProvenance: A, claim: Claim<V>, exclusive?: `exclusive`): Claim<V>;
762
- }
763
- declare class Anarchy {
764
- store: Store;
765
- realm: Realm<any>;
766
- constructor(store?: Store);
767
- allocate(provenance: Canonical, key: Canonical, attachmentStyle?: `all` | `any`): void;
768
- deallocate(key: Canonical): void;
769
- claim(newProvenance: Canonical, key: Canonical, exclusive?: `exclusive`): void;
770
- }
771
- declare const T$ = "T$";
772
- type T$ = typeof T$;
773
- type TypeTag<T extends string> = `${T$}--${T}`;
774
- type SingularTypedKey<T extends string = string> = `${T}::${string}`;
775
- type CompoundTypedKey<A extends string = string, B extends string = string, C extends string = string> = `${TypeTag<A>}==${SingularTypedKey<B>}++${SingularTypedKey<C>}`;
776
- type TypedKey<A extends string = string, B extends string = string, C extends string = string> = CompoundTypedKey<A, B, C> | SingularTypedKey<A>;
777
- type Scope = SingularTypedKey[];
778
- type MutualFealty = {
779
- above: Scope;
780
- below: CompoundTypedKey;
781
- };
782
- type ExclusiveFealty = {
783
- above: TypedKey | `root`;
784
- below: Scope;
785
- };
786
- type Fealty = ExclusiveFealty | MutualFealty;
787
- type Hierarchy<F extends Fealty[] = Fealty[]> = Each<F>;
788
- type Vassal<H extends Hierarchy> = {
789
- [K in keyof H]: H[K] extends MutualFealty ? H[K][`below`] : H[K] extends {
790
- below: Array<infer V>;
791
- } ? V extends TypedKey ? V : never : never;
792
- }[keyof H];
793
- type Above<TK extends TypedKey, H extends Hierarchy> = {
794
- [K in keyof H]: H[K] extends MutualFealty ? TK extends H[K][`below`] ? H[K][`above`] : never : H[K] extends {
795
- below: Array<infer V>;
796
- } ? TK extends V ? H[K] extends ExclusiveFealty ? H[K][`above`] : never : never : never;
797
- }[keyof H];
798
- type CompoundFrom<H extends Hierarchy> = {
799
- [K in keyof H]: H[K] extends MutualFealty ? H[K][`below`] : never;
800
- }[keyof H];
801
-
802
- /**
803
- * @public
804
- * A function that sets the value of a state.
805
- * @param oldValue - The current value of the state.
806
- * @returns
807
- * The new value of the state.
808
- */
809
- type Setter<T, New extends T> = (oldValue: T) => New;
810
- /**
811
- * @public
812
- * Set the value of a state into the implicit store.
813
- * @param token - An atom or writable selector token.
814
- * @param value - The new value of the state.
815
- * @overload Default
816
- * @default
817
- */
818
- declare function setState<T, New extends T>(token: WritableToken<T>, value: New | Setter<T, New>): void;
819
- /**
820
- * @public
821
- * Set the value of a state into the implicit store.
822
- * @param token - An atom family or writable selector family token.
823
- * @param key - The unique key of the state to set.
824
- * @param value - The new value of the state.
825
- * @overload Streamlined
826
- */
827
- 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;
828
-
829
- type StateUpdate<T> = {
830
- newValue: T;
831
- oldValue: T;
832
- };
833
- type KeyedStateUpdate<T> = Flat<StateUpdate<T> & {
834
- key: string;
835
- type: `atom_update` | `selector_update`;
836
- family?: FamilyMetadata;
837
- }>;
838
-
839
- type TokenType<Comparison extends ReadableFamilyToken<any, any> | ReadableToken<any>> = Comparison extends ReadableToken<infer RepresentedValue> ? RepresentedValue : Comparison extends ReadableFamilyToken<infer RepresentedValue, any> ? RepresentedValue : never;
840
-
841
- /** @public */
842
- type RegularAtomToken<T, K extends Canonical = any> = {
843
- /** The unique identifier of the atom. */
844
- key: string;
845
- /** Discriminator. */
846
- type: `atom`;
847
- /** Present if the atom belongs to a family. */
848
- family?: FamilyMetadata<K>;
849
- /** Never present. This is a marker that preserves the type of the atom's value. */
850
- __T?: T;
851
- };
852
- /** @public */
853
- type MutableAtomToken<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical = any> = {
854
- /** The unique identifier of the atom. */
855
- key: string;
856
- /** Discriminator. */
857
- type: `mutable_atom`;
858
- /** Present if the atom belongs to a family. */
859
- family?: FamilyMetadata<K>;
860
- /** Never present. This is a marker that preserves the JSON form of the atom's transceiver value. */
861
- __J?: J;
862
- /** Never present. This is a marker that preserves the type of the atom's transceiver value. */
863
- __U?: T extends Transceiver<infer Update> ? Update : never;
864
- };
865
- /** @public */
866
- type AtomToken<T, K extends Canonical = any> = MutableAtomToken<T extends Transceiver<any> ? T : never, any, K> | RegularAtomToken<T, K>;
867
- /** @public */
868
- type WritableSelectorToken<T, K extends Canonical = any> = {
869
- /** The unique identifier of the selector. */
870
- key: string;
871
- /** Discriminator. */
872
- type: `selector`;
873
- /** Present if the selector belongs to a family. */
874
- family?: FamilyMetadata<K>;
875
- /** Never present. This is a marker that preserves the type of the selector's value. */
876
- __T?: T;
877
- };
878
- /** @public */
879
- type ReadonlySelectorToken<T, K extends Canonical = any> = {
880
- /** The unique identifier of the selector. */
881
- key: string;
882
- /** Discriminator. */
883
- type: `readonly_selector`;
884
- /** Present if the selector belongs to a family. */
885
- family?: FamilyMetadata<K>;
886
- /** Never present. This is a marker that preserves the type of the selector's value. */
887
- __T?: T;
888
- };
889
- /** @public */
890
- type SelectorToken<T, K extends Canonical = any> = ReadonlySelectorToken<T, K> | WritableSelectorToken<T, K>;
891
- /**
892
- * @public
893
- * These states can be set.
894
- */
895
- type WritableToken<T, K extends Canonical = any> = AtomToken<T, K> | WritableSelectorToken<T, K>;
896
- /**
897
- * @public
898
- * These states cannot be set.
899
- */
900
- type ReadableToken<T, K extends Canonical = any> = AtomToken<T, K> | SelectorToken<T, K>;
901
- /**
902
- * @public
903
- * States belonging to this family can be set.
904
- */
905
- type WritableFamilyToken<T, K extends Canonical> = AtomFamilyToken<T, K> | WritableSelectorFamilyToken<T, K>;
906
- /**
907
- * @public
908
- * States belonging to this family cannot be set.
909
- */
910
- type ReadableFamilyToken<T, K extends Canonical> = AtomFamilyToken<T, K> | SelectorFamilyToken<T, K>;
911
- /**
912
- * @public
913
- * Identifies a state's connection to its family.
914
- */
915
- type FamilyMetadata<K extends Canonical = any> = {
916
- /** The family's unique key. */
917
- key: string;
918
- /** The family member's unique identifier, in the form of a string. */
919
- subKey: stringified<K>;
920
- };
921
-
922
- declare function dict<State, Key extends Canonical>(family: ReadonlySelectorFamilyToken<State, Key> | RegularAtomFamilyToken<State, Key> | WritableSelectorFamilyToken<State, Key>, index: ReadonlySelectorToken<Key[]> | RegularAtomToken<Key[]> | WritableSelectorToken<Key[]>, store?: Store): ReadonlySelectorToken<{
5
+ declare function dict<State, Key extends Canonical>(family: AtomIO.ReadonlySelectorFamilyToken<State, Key> | AtomIO.RegularAtomFamilyToken<State, Key> | AtomIO.WritableSelectorFamilyToken<State, Key>, index: AtomIO.ReadonlySelectorToken<Key[]> | AtomIO.RegularAtomToken<Key[]> | AtomIO.WritableSelectorToken<Key[]>, store?: Store): AtomIO.ReadonlySelectorToken<{
923
6
  [K in stringified<Key>]: State;
924
7
  }>;
925
8
 
@@ -930,9 +13,9 @@ declare function struct<Struct extends {
930
13
  default: Struct;
931
14
  }, store?: Store): [
932
15
  {
933
- [K in keyof Struct as `${Key}${Capitalize<K & string>}State`]: RegularAtomToken<Struct[K]>;
16
+ [K in keyof Struct as `${Key}${Capitalize<K & string>}State`]: AtomIO.RegularAtomToken<Struct[K]>;
934
17
  },
935
- ReadonlySelectorToken<Struct>
18
+ AtomIO.ReadonlySelectorToken<Struct>
936
19
  ];
937
20
 
938
21
  declare function structFamily<Struct extends object, Key extends string>(options: {
@@ -940,9 +23,9 @@ declare function structFamily<Struct extends object, Key extends string>(options
940
23
  default: Struct;
941
24
  }): [
942
25
  {
943
- [K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<K & string>}State`]: RegularAtomFamilyToken<Struct[K], string>;
26
+ [K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<K & string>}State`]: AtomIO.RegularAtomFamilyToken<Struct[K], string>;
944
27
  },
945
- ReadonlySelectorFamilyToken<Struct, string>
28
+ AtomIO.ReadonlySelectorFamilyToken<Struct, string>
946
29
  ];
947
30
 
948
31
  export { dict, struct, structFamily };