atom.io 0.27.5 → 0.28.0
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.d.ts +31 -29
- package/data/dist/index.js +16 -17
- package/data/src/join.ts +17 -19
- package/dist/{chunk-6ABWLAGY.js → chunk-BX3MTH2Z.js} +320 -249
- package/dist/chunk-D52JNVER.js +721 -0
- package/dist/chunk-EUVKUTW3.js +89 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/internal/dist/index.d.ts +72 -36
- package/internal/dist/index.js +1 -1
- package/internal/src/atom/dispose-atom.ts +2 -9
- package/internal/src/families/dispose-from-store.ts +35 -18
- package/internal/src/families/find-in-store.ts +17 -7
- package/internal/src/get-state/get-from-store.ts +41 -32
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +10 -1
- package/internal/src/molecule/dispose-molecule.ts +6 -17
- package/internal/src/pretty-print.ts +1 -16
- package/internal/src/selector/dispose-selector.ts +2 -9
- package/internal/src/set-state/set-into-store.ts +17 -19
- package/internal/src/store/circular-buffer.ts +34 -0
- package/internal/src/store/counterfeit.ts +109 -0
- package/internal/src/store/deposit.ts +14 -0
- package/internal/src/store/index.ts +1 -0
- package/internal/src/store/store.ts +3 -0
- package/internal/src/store/withdraw.ts +15 -10
- package/internal/src/transaction/build-transaction.ts +1 -0
- package/introspection/dist/index.d.ts +84 -4
- package/introspection/dist/index.js +1 -392
- package/introspection/src/attach-introspection-states.ts +7 -4
- package/introspection/src/attach-type-selectors.ts +26 -0
- package/introspection/src/differ.ts +167 -0
- package/introspection/src/index.ts +2 -0
- package/introspection/src/refinery.ts +100 -0
- package/json/dist/index.d.ts +31 -30
- package/json/dist/index.js +2 -77
- package/json/src/entries.ts +6 -0
- package/json/src/index.ts +47 -6
- package/package.json +17 -8
- package/react-devtools/dist/index.d.ts +1 -91
- package/react-devtools/dist/index.js +285 -414
- package/react-devtools/src/AtomIODevtools.tsx +2 -2
- package/react-devtools/src/StateEditor.tsx +20 -12
- package/react-devtools/src/StateIndex.tsx +8 -26
- package/react-devtools/src/TimelineIndex.tsx +3 -3
- package/react-devtools/src/TransactionIndex.tsx +6 -6
- package/react-devtools/src/Updates.tsx +1 -4
- package/react-devtools/src/index.ts +0 -71
- package/react-devtools/src/store.ts +51 -0
- package/realtime/dist/index.d.ts +7 -7
- package/realtime/dist/index.js +18 -22
- package/realtime/src/realtime-continuity.ts +27 -35
- package/realtime-client/dist/index.js +24 -10
- package/realtime-client/src/realtime-client-stores/client-main-store.ts +6 -6
- package/realtime-client/src/sync-continuity.ts +28 -6
- package/realtime-server/dist/index.js +41 -5
- package/realtime-server/src/realtime-continuity-synchronizer.ts +42 -78
- package/realtime-testing/dist/index.d.ts +2 -0
- package/realtime-testing/dist/index.js +50 -8
- package/realtime-testing/src/setup-realtime-test.tsx +59 -9
- package/src/silo.ts +7 -3
- package/web/dist/index.d.ts +9 -0
- package/{dist/chunk-H6EDLPKH.js → web/dist/index.js} +5 -4
- package/web/package.json +13 -0
- package/web/src/index.ts +1 -0
- package/web/src/persist-sync.ts +25 -0
- package/dist/chunk-AK23DRMD.js +0 -21
- package/dist/chunk-IW6WYRS7.js +0 -140
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Flat } from "atom.io/internal"
|
|
2
|
+
import type { Json } from "atom.io/json"
|
|
3
|
+
|
|
4
|
+
export type Refinement<A, B extends A> = (a: A) => a is B
|
|
5
|
+
|
|
6
|
+
export type ClassSignature = abstract new (...args: any) => any
|
|
7
|
+
|
|
8
|
+
export type RefinementStrategy = ClassSignature | Refinement<unknown, any>
|
|
9
|
+
|
|
10
|
+
export type Supported<Refine extends RefinementStrategy> =
|
|
11
|
+
Refine extends Refinement<unknown, infer T>
|
|
12
|
+
? T
|
|
13
|
+
: Refine extends ClassSignature
|
|
14
|
+
? InstanceType<Refine>
|
|
15
|
+
: never
|
|
16
|
+
|
|
17
|
+
export type RefinementSupport = Record<string, RefinementStrategy>
|
|
18
|
+
|
|
19
|
+
export class Refinery<SupportedTypes extends RefinementSupport> {
|
|
20
|
+
public supported: SupportedTypes
|
|
21
|
+
|
|
22
|
+
public constructor(supported: SupportedTypes) {
|
|
23
|
+
this.supported = supported
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public refine<T>(input: T):
|
|
27
|
+
| Flat<{
|
|
28
|
+
[K in keyof SupportedTypes]: T extends Supported<SupportedTypes[K]>
|
|
29
|
+
? {
|
|
30
|
+
type: K
|
|
31
|
+
data: Supported<SupportedTypes[K]>
|
|
32
|
+
}
|
|
33
|
+
: Supported<SupportedTypes[K]> extends T
|
|
34
|
+
? {
|
|
35
|
+
type: K
|
|
36
|
+
data: Supported<SupportedTypes[K]>
|
|
37
|
+
}
|
|
38
|
+
: never
|
|
39
|
+
}>[keyof SupportedTypes]
|
|
40
|
+
| (T extends Supported<SupportedTypes[keyof SupportedTypes]>
|
|
41
|
+
? never
|
|
42
|
+
: null) {
|
|
43
|
+
for (const [key, refiner] of Object.entries(this.supported)) {
|
|
44
|
+
try {
|
|
45
|
+
if (
|
|
46
|
+
// @ts-expect-error that's the point
|
|
47
|
+
refiner(input) === true &&
|
|
48
|
+
refiner !== Boolean
|
|
49
|
+
) {
|
|
50
|
+
return { type: key, data: input } as any
|
|
51
|
+
}
|
|
52
|
+
} catch (_) {
|
|
53
|
+
try {
|
|
54
|
+
if (input instanceof refiner) {
|
|
55
|
+
return { type: key, data: input } as any
|
|
56
|
+
}
|
|
57
|
+
} catch (__) {}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null as any
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const primitiveRefinery = new Refinery({
|
|
65
|
+
number: (input: unknown): input is number => typeof input === `number`,
|
|
66
|
+
string: (input: unknown): input is string => typeof input === `string`,
|
|
67
|
+
boolean: (input: unknown): input is boolean => typeof input === `boolean`,
|
|
68
|
+
null: (input: unknown): input is null => input === null,
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
export const jsonTreeRefinery = new Refinery({
|
|
72
|
+
object: (input: unknown): input is Json.Tree.Object => {
|
|
73
|
+
if (!input) {
|
|
74
|
+
return false
|
|
75
|
+
}
|
|
76
|
+
const prototype = Object.getPrototypeOf(input)
|
|
77
|
+
return prototype === Object.prototype
|
|
78
|
+
},
|
|
79
|
+
array: (input: unknown): input is Json.Tree.Array => Array.isArray(input),
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
export const jsonRefinery = new Refinery({
|
|
83
|
+
...primitiveRefinery.supported,
|
|
84
|
+
...jsonTreeRefinery.supported,
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export type JsonType = keyof typeof jsonRefinery.supported
|
|
88
|
+
|
|
89
|
+
export const discoverType = (
|
|
90
|
+
input: unknown,
|
|
91
|
+
): JsonType | `Map` | `Set` | `undefined` | (string & {}) => {
|
|
92
|
+
if (input === undefined) {
|
|
93
|
+
return `undefined`
|
|
94
|
+
}
|
|
95
|
+
const refined = jsonRefinery.refine(input)
|
|
96
|
+
if (refined) {
|
|
97
|
+
return refined.type
|
|
98
|
+
}
|
|
99
|
+
return Object.getPrototypeOf(input).constructor.name
|
|
100
|
+
}
|
package/json/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { Range, Flat, Store, Transceiver } from 'atom.io/internal';
|
|
2
2
|
import * as AtomIO from 'atom.io';
|
|
3
3
|
|
|
4
|
-
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
5
|
-
toJson: (t: T) => J;
|
|
6
|
-
fromJson: (json: J) => T;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type primitive = boolean | number | string | null;
|
|
10
|
-
|
|
11
|
-
type Serializable = primitive | Readonly<{
|
|
12
|
-
[key: string]: Serializable;
|
|
13
|
-
}> | ReadonlyArray<Serializable>;
|
|
14
|
-
type Object$1<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
15
|
-
type Array<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
|
|
16
|
-
|
|
17
|
-
type json_Array<Element extends Serializable = Serializable> = Array<Element>;
|
|
18
|
-
type json_Serializable = Serializable;
|
|
19
|
-
declare namespace json {
|
|
20
|
-
export type { json_Array as Array, Object$1 as Object, json_Serializable as Serializable };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare const parseJson: <S extends stringified<Serializable>>(str: S | string) => S extends stringified<infer J> ? J : Serializable;
|
|
24
|
-
type stringified<J extends Serializable> = string & {
|
|
25
|
-
__json: J;
|
|
26
|
-
};
|
|
27
|
-
declare const stringifyJson: <J extends Serializable>(json: J) => stringified<J>;
|
|
28
|
-
|
|
29
4
|
type Entries<K extends keyof any = keyof any, V = any> = [K, V][];
|
|
30
5
|
type KeyOfEntries<E extends Entries> = E extends [infer K, any][] ? K : never;
|
|
31
6
|
type ValueOfEntry<E extends Entries, K extends KeyOfEntries<E>> = {
|
|
@@ -35,13 +10,39 @@ type FromEntries<E extends Entries> = Flat<{
|
|
|
35
10
|
[K in KeyOfEntries<E>]: ValueOfEntry<E, K>;
|
|
36
11
|
}>;
|
|
37
12
|
declare function fromEntries<E extends Entries>(entries: E): FromEntries<E>;
|
|
13
|
+
declare function toEntries<T extends object>(obj: T): Entries<keyof T, T[keyof T]>;
|
|
38
14
|
|
|
39
|
-
declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
|
|
15
|
+
declare const selectJson: <T, J extends Json.Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
|
|
40
16
|
|
|
41
|
-
declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Canonical>(atomFamilyToken: AtomIO.MutableAtomFamilyToken<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamilyToken<J, K>;
|
|
42
|
-
declare function selectJsonFamily<T, J extends Serializable, K extends Canonical>(atomFamilyToken: AtomIO.RegularAtomFamilyToken<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamilyToken<J, K>;
|
|
17
|
+
declare function selectJsonFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical>(atomFamilyToken: AtomIO.MutableAtomFamilyToken<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamilyToken<J, K>;
|
|
18
|
+
declare function selectJsonFamily<T, J extends Json.Serializable, K extends Canonical>(atomFamilyToken: AtomIO.RegularAtomFamilyToken<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamilyToken<J, K>;
|
|
43
19
|
|
|
20
|
+
type primitive = boolean | number | string | null;
|
|
21
|
+
declare namespace Json {
|
|
22
|
+
namespace Tree {
|
|
23
|
+
type Array<Element = unknown> = ReadonlyArray<Element>;
|
|
24
|
+
type Object<K extends string = string, V = unknown> = Record<K, V>;
|
|
25
|
+
type Fork = Array | Object;
|
|
26
|
+
type Leaf = primitive;
|
|
27
|
+
type Node = Fork | Leaf;
|
|
28
|
+
}
|
|
29
|
+
type Serializable = primitive | Readonly<{
|
|
30
|
+
[key: string]: Serializable;
|
|
31
|
+
}> | ReadonlyArray<Serializable>;
|
|
32
|
+
type Object<Key extends string = string, Value extends Serializable = Serializable> = Record<Key, Value>;
|
|
33
|
+
type Array<Element extends Serializable = Serializable> = ReadonlyArray<Element>;
|
|
34
|
+
}
|
|
35
|
+
type stringified<J extends Json.Serializable> = string & {
|
|
36
|
+
__json: J;
|
|
37
|
+
};
|
|
38
|
+
declare const parseJson: <S extends stringified<Json.Serializable>>(str: S | string) => S extends stringified<infer J> ? J : Json.Serializable;
|
|
39
|
+
declare const stringifyJson: <J extends Json.Serializable>(json: J) => stringified<J>;
|
|
44
40
|
type Canonical = primitive | ReadonlyArray<Canonical>;
|
|
45
|
-
type JsonIO = (...params: Serializable[]) => Serializable | void;
|
|
41
|
+
type JsonIO = (...params: Json.Serializable[]) => Json.Serializable | void;
|
|
42
|
+
type JsonInterface<T, J extends Json.Serializable = Json.Serializable> = {
|
|
43
|
+
toJson: (t: T) => J;
|
|
44
|
+
fromJson: (json: J) => T;
|
|
45
|
+
};
|
|
46
|
+
declare const isJson: (input: unknown) => input is Json.Tree.Node;
|
|
46
47
|
|
|
47
|
-
export { type Canonical, type Entries, type FromEntries,
|
|
48
|
+
export { type Canonical, type Entries, type FromEntries, Json, type JsonIO, type JsonInterface, type KeyOfEntries, type ValueOfEntry, fromEntries, isJson, parseJson, type primitive, selectJson, selectJsonFamily, type stringified, stringifyJson, toEntries };
|
package/json/dist/index.js
CHANGED
|
@@ -1,79 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { createWritableSelectorFamily } from '../../dist/chunk-6ABWLAGY.js';
|
|
1
|
+
export { fromEntries, isJson, parseJson, selectJson, selectJsonFamily, stringifyJson, toEntries } from '../../dist/chunk-EUVKUTW3.js';
|
|
2
|
+
import '../../dist/chunk-BX3MTH2Z.js';
|
|
4
3
|
import '../../dist/chunk-IBTHB2PI.js';
|
|
5
4
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
6
|
-
import { createStandaloneSelector, IMPLICIT, growMoleculeInStore, initFamilyMemberInStore, withdraw, seekInStore } from 'atom.io/internal';
|
|
7
|
-
|
|
8
|
-
// json/src/entries.ts
|
|
9
|
-
function fromEntries(entries) {
|
|
10
|
-
return Object.fromEntries(entries);
|
|
11
|
-
}
|
|
12
|
-
var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
13
|
-
return createStandaloneSelector(store, {
|
|
14
|
-
key: `${atom.key}:JSON`,
|
|
15
|
-
get: ({ get }) => transform.toJson(get(atom)),
|
|
16
|
-
set: ({ set }, newValue) => {
|
|
17
|
-
set(atom, transform.fromJson(newValue));
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
function selectJsonFamily(atomFamilyToken, transform, store = IMPLICIT.STORE) {
|
|
22
|
-
const jsonFamily = createWritableSelectorFamily(
|
|
23
|
-
store,
|
|
24
|
-
{
|
|
25
|
-
key: `${atomFamilyToken.key}:JSON`,
|
|
26
|
-
get: (key) => ({ seek, get }) => {
|
|
27
|
-
const existingState = seek(atomFamilyToken, key);
|
|
28
|
-
if (existingState) {
|
|
29
|
-
return transform.toJson(get(existingState));
|
|
30
|
-
}
|
|
31
|
-
const stringKey = stringifyJson(key);
|
|
32
|
-
const molecule = store.molecules.get(stringKey);
|
|
33
|
-
if (molecule) {
|
|
34
|
-
const atom = growMoleculeInStore(molecule, atomFamilyToken, store);
|
|
35
|
-
return transform.toJson(get(atom));
|
|
36
|
-
}
|
|
37
|
-
if (store.config.lifespan === `immortal`) {
|
|
38
|
-
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
39
|
-
}
|
|
40
|
-
const newToken = initFamilyMemberInStore(store, atomFamilyToken, key);
|
|
41
|
-
return transform.toJson(get(newToken));
|
|
42
|
-
},
|
|
43
|
-
set: (key) => ({ seek, set }, newValue) => {
|
|
44
|
-
const existingState = seek(atomFamilyToken, key);
|
|
45
|
-
if (existingState) {
|
|
46
|
-
set(existingState, transform.fromJson(newValue));
|
|
47
|
-
} else {
|
|
48
|
-
const stringKey = stringifyJson(key);
|
|
49
|
-
const molecule = store.molecules.get(stringKey);
|
|
50
|
-
if (molecule) {
|
|
51
|
-
const atom = growMoleculeInStore(molecule, atomFamilyToken, store);
|
|
52
|
-
set(atom, transform.fromJson(newValue));
|
|
53
|
-
} else {
|
|
54
|
-
if (store.config.lifespan === `immortal`) {
|
|
55
|
-
throw new Error(`No molecule found for key "${stringKey}"`);
|
|
56
|
-
}
|
|
57
|
-
set(
|
|
58
|
-
initFamilyMemberInStore(store, atomFamilyToken, key),
|
|
59
|
-
transform.fromJson(newValue)
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
[`mutable`, `json`]
|
|
66
|
-
);
|
|
67
|
-
const atomFamily = withdraw(atomFamilyToken, store);
|
|
68
|
-
atomFamily.subject.subscribe(
|
|
69
|
-
`store=${store.config.name}::json-selector-family`,
|
|
70
|
-
(event) => {
|
|
71
|
-
if (event.token.family) {
|
|
72
|
-
seekInStore(store, jsonFamily, parseJson(event.token.family.subKey));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
return jsonFamily;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export { fromEntries, selectJson, selectJsonFamily };
|
package/json/src/entries.ts
CHANGED
|
@@ -17,3 +17,9 @@ export type FromEntries<E extends Entries> = Flat<{
|
|
|
17
17
|
export function fromEntries<E extends Entries>(entries: E): FromEntries<E> {
|
|
18
18
|
return Object.fromEntries(entries) as FromEntries<E>
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
export function toEntries<T extends object>(
|
|
22
|
+
obj: T,
|
|
23
|
+
): Entries<keyof T, T[keyof T]> {
|
|
24
|
+
return Object.entries(obj) as Entries<keyof T, T[keyof T]>
|
|
25
|
+
}
|
package/json/src/index.ts
CHANGED
|
@@ -1,14 +1,55 @@
|
|
|
1
|
-
import type { Json, JsonInterface, stringified } from "~/packages/anvl/src/json"
|
|
2
|
-
import { parseJson, stringifyJson } from "~/packages/anvl/src/json"
|
|
3
|
-
import type { primitive } from "~/packages/anvl/src/primitive"
|
|
4
|
-
|
|
5
1
|
export * from "./entries"
|
|
6
2
|
export * from "./select-json"
|
|
7
3
|
export * from "./select-json-family"
|
|
8
4
|
|
|
9
|
-
export type
|
|
10
|
-
|
|
5
|
+
export type primitive = boolean | number | string | null
|
|
6
|
+
|
|
7
|
+
export namespace Json {
|
|
8
|
+
export namespace Tree {
|
|
9
|
+
export type Array<Element = unknown> = ReadonlyArray<Element>
|
|
10
|
+
export type Object<K extends string = string, V = unknown> = Record<K, V>
|
|
11
|
+
export type Fork = Array | Object
|
|
12
|
+
export type Leaf = primitive
|
|
13
|
+
export type Node = Fork | Leaf
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type Serializable =
|
|
17
|
+
| primitive
|
|
18
|
+
| Readonly<{ [key: string]: Serializable }>
|
|
19
|
+
| ReadonlyArray<Serializable>
|
|
20
|
+
|
|
21
|
+
export type Object<
|
|
22
|
+
Key extends string = string,
|
|
23
|
+
Value extends Serializable = Serializable,
|
|
24
|
+
> = Record<Key, Value>
|
|
25
|
+
|
|
26
|
+
export type Array<Element extends Serializable = Serializable> =
|
|
27
|
+
ReadonlyArray<Element>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type stringified<J extends Json.Serializable> = string & { __json: J }
|
|
31
|
+
|
|
32
|
+
export const parseJson = <S extends stringified<Json.Serializable>>(
|
|
33
|
+
str: S | string,
|
|
34
|
+
): S extends stringified<infer J> ? J : Json.Serializable => JSON.parse(str)
|
|
35
|
+
|
|
36
|
+
export const stringifyJson = <J extends Json.Serializable>(
|
|
37
|
+
json: J,
|
|
38
|
+
): stringified<J> => JSON.stringify(json) as stringified<J>
|
|
11
39
|
|
|
12
40
|
export type Canonical = primitive | ReadonlyArray<Canonical>
|
|
13
41
|
|
|
14
42
|
export type JsonIO = (...params: Json.Serializable[]) => Json.Serializable | void
|
|
43
|
+
|
|
44
|
+
export type JsonInterface<T, J extends Json.Serializable = Json.Serializable> = {
|
|
45
|
+
toJson: (t: T) => J
|
|
46
|
+
fromJson: (json: J) => T
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const JSON_PROTOTYPES = [Array, Boolean, Number, Object, String] as const
|
|
50
|
+
export const isJson = (input: unknown): input is Json.Tree.Node => {
|
|
51
|
+
if (input === null) return true
|
|
52
|
+
if (input === undefined) return false
|
|
53
|
+
const prototype = Object.getPrototypeOf(input)
|
|
54
|
+
return JSON_PROTOTYPES.includes(prototype)
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
"@types/estree": "1.0.5",
|
|
58
58
|
"@types/http-proxy": "1.17.15",
|
|
59
59
|
"@types/npmlog": "7.0.0",
|
|
60
|
-
"@types/react": "18.3.
|
|
60
|
+
"@types/react": "18.3.4",
|
|
61
61
|
"@types/tmp": "0.2.6",
|
|
62
|
-
"@typescript-eslint/parser": "8.
|
|
63
|
-
"@typescript-eslint/rule-tester": "8.
|
|
62
|
+
"@typescript-eslint/parser": "8.2.0",
|
|
63
|
+
"@typescript-eslint/rule-tester": "8.2.0",
|
|
64
64
|
"@vitest/coverage-v8": "2.0.5",
|
|
65
65
|
"@vitest/ui": "2.0.5",
|
|
66
66
|
"concurrently": "8.2.2",
|
|
67
67
|
"drizzle-kit": "0.24.0",
|
|
68
68
|
"drizzle-orm": "0.33.0",
|
|
69
69
|
"eslint": "9.9.0",
|
|
70
|
-
"framer-motion": "11.3.
|
|
71
|
-
"happy-dom": "
|
|
70
|
+
"framer-motion": "11.3.29",
|
|
71
|
+
"happy-dom": "15.0.0",
|
|
72
72
|
"http-proxy": "1.18.1",
|
|
73
73
|
"npmlog": "7.0.1",
|
|
74
74
|
"postgres": "3.4.4",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"tsup": "8.2.4",
|
|
83
83
|
"tsx": "4.17.0",
|
|
84
84
|
"typescript": "5.5.4",
|
|
85
|
-
"vite": "5.4.
|
|
85
|
+
"vite": "5.4.2",
|
|
86
86
|
"vite-tsconfig-paths": "5.0.1",
|
|
87
87
|
"vitest": "2.0.5"
|
|
88
88
|
},
|
|
@@ -135,7 +135,10 @@
|
|
|
135
135
|
"realtime-testing/src",
|
|
136
136
|
"transceivers/set-rtx/dist",
|
|
137
137
|
"transceivers/set-rtx/package.json",
|
|
138
|
-
"transceivers/set-rtx/src"
|
|
138
|
+
"transceivers/set-rtx/src",
|
|
139
|
+
"web/dist",
|
|
140
|
+
"web/package.json",
|
|
141
|
+
"web/src"
|
|
139
142
|
],
|
|
140
143
|
"exports": {
|
|
141
144
|
"./package.json": "./package.json",
|
|
@@ -217,6 +220,11 @@
|
|
|
217
220
|
"./transceivers/set-rtx": {
|
|
218
221
|
"import": "./transceivers/set-rtx/dist/index.js",
|
|
219
222
|
"types": "./transceivers/set-rtx/dist/index.d.ts"
|
|
223
|
+
},
|
|
224
|
+
"./web/package.json": "./web/package.json",
|
|
225
|
+
"./web": {
|
|
226
|
+
"import": "./web/dist/index.js",
|
|
227
|
+
"types": "./web/dist/index.d.ts"
|
|
220
228
|
}
|
|
221
229
|
},
|
|
222
230
|
"scripts": {
|
|
@@ -240,6 +248,7 @@
|
|
|
240
248
|
"build:realtime-server": "cd realtime-server && tsup",
|
|
241
249
|
"build:realtime-testing": "cd realtime-testing && tsup",
|
|
242
250
|
"build:transceivers:set-rtx": "cd transceivers/set-rtx && tsup",
|
|
251
|
+
"build:web": "cd web && tsup",
|
|
243
252
|
"lint:biome": "biome check -- .",
|
|
244
253
|
"lint:eslint": "eslint --flag unstable_ts_config -- .",
|
|
245
254
|
"lint:eslint:build": "bun run build:main",
|
|
@@ -1,93 +1,3 @@
|
|
|
1
|
-
import * as Internal from 'atom.io/internal';
|
|
2
|
-
import * as atom_io from 'atom.io';
|
|
3
|
-
import { AtomToken, ReadableToken, SelectorToken } from 'atom.io';
|
|
4
|
-
|
|
5
|
-
type ClassSignature = abstract new (...args: any) => any;
|
|
6
|
-
|
|
7
|
-
type Refinement<A, B extends A> = (a: A) => a is B;
|
|
8
|
-
|
|
9
|
-
type RefinementStrategy = ClassSignature | Refinement<unknown, any>;
|
|
10
|
-
type Supported<Refine extends RefinementStrategy> = Refine extends Refinement<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
|
|
11
|
-
type RefinementSupport = Record<string, RefinementStrategy>;
|
|
12
|
-
declare class Refinery<SupportedTypes extends RefinementSupport> {
|
|
13
|
-
supported: SupportedTypes;
|
|
14
|
-
constructor(supported: SupportedTypes);
|
|
15
|
-
refine(input: unknown): {
|
|
16
|
-
[K in keyof SupportedTypes]: {
|
|
17
|
-
type: K;
|
|
18
|
-
data: Supported<SupportedTypes[K]>;
|
|
19
|
-
};
|
|
20
|
-
}[keyof SupportedTypes] | null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type PlainObject = Record<keyof any, unknown>;
|
|
24
|
-
|
|
25
|
-
type AtomTokenIndex = WritableTokenIndex<AtomToken<unknown>>;
|
|
26
|
-
|
|
27
|
-
type FamilyNode<Token extends ReadableToken<unknown>> = {
|
|
28
|
-
key: string;
|
|
29
|
-
familyMembers: Map<string, Token>;
|
|
30
|
-
};
|
|
31
|
-
type WritableTokenIndex<Token extends ReadableToken<unknown>> = Map<string, FamilyNode<Token> | Token>;
|
|
32
|
-
|
|
33
|
-
type SelectorTokenIndex = WritableTokenIndex<SelectorToken<unknown>>;
|
|
34
|
-
|
|
35
|
-
type Delta = {
|
|
36
|
-
summary: string;
|
|
37
|
-
added?: [path: string, addedStringifiedValue: string][];
|
|
38
|
-
removed?: [path: string, removedStringifiedValue: string][];
|
|
39
|
-
changed?: [path: string, delta: Delta][];
|
|
40
|
-
};
|
|
41
|
-
type Diff<T> = (a: T, b: T) => Delta;
|
|
42
|
-
type DiffTree<T> = (a: T, b: T, recurse: Differ<any, any>[`diff`]) => Delta;
|
|
43
|
-
declare class Differ<Leaf extends Record<string, any>, Tree extends Record<string, any>> {
|
|
44
|
-
leafRefinery: Refinery<Leaf>;
|
|
45
|
-
treeRefinery: Refinery<Tree>;
|
|
46
|
-
leafDiffers: {
|
|
47
|
-
[KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
|
|
48
|
-
};
|
|
49
|
-
treeDiffers: {
|
|
50
|
-
[KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
|
|
51
|
-
};
|
|
52
|
-
constructor(leafRefinery: Refinery<Leaf>, treeRefinery: Refinery<Tree>, diffFunctions: {
|
|
53
|
-
[KT in keyof Tree]: DiffTree<Supported<Tree[KT]>>;
|
|
54
|
-
} & {
|
|
55
|
-
[KL in keyof Leaf]: Diff<Supported<Leaf[KL]>>;
|
|
56
|
-
});
|
|
57
|
-
diff(a: unknown, b: unknown): Delta;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
1
|
declare const AtomIODevtools: () => JSX.Element;
|
|
61
2
|
|
|
62
|
-
|
|
63
|
-
declare const selectorIndex: atom_io.ReadonlySelectorToken<SelectorTokenIndex>;
|
|
64
|
-
declare const transactionIndex: atom_io.ReadonlySelectorToken<atom_io.TransactionToken<Internal.Func>[]>;
|
|
65
|
-
declare const findTransactionLogState: atom_io.ReadonlySelectorFamilyToken<atom_io.TransactionUpdate<Internal.Func>[], string>;
|
|
66
|
-
declare const timelineIndex: atom_io.ReadonlySelectorToken<atom_io.TimelineToken<any>[]>;
|
|
67
|
-
declare const findTimelineState: atom_io.ReadonlySelectorFamilyToken<Internal.Timeline<any>, string>;
|
|
68
|
-
declare const devtoolsAreOpenState: atom_io.RegularAtomToken<boolean>;
|
|
69
|
-
type DevtoolsView = `atoms` | `selectors` | `timelines` | `transactions`;
|
|
70
|
-
declare const devtoolsViewSelectionState: atom_io.RegularAtomToken<DevtoolsView>;
|
|
71
|
-
declare const devtoolsViewOptionsState: atom_io.RegularAtomToken<DevtoolsView[]>;
|
|
72
|
-
declare const findViewIsOpenState: atom_io.RegularAtomFamilyToken<boolean, string>;
|
|
73
|
-
declare const primitiveRefinery: Refinery<{
|
|
74
|
-
number: (input: unknown) => input is number;
|
|
75
|
-
string: (input: unknown) => input is string;
|
|
76
|
-
boolean: (input: unknown) => input is boolean;
|
|
77
|
-
null: (input: unknown) => input is null;
|
|
78
|
-
}>;
|
|
79
|
-
declare const jsonTreeRefinery: Refinery<{
|
|
80
|
-
object: (input: unknown) => input is PlainObject;
|
|
81
|
-
array: (input: unknown) => input is unknown[];
|
|
82
|
-
}>;
|
|
83
|
-
declare const prettyJson: Differ<{
|
|
84
|
-
number: (input: unknown) => input is number;
|
|
85
|
-
string: (input: unknown) => input is string;
|
|
86
|
-
boolean: (input: unknown) => input is boolean;
|
|
87
|
-
null: (input: unknown) => input is null;
|
|
88
|
-
}, {
|
|
89
|
-
object: (input: unknown) => input is PlainObject;
|
|
90
|
-
array: (input: unknown) => input is unknown[];
|
|
91
|
-
}>;
|
|
92
|
-
|
|
93
|
-
export { AtomIODevtools, atomIndex, devtoolsAreOpenState, devtoolsViewOptionsState, devtoolsViewSelectionState, findTimelineState, findTransactionLogState, findViewIsOpenState, jsonTreeRefinery, prettyJson, primitiveRefinery, selectorIndex, timelineIndex, transactionIndex };
|
|
3
|
+
export { AtomIODevtools };
|