atom.io 0.14.0 → 0.14.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.
- package/data/dist/index.cjs +1473 -52
- package/data/dist/index.cjs.map +1 -1
- package/data/dist/index.d.cts +315 -16
- package/data/dist/index.js +10 -267
- package/data/dist/index.js.map +1 -1
- package/data/package.json +5 -5
- package/data/src/join.ts +3 -3
- package/dist/chunk-5VJ77LZE.js +176 -0
- package/dist/chunk-5VJ77LZE.js.map +1 -0
- package/dist/chunk-CK7GNCU5.js +309 -0
- package/dist/chunk-CK7GNCU5.js.map +1 -0
- package/dist/chunk-KW7RA7IM.js +67 -0
- package/dist/chunk-KW7RA7IM.js.map +1 -0
- package/dist/chunk-LFXB7Y6M.js +68 -0
- package/dist/chunk-LFXB7Y6M.js.map +1 -0
- package/dist/chunk-NYCVSXQB.js +181 -0
- package/dist/chunk-NYCVSXQB.js.map +1 -0
- package/dist/chunk-TE3ZSTQ6.js +2516 -0
- package/dist/chunk-TE3ZSTQ6.js.map +1 -0
- package/dist/index.cjs +2244 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +268 -21
- package/dist/index.js +1 -152
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/internal/dist/index.cjs +208 -79
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.cts +226 -27
- package/internal/dist/index.js +1 -2240
- package/internal/dist/index.js.map +1 -1
- package/internal/package.json +5 -5
- package/introspection/dist/index.cjs +1618 -46
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.d.cts +374 -4
- package/introspection/dist/index.js +2 -316
- package/introspection/dist/index.js.map +1 -1
- package/introspection/package.json +5 -5
- package/json/dist/index.cjs +1560 -8
- package/json/dist/index.cjs.map +1 -1
- package/json/dist/index.d.cts +371 -7
- package/json/dist/index.js +1 -76
- package/json/dist/index.js.map +1 -1
- package/json/package.json +5 -5
- package/package.json +5 -4
- package/react/dist/index.cjs +1604 -14
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.cts +375 -4
- package/react/dist/index.js +2 -68
- package/react/dist/index.js.map +1 -1
- package/react/package.json +5 -5
- package/react-devtools/dist/index.cjs +2268 -198
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.css +2 -2
- package/react-devtools/dist/index.d.cts +148 -24
- package/react-devtools/dist/index.js +57 -297
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/package.json +5 -5
- package/realtime-client/dist/index.cjs +1585 -35
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.cts +382 -12
- package/realtime-client/dist/index.js +2 -165
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/package.json +5 -5
- package/realtime-react/dist/index.cjs +1782 -35
- package/realtime-react/dist/index.cjs.map +1 -1
- package/realtime-react/dist/index.d.cts +49 -9
- package/realtime-react/dist/index.js +4 -66
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/package.json +5 -5
- package/realtime-server/dist/index.cjs +1604 -58
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.cts +391 -11
- package/realtime-server/dist/index.js +27 -21
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/package.json +6 -6
- package/realtime-testing/dist/index.cjs +2352 -16
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.d.cts +486 -3
- package/realtime-testing/dist/index.js +10 -31
- package/realtime-testing/dist/index.js.map +1 -1
- package/realtime-testing/package.json +5 -5
- package/transceivers/set-rtx/dist/index.cjs +31 -10
- package/transceivers/set-rtx/dist/index.cjs.map +1 -1
- package/transceivers/set-rtx/dist/index.d.cts +29 -3
- package/transceivers/set-rtx/dist/index.js +2 -3
- package/transceivers/set-rtx/dist/index.js.map +1 -1
- package/transceivers/set-rtx/package.json +6 -6
- package/data/dist/index.d.ts +0 -158
- package/data/dist/metafile-cjs.json +0 -1
- package/data/dist/metafile-esm.json +0 -1
- package/dist/index.d.ts +0 -243
- package/dist/metafile-esm.json +0 -1
- package/internal/dist/index.d.ts +0 -421
- package/internal/dist/metafile-cjs.json +0 -1
- package/internal/dist/metafile-esm.json +0 -1
- package/introspection/dist/index.d.ts +0 -24
- package/introspection/dist/metafile-cjs.json +0 -1
- package/introspection/dist/metafile-esm.json +0 -1
- package/json/dist/index.d.ts +0 -51
- package/json/dist/metafile-cjs.json +0 -1
- package/json/dist/metafile-esm.json +0 -1
- package/react/dist/index.d.ts +0 -23
- package/react/dist/metafile-cjs.json +0 -1
- package/react/dist/metafile-esm.json +0 -1
- package/react-devtools/dist/index.d.ts +0 -341
- package/react-devtools/dist/metafile-cjs.json +0 -1
- package/react-devtools/dist/metafile-esm.json +0 -1
- package/realtime-client/dist/index.d.ts +0 -22
- package/realtime-client/dist/metafile-cjs.json +0 -1
- package/realtime-client/dist/metafile-esm.json +0 -1
- package/realtime-react/dist/index.d.ts +0 -27
- package/realtime-react/dist/metafile-cjs.json +0 -1
- package/realtime-react/dist/metafile-esm.json +0 -1
- package/realtime-server/dist/index.d.ts +0 -25
- package/realtime-server/dist/metafile-cjs.json +0 -1
- package/realtime-server/dist/metafile-esm.json +0 -1
- package/realtime-testing/dist/index.d.ts +0 -49
- package/realtime-testing/dist/metafile-cjs.json +0 -1
- package/realtime-testing/dist/metafile-esm.json +0 -1
- package/transceivers/set-rtx/dist/index.d.ts +0 -40
- package/transceivers/set-rtx/dist/metafile-cjs.json +0 -1
- package/transceivers/set-rtx/dist/metafile-esm.json +0 -1
package/json/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import * as AtomIO from 'atom.io';
|
|
2
|
-
import { Store } from 'atom.io/internal';
|
|
3
|
-
|
|
4
1
|
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
5
2
|
toJson: (t: T) => J;
|
|
6
3
|
fromJson: (json: J) => T;
|
|
@@ -31,7 +28,7 @@ type Stringified<J extends Serializable> = string & {
|
|
|
31
28
|
__json: J;
|
|
32
29
|
};
|
|
33
30
|
declare const stringifyJson: <J extends Serializable>(json: J) => Stringified<J>;
|
|
34
|
-
type Empty = Record<string, never>;
|
|
31
|
+
type Empty$1 = Record<string, never>;
|
|
35
32
|
declare const JSON_TYPE_NAMES: readonly ["array", "boolean", "null", "number", "object", "string"];
|
|
36
33
|
type JsonTypeName = (typeof JSON_TYPE_NAMES)[number];
|
|
37
34
|
interface JsonTypes extends Record<JsonTypeName, Serializable> {
|
|
@@ -44,8 +41,375 @@ interface JsonTypes extends Record<JsonTypeName, Serializable> {
|
|
|
44
41
|
}
|
|
45
42
|
declare const JSON_DEFAULTS: JsonTypes;
|
|
46
43
|
|
|
47
|
-
declare
|
|
44
|
+
declare class Subject<T> {
|
|
45
|
+
Subscriber: (value: T) => void;
|
|
46
|
+
subscribers: Map<string, this[`Subscriber`]>;
|
|
47
|
+
subscribe(key: string, subscriber: this[`Subscriber`]): () => void;
|
|
48
|
+
private unsubscribe;
|
|
49
|
+
next(value: T): void;
|
|
50
|
+
}
|
|
51
|
+
declare class StatefulSubject<T> extends Subject<T> {
|
|
52
|
+
state: T;
|
|
53
|
+
constructor(initialState: T);
|
|
54
|
+
next(value: T): void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type Selector<T> = {
|
|
58
|
+
key: string;
|
|
59
|
+
type: `selector`;
|
|
60
|
+
family?: FamilyMetadata;
|
|
61
|
+
install: (store: Store) => void;
|
|
62
|
+
subject: Subject<{
|
|
63
|
+
newValue: T;
|
|
64
|
+
oldValue: T;
|
|
65
|
+
}>;
|
|
66
|
+
get: () => T;
|
|
67
|
+
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
68
|
+
};
|
|
69
|
+
type ReadonlySelector<T> = {
|
|
70
|
+
key: string;
|
|
71
|
+
type: `readonly_selector`;
|
|
72
|
+
family?: FamilyMetadata;
|
|
73
|
+
install: (store: Store) => void;
|
|
74
|
+
subject: Subject<{
|
|
75
|
+
newValue: T;
|
|
76
|
+
oldValue: T;
|
|
77
|
+
}>;
|
|
78
|
+
get: () => T;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
type Transaction<ƒ extends ƒn> = {
|
|
82
|
+
key: string;
|
|
83
|
+
type: `transaction`;
|
|
84
|
+
install: (store: Store) => void;
|
|
85
|
+
subject: Subject<TransactionUpdate<ƒ>>;
|
|
86
|
+
run: (...parameters: Parameters<ƒ>) => ReturnType<ƒ>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type TransactionMeta<ƒ extends ƒn> = {
|
|
90
|
+
phase: `applying` | `building`;
|
|
91
|
+
time: number;
|
|
92
|
+
update: TransactionUpdate<ƒ>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
type Refinement<Unrefined, Refined extends Unrefined> = (value: Unrefined) => value is Refined;
|
|
96
|
+
type Cardinality = `1:1` | `1:n` | `n:n`;
|
|
97
|
+
|
|
98
|
+
interface JunctionEntries<Content extends Object$1 | null> extends Object$1 {
|
|
99
|
+
readonly relations: [string, string[]][];
|
|
100
|
+
readonly contents: [string, Content][];
|
|
101
|
+
}
|
|
102
|
+
interface JunctionSchema<ASide extends string, BSide extends string> extends Object$1 {
|
|
103
|
+
readonly between: [a: ASide, b: BSide];
|
|
104
|
+
readonly cardinality: Cardinality;
|
|
105
|
+
}
|
|
106
|
+
type BaseExternalStoreConfiguration = {
|
|
107
|
+
addRelation: (a: string, b: string) => void;
|
|
108
|
+
deleteRelation: (a: string, b: string) => void;
|
|
109
|
+
replaceRelationsSafely: (a: string, bs: string[]) => void;
|
|
110
|
+
replaceRelationsUnsafely: (a: string, bs: string[]) => void;
|
|
111
|
+
getRelatedKeys: (key: string) => Set<string> | undefined;
|
|
112
|
+
has: (a: string, b?: string) => boolean;
|
|
113
|
+
};
|
|
114
|
+
type ExternalStoreWithContentConfiguration<Content extends Object$1> = {
|
|
115
|
+
getContent: (contentKey: string) => Content | undefined;
|
|
116
|
+
setContent: (contentKey: string, content: Content) => void;
|
|
117
|
+
deleteContent: (contentKey: string) => void;
|
|
118
|
+
};
|
|
119
|
+
type Empty<Obj extends object> = {
|
|
120
|
+
[Key in keyof Obj]?: undefined;
|
|
121
|
+
};
|
|
122
|
+
type ExternalStoreConfiguration<Content extends Object$1 | null> = Content extends Object$1 ? BaseExternalStoreConfiguration & ExternalStoreWithContentConfiguration<Content> : BaseExternalStoreConfiguration & Empty<ExternalStoreWithContentConfiguration<Object$1>>;
|
|
123
|
+
type JunctionAdvancedConfiguration<Content extends Object$1 | null> = {
|
|
124
|
+
externalStore?: ExternalStoreConfiguration<Content>;
|
|
125
|
+
isContent?: Refinement<unknown, Content>;
|
|
126
|
+
makeContentKey?: (a: string, b: string) => string;
|
|
127
|
+
};
|
|
128
|
+
type JunctionJSON<ASide extends string, BSide extends string, Content extends Object$1 | null> = JunctionEntries<Content> & JunctionSchema<ASide, BSide>;
|
|
129
|
+
declare class Junction<const ASide extends string, const BSide extends string, const Content extends Object$1 | null = null> {
|
|
130
|
+
readonly a: ASide;
|
|
131
|
+
readonly b: BSide;
|
|
132
|
+
readonly cardinality: Cardinality;
|
|
133
|
+
readonly relations: Map<string, Set<string>>;
|
|
134
|
+
readonly contents: Map<string, Content>;
|
|
135
|
+
isContent: Refinement<unknown, Content> | null;
|
|
136
|
+
makeContentKey: (a: string, b: string) => string;
|
|
137
|
+
getRelatedKeys(key: string): Set<string> | undefined;
|
|
138
|
+
protected addRelation(a: string, b: string): void;
|
|
139
|
+
protected deleteRelation(a: string, b: string): void;
|
|
140
|
+
protected replaceRelationsUnsafely(a: string, bs: string[]): void;
|
|
141
|
+
protected replaceRelationsSafely(a: string, bs: string[]): void;
|
|
142
|
+
protected getContentInternal(contentKey: string): Content | undefined;
|
|
143
|
+
protected setContent(contentKey: string, content: Content): void;
|
|
144
|
+
protected deleteContent(contentKey: string): void;
|
|
145
|
+
constructor(data: JunctionSchema<ASide, BSide> & Partial<JunctionEntries<Content>>, config?: JunctionAdvancedConfiguration<Content>);
|
|
146
|
+
toJSON(): JunctionJSON<ASide, BSide, Content>;
|
|
147
|
+
set(a: string, ...rest: Content extends null ? [b: string] : [b: string, content: Content]): this;
|
|
148
|
+
set(relation: {
|
|
149
|
+
[Key in ASide | BSide]: string;
|
|
150
|
+
}, ...rest: Content extends null ? [] | [b?: undefined] : [content: Content]): this;
|
|
151
|
+
delete(a: string, b?: string): this;
|
|
152
|
+
delete(relation: Record<ASide | BSide, string> | Record<ASide, string> | Record<BSide, string>, b?: undefined): this;
|
|
153
|
+
getRelatedKey(key: string): string | undefined;
|
|
154
|
+
replaceRelations(a: string, relations: Content extends null ? string[] : Record<string, Content>, config?: {
|
|
155
|
+
reckless: boolean;
|
|
156
|
+
}): this;
|
|
157
|
+
getContent(a: string, b: string): Content | undefined;
|
|
158
|
+
getRelationEntries(input: Record<ASide, string> | Record<BSide, string>): [string, Content][];
|
|
159
|
+
has(a: string, b?: string): boolean;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
interface Lineage {
|
|
163
|
+
parent: typeof this | null;
|
|
164
|
+
child: typeof this | null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface Transceiver<Signal extends Serializable> {
|
|
168
|
+
do: (update: Signal) => void;
|
|
169
|
+
undo: (update: Signal) => void;
|
|
170
|
+
subscribe: (key: string, fn: (update: Signal) => void) => () => void;
|
|
171
|
+
cacheUpdateNumber: number;
|
|
172
|
+
getUpdateNumber: (update: Signal) => number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @internal Give the tracker a transceiver state and a store, and it will
|
|
177
|
+
* subscribe to the transceiver's inner value. When the inner value changes,
|
|
178
|
+
* the tracker will update its own state to reflect the change.
|
|
179
|
+
*/
|
|
180
|
+
declare class Tracker<Mutable extends Transceiver<any>> {
|
|
181
|
+
private Update;
|
|
182
|
+
private initializeState;
|
|
183
|
+
private unsubscribeFromInnerValue;
|
|
184
|
+
private observeCore;
|
|
185
|
+
private updateCore;
|
|
186
|
+
mutableState: MutableAtomToken<Mutable, Serializable>;
|
|
187
|
+
latestUpdateState: AtomToken<typeof this.Update | null>;
|
|
188
|
+
constructor(mutableState: MutableAtomToken<Mutable, Serializable>, store: Store);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
interface MutableAtom<T> extends Atom<T> {
|
|
192
|
+
mutable: true;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
type OperationProgress = {
|
|
196
|
+
open: false;
|
|
197
|
+
} | {
|
|
198
|
+
open: true;
|
|
199
|
+
done: Set<string>;
|
|
200
|
+
prev: Map<string, any>;
|
|
201
|
+
time: number;
|
|
202
|
+
token: StateToken<any>;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
type TimelineAtomUpdate = StateUpdate<unknown> & {
|
|
206
|
+
key: string;
|
|
207
|
+
type: `atom_update`;
|
|
208
|
+
timestamp: number;
|
|
209
|
+
family?: FamilyMetadata;
|
|
210
|
+
};
|
|
211
|
+
type TimelineSelectorUpdate = {
|
|
212
|
+
key: string;
|
|
213
|
+
type: `selector_update`;
|
|
214
|
+
timestamp: number;
|
|
215
|
+
atomUpdates: Omit<TimelineAtomUpdate, `timestamp`>[];
|
|
216
|
+
};
|
|
217
|
+
type TimelineTransactionUpdate = TransactionUpdate<ƒn> & {
|
|
218
|
+
key: string;
|
|
219
|
+
type: `transaction_update`;
|
|
220
|
+
timestamp: number;
|
|
221
|
+
};
|
|
222
|
+
type Timeline = {
|
|
223
|
+
type: `timeline`;
|
|
224
|
+
key: string;
|
|
225
|
+
at: number;
|
|
226
|
+
shouldCapture?: (update: TimelineUpdate, timeline: Timeline) => boolean;
|
|
227
|
+
timeTraveling: `into_future` | `into_past` | null;
|
|
228
|
+
history: TimelineUpdate[];
|
|
229
|
+
selectorTime: number | null;
|
|
230
|
+
transactionKey: string | null;
|
|
231
|
+
install: (store: Store) => void;
|
|
232
|
+
subject: Subject<TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate | `redo` | `undo`>;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
declare class Store implements Lineage {
|
|
236
|
+
parent: Store | null;
|
|
237
|
+
child: Store | null;
|
|
238
|
+
valueMap: Map<string, any>;
|
|
239
|
+
atoms: Map<string, Atom<any> | MutableAtom<any>>;
|
|
240
|
+
selectors: Map<string, Selector<any>>;
|
|
241
|
+
readonlySelectors: Map<string, ReadonlySelector<any>>;
|
|
242
|
+
trackers: Map<string, Tracker<Transceiver<any>>>;
|
|
243
|
+
families: Map<string, AtomFamily<any, any> | ReadonlySelectorFamily<any, any> | SelectorFamily<any, any>>;
|
|
244
|
+
timelines: Map<string, Timeline>;
|
|
245
|
+
transactions: Map<string, Transaction<ƒn>>;
|
|
246
|
+
atomsThatAreDefault: Set<string>;
|
|
247
|
+
timelineAtoms: Junction<"timelineKey", "atomKey", null>;
|
|
248
|
+
selectorAtoms: Junction<"selectorKey", "atomKey", null>;
|
|
249
|
+
selectorGraph: Junction<"upstreamSelectorKey", "downstreamSelectorKey", {
|
|
250
|
+
source: string;
|
|
251
|
+
}>;
|
|
252
|
+
subject: {
|
|
253
|
+
atomCreation: Subject<AtomToken<unknown>>;
|
|
254
|
+
selectorCreation: Subject<ReadonlySelectorToken<unknown> | SelectorToken<unknown>>;
|
|
255
|
+
transactionCreation: Subject<TransactionToken<ƒn>>;
|
|
256
|
+
timelineCreation: Subject<TimelineToken>;
|
|
257
|
+
transactionApplying: StatefulSubject<TransactionMeta<ƒn> | null>;
|
|
258
|
+
operationStatus: Subject<OperationProgress>;
|
|
259
|
+
};
|
|
260
|
+
operation: OperationProgress;
|
|
261
|
+
transactionMeta: TransactionMeta<ƒn> | null;
|
|
262
|
+
config: {
|
|
263
|
+
name: string;
|
|
264
|
+
};
|
|
265
|
+
loggers: AtomIOLogger[];
|
|
266
|
+
logger: Logger;
|
|
267
|
+
constructor(name: string, store?: Store | null);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
type Atom<T> = {
|
|
271
|
+
key: string;
|
|
272
|
+
type: `atom`;
|
|
273
|
+
family?: FamilyMetadata;
|
|
274
|
+
install: (store: Store) => void;
|
|
275
|
+
subject: Subject<{
|
|
276
|
+
newValue: T;
|
|
277
|
+
oldValue: T;
|
|
278
|
+
}>;
|
|
279
|
+
default: T | (() => T);
|
|
280
|
+
cleanup?: () => void;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
type AtomFamily<T, K extends Serializable = Serializable> = ((key: K) => AtomToken<T>) & {
|
|
284
|
+
key: string;
|
|
285
|
+
type: `atom_family`;
|
|
286
|
+
subject: Subject<AtomToken<T>>;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
declare const LoggerIconDictionary: {
|
|
290
|
+
readonly "\u231B": "Timeline event fully captured";
|
|
291
|
+
readonly "\u23E9": "Timeline redo";
|
|
292
|
+
readonly "\u23EA": "Timeline undo";
|
|
293
|
+
readonly "\u23ED\uFE0F": "Transaction redo";
|
|
294
|
+
readonly "\u23EE\uFE0F": "Transaction undo";
|
|
295
|
+
readonly "\u23F3": "Timeline event partially captured";
|
|
296
|
+
readonly "\u23F9\uFE0F": "Time-travel complete";
|
|
297
|
+
readonly "\uD83D\uDC81": "Notice";
|
|
298
|
+
readonly "\uD83D\uDD04": "Realtime transaction synchronized";
|
|
299
|
+
readonly "\u2705": "Realtime transaction success";
|
|
300
|
+
readonly "\u2728": "Computation complete";
|
|
301
|
+
readonly "\u274C": "Conflict prevents attempted action";
|
|
302
|
+
readonly "\u2B55": "Operation start";
|
|
303
|
+
readonly "\uD83D\uDC1E": "Possible bug in AtomIO";
|
|
304
|
+
readonly "\uD83D\uDC40": "Subscription added";
|
|
305
|
+
readonly "\uD83D\uDC6A": "Family member added";
|
|
306
|
+
readonly "\uD83D\uDCC1": "Stow update";
|
|
307
|
+
readonly "\uD83D\uDCC3": "Copy mutable";
|
|
308
|
+
readonly "\uD83D\uDCD6": "Read state";
|
|
309
|
+
readonly "\uD83D\uDCDD": "Write state";
|
|
310
|
+
readonly "\uD83D\uDCE2": "Notify subscribers";
|
|
311
|
+
readonly "\uD83D\uDD0C": "Register dependency";
|
|
312
|
+
readonly "\uD83D\uDD0D": "Discover root";
|
|
313
|
+
readonly "\uD83D\uDD25": "Delete state";
|
|
314
|
+
readonly "\uD83D\uDD27": "Create mutable atom";
|
|
315
|
+
readonly "\uD83D\uDD28": "Create immutable atom";
|
|
316
|
+
readonly "\uD83D\uDD34": "Operation complete";
|
|
317
|
+
readonly "\uD83D\uDDD1": "Evict cached value";
|
|
318
|
+
readonly "\uD83D\uDCA5": "Caught";
|
|
319
|
+
readonly "\uD83D\uDE48": "Subscription canceled";
|
|
320
|
+
readonly "\uD83D\uDEC4": "Apply transaction";
|
|
321
|
+
readonly "\uD83D\uDEE0\uFE0F": "Install atom into store";
|
|
322
|
+
readonly "\uD83D\uDEEB": "Begin transaction";
|
|
323
|
+
readonly "\uD83D\uDEEC": "Complete transaction";
|
|
324
|
+
readonly "\uD83E\uDDEE": "Computing selector";
|
|
325
|
+
readonly "\uD83E\uDDF9": "Prepare to evict";
|
|
326
|
+
readonly "\uD83E\uDE82": "Abort transaction";
|
|
327
|
+
};
|
|
328
|
+
type LoggerIcon = keyof typeof LoggerIconDictionary;
|
|
329
|
+
declare const LOG_LEVELS: readonly ["info", "warn", "error"];
|
|
330
|
+
type LogLevel = (typeof LOG_LEVELS)[number];
|
|
331
|
+
type LogFn = (icon: LoggerIcon, tokenType: `atom` | `readonly_selector` | `selector` | `state` | `timeline` | `transaction` | `unknown`, tokenKey: string, message: string, ...rest: unknown[]) => void;
|
|
332
|
+
type LogFilter = (...params: Parameters<LogFn>) => boolean;
|
|
333
|
+
type Logger = Record<LogLevel, LogFn>;
|
|
334
|
+
declare class AtomIOLogger implements Logger {
|
|
335
|
+
logLevel: `error` | `info` | `warn` | null;
|
|
336
|
+
private readonly filter?;
|
|
337
|
+
private readonly logger;
|
|
338
|
+
constructor(logLevel: `error` | `info` | `warn` | null, filter?: LogFilter | undefined, logger?: Logger);
|
|
339
|
+
error: LogFn;
|
|
340
|
+
info: LogFn;
|
|
341
|
+
warn: LogFn;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
type TransactionToken<_> = {
|
|
345
|
+
key: string;
|
|
346
|
+
type: `transaction`;
|
|
347
|
+
__brand?: _;
|
|
348
|
+
};
|
|
349
|
+
type TransactionUpdate<ƒ extends ƒn> = {
|
|
350
|
+
key: string;
|
|
351
|
+
updates: (KeyedStateUpdate<unknown> | TransactionUpdate<ƒn>)[];
|
|
352
|
+
params: Parameters<ƒ>;
|
|
353
|
+
output: ReturnType<ƒ>;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
type SelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => SelectorToken<T>) & {
|
|
357
|
+
key: string;
|
|
358
|
+
type: `selector_family`;
|
|
359
|
+
subject: Subject<SelectorToken<T>>;
|
|
360
|
+
};
|
|
361
|
+
type ReadonlySelectorFamily<T, K extends Serializable = Serializable> = ((key: K) => ReadonlySelectorToken<T>) & {
|
|
362
|
+
key: string;
|
|
363
|
+
type: `readonly_selector_family`;
|
|
364
|
+
subject: Subject<ReadonlySelectorToken<T>>;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
type StateUpdate<T> = {
|
|
368
|
+
newValue: T;
|
|
369
|
+
oldValue: T;
|
|
370
|
+
};
|
|
371
|
+
type KeyedStateUpdate<T> = StateUpdate<T> & {
|
|
372
|
+
key: string;
|
|
373
|
+
family?: FamilyMetadata;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
type TimelineToken = {
|
|
377
|
+
key: string;
|
|
378
|
+
type: `timeline`;
|
|
379
|
+
};
|
|
380
|
+
type TimelineUpdate = TimelineAtomUpdate | TimelineSelectorUpdate | TimelineTransactionUpdate;
|
|
381
|
+
|
|
382
|
+
type ƒn = (...parameters: any[]) => any;
|
|
383
|
+
type AtomToken<_> = {
|
|
384
|
+
key: string;
|
|
385
|
+
type: `atom`;
|
|
386
|
+
family?: FamilyMetadata;
|
|
387
|
+
__brand?: _;
|
|
388
|
+
};
|
|
389
|
+
interface MutableAtomToken<T extends Transceiver<any>, J extends Serializable> extends AtomToken<T> {
|
|
390
|
+
__asJSON?: J;
|
|
391
|
+
__update?: T extends Transceiver<infer Update> ? Update : never;
|
|
392
|
+
}
|
|
393
|
+
type SelectorToken<_> = {
|
|
394
|
+
key: string;
|
|
395
|
+
type: `selector`;
|
|
396
|
+
family?: FamilyMetadata;
|
|
397
|
+
__brand?: _;
|
|
398
|
+
};
|
|
399
|
+
type StateToken<T> = AtomToken<T> | SelectorToken<T>;
|
|
400
|
+
type ReadonlySelectorToken<_> = {
|
|
401
|
+
key: string;
|
|
402
|
+
type: `readonly_selector`;
|
|
403
|
+
family?: FamilyMetadata;
|
|
404
|
+
__brand?: _;
|
|
405
|
+
};
|
|
406
|
+
type FamilyMetadata = {
|
|
407
|
+
key: string;
|
|
408
|
+
subKey: string;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
declare const selectJson: <T, J extends Serializable>(atom: AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => SelectorToken<J>;
|
|
48
412
|
|
|
49
|
-
declare const selectJsonFamily: <T, J extends Serializable, K extends Serializable>(atomFamily:
|
|
413
|
+
declare const selectJsonFamily: <T, J extends Serializable, K extends Serializable>(atomFamily: AtomFamily<T, K>, transform: JsonInterface<T, J>, store?: Store) => SelectorFamily<J, K>;
|
|
50
414
|
|
|
51
|
-
export { type Empty, JSON_DEFAULTS, JSON_TYPE_NAMES, json as Json, type JsonInterface, type JsonTypeName, type JsonTypes, type Stringified, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, type primitive, selectJson, selectJsonFamily, stringSetJsonInterface, stringifyJson };
|
|
415
|
+
export { type Empty$1 as Empty, JSON_DEFAULTS, JSON_TYPE_NAMES, json as Json, type JsonInterface, type JsonTypeName, type JsonTypes, type Stringified, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, type primitive, selectJson, selectJsonFamily, stringSetJsonInterface, stringifyJson };
|
package/json/dist/index.js
CHANGED
|
@@ -1,78 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// ../../anvl/src/json/json-interface.ts
|
|
4
|
-
var stringSetJsonInterface = {
|
|
5
|
-
toJson: (stringSet) => Array.from(stringSet),
|
|
6
|
-
fromJson: (json) => new Set(json)
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// ../../anvl/src/json/index.ts
|
|
10
|
-
var parseJson = (str) => JSON.parse(str);
|
|
11
|
-
var stringifyJson = (json) => JSON.stringify(json);
|
|
12
|
-
var JSON_TYPE_NAMES = [
|
|
13
|
-
`array`,
|
|
14
|
-
`boolean`,
|
|
15
|
-
`null`,
|
|
16
|
-
`number`,
|
|
17
|
-
`object`,
|
|
18
|
-
`string`
|
|
19
|
-
];
|
|
20
|
-
var JSON_DEFAULTS = {
|
|
21
|
-
array: [],
|
|
22
|
-
boolean: false,
|
|
23
|
-
null: null,
|
|
24
|
-
number: 0,
|
|
25
|
-
object: {},
|
|
26
|
-
string: ``
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// ../../anvl/src/primitive/index.ts
|
|
30
|
-
var isString = (input) => {
|
|
31
|
-
return typeof input === `string`;
|
|
32
|
-
};
|
|
33
|
-
var isNumber = (input) => {
|
|
34
|
-
return typeof input === `number`;
|
|
35
|
-
};
|
|
36
|
-
var isBoolean = (input) => {
|
|
37
|
-
return typeof input === `boolean`;
|
|
38
|
-
};
|
|
39
|
-
var isNull = (input) => {
|
|
40
|
-
return input === null;
|
|
41
|
-
};
|
|
42
|
-
var isPrimitive = (input) => {
|
|
43
|
-
return isString(input) || isNumber(input) || isBoolean(input) || isNull(input);
|
|
44
|
-
};
|
|
45
|
-
var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
46
|
-
return createSelector(
|
|
47
|
-
{
|
|
48
|
-
key: `${atom.key}:JSON`,
|
|
49
|
-
get: ({ get }) => transform.toJson(get(atom)),
|
|
50
|
-
set: ({ set }, newValue) => set(atom, transform.fromJson(newValue))
|
|
51
|
-
},
|
|
52
|
-
void 0,
|
|
53
|
-
store
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
var selectJsonFamily = (atomFamily, transform, store = IMPLICIT.STORE) => {
|
|
57
|
-
const jsonFamily = createSelectorFamily(
|
|
58
|
-
{
|
|
59
|
-
key: `${atomFamily.key}:JSON`,
|
|
60
|
-
get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
|
|
61
|
-
set: (key) => ({ set }, newValue) => set(atomFamily(key), transform.fromJson(newValue))
|
|
62
|
-
},
|
|
63
|
-
store
|
|
64
|
-
);
|
|
65
|
-
atomFamily.subject.subscribe(
|
|
66
|
-
`store=${store.config.name}::json-selector-family`,
|
|
67
|
-
(token) => {
|
|
68
|
-
if (token.family) {
|
|
69
|
-
jsonFamily(parseJson(token.family.subKey));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
return jsonFamily;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, selectJson, selectJsonFamily, stringSetJsonInterface, stringifyJson };
|
|
1
|
+
export { JSON_DEFAULTS, JSON_TYPE_NAMES, isBoolean, isNull, isNumber, isPrimitive, isString, parseJson, selectJson, selectJsonFamily, stringSetJsonInterface, stringifyJson } from '../../dist/chunk-TE3ZSTQ6.js';
|
|
77
2
|
//# sourceMappingURL=out.js.map
|
|
78
3
|
//# sourceMappingURL=index.js.map
|
package/json/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/json/package.json
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"name": "atom.io-json",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"private": true,
|
|
5
|
-
"main": "dist/index.
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
7
6
|
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"browser": "./dist/index.js",
|
|
12
10
|
"import": "./dist/index.js",
|
|
13
|
-
"
|
|
11
|
+
"browser": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@testing-library/react": "14.1.2",
|
|
53
53
|
"@types/http-proxy": "1.17.14",
|
|
54
54
|
"@types/npmlog": "7.0.0",
|
|
55
|
-
"@types/react": "18.2.
|
|
55
|
+
"@types/react": "18.2.43",
|
|
56
56
|
"@types/tmp": "0.2.6",
|
|
57
|
-
"@vitest/coverage-v8": "1.0.
|
|
57
|
+
"@vitest/coverage-v8": "1.0.4",
|
|
58
58
|
"concurrently": "8.2.2",
|
|
59
59
|
"drizzle-kit": "0.20.6",
|
|
60
60
|
"drizzle-orm": "0.29.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"typescript": "5.3.3",
|
|
76
76
|
"vite": "5.0.7",
|
|
77
77
|
"vite-tsconfig-paths": "4.2.2",
|
|
78
|
-
"vitest": "1.0.
|
|
78
|
+
"vitest": "1.0.4"
|
|
79
79
|
},
|
|
80
80
|
"main": "dist/index.js",
|
|
81
81
|
"types": "dist/index.d.ts",
|
|
@@ -207,6 +207,7 @@
|
|
|
207
207
|
"manifest": "tsx __scripts__/manifest-build.node",
|
|
208
208
|
"build": "concurrently \"npm:build:*\"",
|
|
209
209
|
"build:main": "tsup",
|
|
210
|
+
"build:types": "tsup --dts",
|
|
210
211
|
"build:data": "cd data && tsup",
|
|
211
212
|
"build:internal": "cd internal && tsup",
|
|
212
213
|
"build:introspection": "cd introspection && tsup",
|