atom.io 0.19.3 → 0.20.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.js +1 -1
- package/data/src/dict.ts +1 -1
- package/data/src/join.ts +1 -1
- package/data/src/struct-family.ts +1 -1
- package/data/src/struct.ts +5 -3
- package/eslint-plugin/dist/index.cjs +53 -0
- package/eslint-plugin/dist/index.js +52 -0
- package/eslint-plugin/src/index.ts +1 -0
- package/eslint-plugin/src/rules/explicit-state-types.ts +55 -0
- package/eslint-plugin/src/rules/index.ts +1 -0
- package/internal/dist/index.cjs +127 -92
- package/internal/dist/index.d.ts +13 -9
- package/internal/dist/index.js +127 -92
- package/internal/src/atom/index.ts +1 -1
- package/internal/src/caching.ts +13 -9
- package/internal/src/families/create-atom-family.ts +1 -1
- package/internal/src/families/find-in-store.ts +2 -2
- package/internal/src/families/index.ts +1 -1
- package/internal/src/future.ts +52 -15
- package/internal/src/index.ts +2 -2
- package/internal/src/mutable/create-mutable-atom-family.ts +2 -3
- package/internal/src/mutable/create-mutable-atom.ts +3 -3
- package/internal/src/mutable/get-update-token.ts +1 -0
- package/internal/src/selector/delete-selector.ts +1 -1
- package/internal/src/selector/register-selector.ts +1 -1
- package/internal/src/store/deposit.ts +1 -1
- package/internal/src/store/store.ts +2 -2
- package/internal/src/store/withdraw-new-family-member.ts +1 -1
- package/internal/src/store/withdraw.ts +2 -3
- package/internal/src/subscribe/subscribe-to-state.ts +1 -0
- package/internal/src/subscribe/subscribe-to-timeline.ts +1 -0
- package/internal/src/subscribe/subscribe-to-transaction.ts +2 -1
- package/internal/src/timeline/add-atom-to-timeline.ts +2 -2
- package/internal/src/timeline/create-timeline.ts +1 -1
- package/internal/src/transaction/act-upon-store.ts +1 -1
- package/internal/src/transaction/apply-transaction.ts +1 -1
- package/internal/src/transaction/build-transaction.ts +2 -2
- package/internal/src/transaction/create-transaction.ts +2 -2
- package/internal/src/transaction/index.ts +1 -1
- package/internal/src/transaction/is-root-store.ts +1 -1
- package/introspection/src/attach-atom-index.ts +1 -1
- package/introspection/src/attach-introspection-states.ts +2 -2
- package/introspection/src/attach-selector-index.ts +1 -1
- package/introspection/src/attach-timeline-family.ts +2 -2
- package/introspection/src/attach-timeline-index.ts +1 -1
- package/introspection/src/attach-transaction-index.ts +2 -2
- package/introspection/src/attach-transaction-logs.ts +2 -2
- package/json/dist/index.cjs +35 -33
- package/json/dist/index.d.ts +5 -5
- package/json/dist/index.js +5 -5
- package/json/src/index.ts +2 -3
- package/json/src/select-json-family.ts +6 -6
- package/json/src/select-json.ts +1 -2
- package/package.json +18 -15
- package/react/src/use-tl.ts +1 -1
- package/react-devtools/dist/index.cjs +99 -99
- package/react-devtools/dist/index.css +0 -3
- package/react-devtools/dist/index.d.ts +2 -2
- package/react-devtools/dist/index.js +77 -77
- package/react-devtools/src/AtomIODevtools.tsx +2 -2
- package/react-devtools/src/TransactionIndex.tsx +2 -2
- package/react-devtools/src/Updates.tsx +1 -1
- package/react-devtools/src/devtools.scss +0 -3
- package/react-devtools/src/index.ts +1 -1
- package/realtime/src/realtime-continuity.ts +1 -1
- package/realtime/src/shared-room-store.ts +1 -1
- package/realtime-client/dist/index.js +1 -1
- package/realtime-client/src/pull-atom-family-member.ts +1 -1
- package/realtime-client/src/pull-atom.ts +1 -1
- package/realtime-client/src/pull-mutable-atom-family-member.ts +2 -2
- package/realtime-client/src/sync-continuity.ts +1 -1
- package/realtime-react/dist/index.js +1 -1
- package/realtime-react/src/use-realtime-service.ts +1 -0
- package/realtime-react/src/use-sync-continuity.ts +2 -1
- package/realtime-server/dist/index.cjs +98 -98
- package/realtime-server/dist/index.d.ts +17 -18
- package/realtime-server/dist/index.js +100 -100
- package/realtime-server/src/index.ts +5 -5
- package/realtime-server/src/ipc-sockets/parent-socket.ts +3 -3
- package/realtime-server/src/realtime-action-receiver.ts +1 -1
- package/realtime-server/src/realtime-continuity-synchronizer.ts +2 -3
- package/realtime-server/src/realtime-family-provider.ts +1 -1
- package/realtime-server/src/realtime-mutable-family-provider.ts +1 -1
- package/realtime-server/src/realtime-mutable-provider.ts +2 -2
- package/realtime-server/src/realtime-server-stores/realtime-continuity-store.ts +2 -2
- package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +1 -1
- package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +1 -0
- package/realtime-server/src/realtime-server-stores/server-user-store.ts +3 -2
- package/realtime-server/src/realtime-state-provider.ts +1 -1
- package/realtime-server/src/realtime-state-synchronizer.ts +1 -1
- package/realtime-testing/dist/index.js +2 -2
- package/realtime-testing/src/setup-realtime-test.tsx +3 -2
- package/src/atom.ts +1 -1
- package/src/find-state.ts +1 -1
- package/src/index.ts +1 -0
- package/src/selector.ts +1 -1
- package/src/silo.ts +4 -4
- package/src/subscribe.ts +2 -2
- package/src/timeline.ts +1 -1
- package/src/transaction.ts +3 -3
- package/transceivers/set-rtx/src/set-rtx.ts +1 -1
- package/dist/{chunk-ATKDGVTV.js → chunk-2AIFLP2B.js} +0 -0
- package/dist/{chunk-CC7IF7QF.js → chunk-3V3VWQ7X.js} +6 -6
- /package/dist/{chunk-MSCJWACE.js → chunk-SMZRGPN6.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
Func,
|
|
2
3
|
TransactionOptions,
|
|
3
4
|
TransactionToken,
|
|
4
5
|
TransactionUpdate,
|
|
5
|
-
Func,
|
|
6
6
|
} from "atom.io"
|
|
7
7
|
|
|
8
8
|
import { newest } from "../lineage"
|
|
9
|
-
import { deposit } from "../store"
|
|
10
9
|
import type { Store } from "../store"
|
|
10
|
+
import { deposit } from "../store"
|
|
11
11
|
import { Subject } from "../subject"
|
|
12
12
|
import { abortTransaction } from "./abort-transaction"
|
|
13
13
|
import { applyTransaction } from "./apply-transaction"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Func } from "atom.io"
|
|
2
2
|
|
|
3
|
-
import type { TransactionEpoch, TransactionProgress } from "."
|
|
4
3
|
import type { Store } from "../store"
|
|
4
|
+
import type { TransactionEpoch, TransactionProgress } from "."
|
|
5
5
|
|
|
6
6
|
export interface RootStore extends Store {
|
|
7
7
|
transactionMeta: TransactionEpoch
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
Func,
|
|
2
3
|
ReadonlySelectorFamily,
|
|
3
4
|
ReadonlySelectorFamilyToken,
|
|
4
5
|
ReadonlySelectorToken,
|
|
5
6
|
TimelineToken,
|
|
6
7
|
TransactionToken,
|
|
7
8
|
TransactionUpdate,
|
|
8
|
-
Func,
|
|
9
9
|
} from "atom.io"
|
|
10
|
-
import * as Internal from "atom.io/internal"
|
|
11
10
|
import type { Timeline } from "atom.io/internal"
|
|
11
|
+
import * as Internal from "atom.io/internal"
|
|
12
12
|
|
|
13
13
|
import { type AtomTokenIndex, attachAtomIndex } from "./attach-atom-index"
|
|
14
14
|
import type { SelectorTokenIndex } from "./attach-selector-index"
|
|
@@ -4,10 +4,10 @@ import type {
|
|
|
4
4
|
} from "atom.io"
|
|
5
5
|
import type { Store, Timeline } from "atom.io/internal"
|
|
6
6
|
import {
|
|
7
|
-
IMPLICIT,
|
|
8
|
-
Subject,
|
|
9
7
|
createRegularAtomFamily,
|
|
10
8
|
createSelectorFamily,
|
|
9
|
+
IMPLICIT,
|
|
10
|
+
Subject,
|
|
11
11
|
} from "atom.io/internal"
|
|
12
12
|
|
|
13
13
|
export const attachTimelineFamily = (
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReadonlySelectorToken, TimelineToken } from "atom.io"
|
|
2
2
|
import type { Store } from "atom.io/internal"
|
|
3
3
|
import {
|
|
4
|
-
IMPLICIT,
|
|
5
4
|
createRegularAtom,
|
|
6
5
|
createStandaloneSelector,
|
|
6
|
+
IMPLICIT,
|
|
7
7
|
} from "atom.io/internal"
|
|
8
8
|
|
|
9
9
|
export const attachTimelineIndex = (
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ReadonlySelectorToken, TransactionToken
|
|
1
|
+
import type { Func, ReadonlySelectorToken, TransactionToken } from "atom.io"
|
|
2
2
|
import type { Store } from "atom.io/internal"
|
|
3
3
|
import {
|
|
4
|
-
IMPLICIT,
|
|
5
4
|
createRegularAtom,
|
|
6
5
|
createStandaloneSelector,
|
|
6
|
+
IMPLICIT,
|
|
7
7
|
} from "atom.io/internal"
|
|
8
8
|
|
|
9
9
|
export const attachTransactionIndex = (
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
Func,
|
|
2
3
|
ReadonlySelectorFamilyToken,
|
|
3
4
|
TransactionUpdate,
|
|
4
|
-
Func,
|
|
5
5
|
} from "atom.io"
|
|
6
6
|
import type { Store } from "atom.io/internal"
|
|
7
7
|
import {
|
|
8
|
-
IMPLICIT,
|
|
9
8
|
createRegularAtomFamily,
|
|
10
9
|
createSelectorFamily,
|
|
10
|
+
IMPLICIT,
|
|
11
11
|
} from "atom.io/internal"
|
|
12
12
|
|
|
13
13
|
export const attachTransactionLogs = (
|
package/json/dist/index.cjs
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
var internal = require('atom.io/internal');
|
|
4
4
|
|
|
5
|
+
// json/src/select-json.ts
|
|
6
|
+
var selectJson = (atom, transform, store = internal.IMPLICIT.STORE) => {
|
|
7
|
+
return internal.createStandaloneSelector(
|
|
8
|
+
{
|
|
9
|
+
key: `${atom.key}:JSON`,
|
|
10
|
+
get: ({ get }) => transform.toJson(get(atom)),
|
|
11
|
+
set: ({ set }, newValue) => {
|
|
12
|
+
set(atom, transform.fromJson(newValue));
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
store
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
function selectJsonFamily(family, transform, store = internal.IMPLICIT.STORE) {
|
|
19
|
+
const jsonFamily = internal.createSelectorFamily(
|
|
20
|
+
{
|
|
21
|
+
key: `${family.key}:JSON`,
|
|
22
|
+
get: (key) => ({ get }) => transform.toJson(get(family(key))),
|
|
23
|
+
set: (key) => ({ set }, newValue) => {
|
|
24
|
+
set(family(key), transform.fromJson(newValue));
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
store
|
|
28
|
+
);
|
|
29
|
+
family.subject.subscribe(
|
|
30
|
+
`store=${store.config.name}::json-selector-family`,
|
|
31
|
+
(token) => {
|
|
32
|
+
if (token.family) {
|
|
33
|
+
jsonFamily(parseJson(token.family.subKey));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
return jsonFamily;
|
|
38
|
+
}
|
|
39
|
+
|
|
5
40
|
// ../anvl/src/json/json-interface.ts
|
|
6
41
|
var stringSetJsonInterface = {
|
|
7
42
|
toJson: (stringSet) => Array.from(stringSet),
|
|
@@ -44,39 +79,6 @@ var isNull = (input) => {
|
|
|
44
79
|
var isPrimitive = (input) => {
|
|
45
80
|
return isString(input) || isNumber(input) || isBoolean(input) || isNull(input);
|
|
46
81
|
};
|
|
47
|
-
var selectJson = (atom, transform, store = internal.IMPLICIT.STORE) => {
|
|
48
|
-
return internal.createStandaloneSelector(
|
|
49
|
-
{
|
|
50
|
-
key: `${atom.key}:JSON`,
|
|
51
|
-
get: ({ get }) => transform.toJson(get(atom)),
|
|
52
|
-
set: ({ set }, newValue) => {
|
|
53
|
-
set(atom, transform.fromJson(newValue));
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
store
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
function selectJsonFamily(atomFamily, transform, store = internal.IMPLICIT.STORE) {
|
|
60
|
-
const jsonFamily = internal.createSelectorFamily(
|
|
61
|
-
{
|
|
62
|
-
key: `${atomFamily.key}:JSON`,
|
|
63
|
-
get: (key) => ({ get }) => transform.toJson(get(atomFamily(key))),
|
|
64
|
-
set: (key) => ({ set }, newValue) => {
|
|
65
|
-
set(atomFamily(key), transform.fromJson(newValue));
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
store
|
|
69
|
-
);
|
|
70
|
-
atomFamily.subject.subscribe(
|
|
71
|
-
`store=${store.config.name}::json-selector-family`,
|
|
72
|
-
(token) => {
|
|
73
|
-
if (token.family) {
|
|
74
|
-
jsonFamily(parseJson(token.family.subKey));
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
return jsonFamily;
|
|
79
|
-
}
|
|
80
82
|
|
|
81
83
|
exports.JSON_DEFAULTS = JSON_DEFAULTS;
|
|
82
84
|
exports.JSON_TYPE_NAMES = JSON_TYPE_NAMES;
|
package/json/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as AtomIO from 'atom.io';
|
|
2
2
|
import { Store, Transceiver } from 'atom.io/internal';
|
|
3
3
|
|
|
4
|
+
declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
|
|
5
|
+
|
|
6
|
+
declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
7
|
+
declare function selectJsonFamily<T, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.RegularAtomFamily<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
8
|
+
|
|
4
9
|
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
5
10
|
toJson: (t: T) => J;
|
|
6
11
|
fromJson: (json: J) => T;
|
|
@@ -44,11 +49,6 @@ interface JsonTypes extends Record<JsonTypeName, Serializable> {
|
|
|
44
49
|
}
|
|
45
50
|
declare const JSON_DEFAULTS: JsonTypes;
|
|
46
51
|
|
|
47
|
-
declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
|
|
48
|
-
|
|
49
|
-
declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
50
|
-
declare function selectJsonFamily<T, J extends Serializable, K extends Serializable>(atomFamily: AtomIO.RegularAtomFamily<T, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
51
|
-
|
|
52
52
|
type JsonIO = (...params: Serializable[]) => Serializable | void;
|
|
53
53
|
|
|
54
54
|
export { type Empty, JSON_DEFAULTS, JSON_TYPE_NAMES, json as Json, type JsonIO, 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
|
@@ -15,18 +15,18 @@ var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
|
15
15
|
store
|
|
16
16
|
);
|
|
17
17
|
};
|
|
18
|
-
function selectJsonFamily(
|
|
18
|
+
function selectJsonFamily(family, transform, store = IMPLICIT.STORE) {
|
|
19
19
|
const jsonFamily = createSelectorFamily(
|
|
20
20
|
{
|
|
21
|
-
key: `${
|
|
22
|
-
get: (key) => ({ get }) => transform.toJson(get(
|
|
21
|
+
key: `${family.key}:JSON`,
|
|
22
|
+
get: (key) => ({ get }) => transform.toJson(get(family(key))),
|
|
23
23
|
set: (key) => ({ set }, newValue) => {
|
|
24
|
-
set(
|
|
24
|
+
set(family(key), transform.fromJson(newValue));
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
store
|
|
28
28
|
);
|
|
29
|
-
|
|
29
|
+
family.subject.subscribe(
|
|
30
30
|
`store=${store.config.name}::json-selector-family`,
|
|
31
31
|
(token) => {
|
|
32
32
|
if (token.family) {
|
package/json/src/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from "~/packages/anvl/src/json"
|
|
2
|
-
export * from "~/packages/anvl/src/primitive"
|
|
3
|
-
|
|
4
1
|
export * from "./select-json"
|
|
5
2
|
export * from "./select-json-family"
|
|
3
|
+
export * from "~/packages/anvl/src/json"
|
|
4
|
+
export * from "~/packages/anvl/src/primitive"
|
|
6
5
|
|
|
7
6
|
import type { Json } from "~/packages/anvl/src/json"
|
|
8
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as AtomIO from "atom.io"
|
|
2
2
|
import type { Store, Transceiver } from "atom.io/internal"
|
|
3
|
-
import {
|
|
3
|
+
import { createSelectorFamily, IMPLICIT } from "atom.io/internal"
|
|
4
4
|
|
|
5
5
|
import type { Json, JsonInterface } from "."
|
|
6
6
|
import { parseJson } from "."
|
|
@@ -28,7 +28,7 @@ export function selectJsonFamily<
|
|
|
28
28
|
J extends Json.Serializable,
|
|
29
29
|
K extends Json.Serializable,
|
|
30
30
|
>(
|
|
31
|
-
|
|
31
|
+
family:
|
|
32
32
|
| AtomIO.MutableAtomFamily<T extends Transceiver<any> ? T : never, J, K>
|
|
33
33
|
| AtomIO.RegularAtomFamily<T, K>,
|
|
34
34
|
transform: JsonInterface<T, J>,
|
|
@@ -36,20 +36,20 @@ export function selectJsonFamily<
|
|
|
36
36
|
): AtomIO.WritableSelectorFamily<J, K> {
|
|
37
37
|
const jsonFamily = createSelectorFamily<J, K>(
|
|
38
38
|
{
|
|
39
|
-
key: `${
|
|
39
|
+
key: `${family.key}:JSON`,
|
|
40
40
|
get:
|
|
41
41
|
(key) =>
|
|
42
42
|
({ get }) =>
|
|
43
|
-
transform.toJson(get(
|
|
43
|
+
transform.toJson(get(family(key))),
|
|
44
44
|
set:
|
|
45
45
|
(key) =>
|
|
46
46
|
({ set }, newValue) => {
|
|
47
|
-
set(
|
|
47
|
+
set(family(key), transform.fromJson(newValue))
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
store,
|
|
51
51
|
)
|
|
52
|
-
|
|
52
|
+
family.subject.subscribe(
|
|
53
53
|
`store=${store.config.name}::json-selector-family`,
|
|
54
54
|
(token) => {
|
|
55
55
|
if (token.family) {
|
package/json/src/select-json.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type * as AtomIO from "atom.io"
|
|
2
2
|
import type { Store } from "atom.io/internal"
|
|
3
|
-
import { IMPLICIT } from "atom.io/internal"
|
|
3
|
+
import { createStandaloneSelector, IMPLICIT } from "atom.io/internal"
|
|
4
4
|
|
|
5
|
-
import { createStandaloneSelector } from "atom.io/internal"
|
|
6
5
|
import type { Json, JsonInterface } from "."
|
|
7
6
|
|
|
8
7
|
export const selectJson = <T, J extends Json.Serializable>(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atom.io",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Composable and testable reactive data library.",
|
|
5
5
|
"homepage": "https://atom.io.fyi",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -48,21 +48,24 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@testing-library/react": "15.0.
|
|
52
|
-
"@types/eslint": "8.56.
|
|
51
|
+
"@testing-library/react": "15.0.4",
|
|
52
|
+
"@types/eslint": "npm:@types/eslint@8.56.10",
|
|
53
|
+
"@types/eslint-v9": "npm:@types/eslint@8.56.10",
|
|
53
54
|
"@types/estree": "1.0.5",
|
|
54
55
|
"@types/http-proxy": "1.17.14",
|
|
55
56
|
"@types/npmlog": "7.0.0",
|
|
56
|
-
"@types/react": "18.2.
|
|
57
|
+
"@types/react": "18.2.79",
|
|
57
58
|
"@types/tmp": "0.2.6",
|
|
58
|
-
"@typescript-eslint/parser": "7.7.
|
|
59
|
-
"@
|
|
60
|
-
"@vitest/
|
|
59
|
+
"@typescript-eslint/parser": "7.7.1",
|
|
60
|
+
"@typescript-eslint/rule-tester": "7.7.1",
|
|
61
|
+
"@vitest/coverage-v8": "1.5.1",
|
|
62
|
+
"@vitest/ui": "1.5.1",
|
|
61
63
|
"concurrently": "8.2.2",
|
|
62
|
-
"drizzle-kit": "0.20.
|
|
63
|
-
"drizzle-orm": "0.30.
|
|
64
|
-
"eslint": "
|
|
65
|
-
"
|
|
64
|
+
"drizzle-kit": "0.20.17",
|
|
65
|
+
"drizzle-orm": "0.30.9",
|
|
66
|
+
"eslint": "npm:eslint@8.57.0",
|
|
67
|
+
"eslint-v9": "npm:eslint@9.1.1",
|
|
68
|
+
"framer-motion": "11.1.7",
|
|
66
69
|
"happy-dom": "14.7.1",
|
|
67
70
|
"http-proxy": "1.18.1",
|
|
68
71
|
"npmlog": "7.0.1",
|
|
@@ -70,15 +73,15 @@
|
|
|
70
73
|
"preact": "10.20.2",
|
|
71
74
|
"react": "18.2.0",
|
|
72
75
|
"react-dom": "18.2.0",
|
|
73
|
-
"react-router-dom": "6.
|
|
76
|
+
"react-router-dom": "6.23.0",
|
|
74
77
|
"socket.io": "4.7.5",
|
|
75
78
|
"socket.io-client": "4.7.5",
|
|
76
79
|
"tmp": "0.2.3",
|
|
77
80
|
"tsup": "8.0.2",
|
|
78
81
|
"typescript": "5.4.5",
|
|
79
|
-
"vite": "5.2.
|
|
82
|
+
"vite": "5.2.10",
|
|
80
83
|
"vite-tsconfig-paths": "4.3.2",
|
|
81
|
-
"vitest": "1.5.
|
|
84
|
+
"vitest": "1.5.1"
|
|
82
85
|
},
|
|
83
86
|
"main": "dist/index.js",
|
|
84
87
|
"types": "dist/index.d.ts",
|
|
@@ -245,7 +248,7 @@
|
|
|
245
248
|
"build:realtime-testing": "cd realtime-testing && tsup",
|
|
246
249
|
"build:transceivers:set-rtx": "cd transceivers/set-rtx && tsup",
|
|
247
250
|
"lint:biome": "biome check -- .",
|
|
248
|
-
"lint:eslint": "eslint .
|
|
251
|
+
"lint:eslint": "eslint .",
|
|
249
252
|
"lint:eslint:build": "bun run build:main",
|
|
250
253
|
"lint:types": "tsc --noEmit",
|
|
251
254
|
"lint": "bun run lint:biome && bun run lint:eslint && bun run lint:types",
|
package/react/src/use-tl.ts
CHANGED
|
@@ -40,6 +40,12 @@ var __objRest = (source, exclude) => {
|
|
|
40
40
|
return target;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
// ../anvl/src/array/index.ts
|
|
44
|
+
var isArray = (isType) => (input) => Array.isArray(input) && input.every((item) => isType(item));
|
|
45
|
+
var map = (f) => (a) => a.map(f);
|
|
46
|
+
var every = (f = Boolean) => (a) => a.every(f);
|
|
47
|
+
var allTrue = every((x) => x === true);
|
|
48
|
+
|
|
43
49
|
// ../anvl/src/function/pipe.ts
|
|
44
50
|
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
|
|
45
51
|
switch (arguments.length) {
|
|
@@ -88,12 +94,6 @@ var fallback = (fn, fallbackValue) => {
|
|
|
88
94
|
}
|
|
89
95
|
};
|
|
90
96
|
|
|
91
|
-
// ../anvl/src/array/index.ts
|
|
92
|
-
var isArray = (isType) => (input) => Array.isArray(input) && input.every((item) => isType(item));
|
|
93
|
-
var map = (f) => (a) => a.map(f);
|
|
94
|
-
var every = (f = Boolean) => (a) => a.every(f);
|
|
95
|
-
var allTrue = every((x) => x === true);
|
|
96
|
-
|
|
97
97
|
// ../anvl/src/nullish/index.ts
|
|
98
98
|
var isUndefined = (input) => input === void 0;
|
|
99
99
|
var ifDefined = (validate) => (input) => isUndefined(input) || validate(input);
|
|
@@ -181,50 +181,59 @@ var delve = (obj, path) => {
|
|
|
181
181
|
return found === void 0 ? new Error(`Not found`) : { found };
|
|
182
182
|
};
|
|
183
183
|
|
|
184
|
-
// ../anvl/src/refinement/
|
|
185
|
-
var
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
184
|
+
// ../anvl/src/refinement/can-exist.ts
|
|
185
|
+
var canExist = (_) => true;
|
|
186
|
+
|
|
187
|
+
// ../anvl/src/refinement/cannot-exist.ts
|
|
188
|
+
var cannotExist = (_) => false;
|
|
189
|
+
|
|
190
|
+
// ../anvl/src/refinement/is-intersection.ts
|
|
191
|
+
function mustSatisfyAllOfTheFollowing(isTypeA, logging = false, refinements = [isTypeA]) {
|
|
192
|
+
const name = `(${refinements.map((r) => (r == null ? void 0 : r.name) || `anon`).join(` & `)})`;
|
|
193
|
+
const _ = {
|
|
194
|
+
[name]: (input) => refinements.every(
|
|
195
|
+
(refinement) => (logging && console.log(
|
|
196
|
+
refinements.map((r) => r.name || `anon`).join(` & `),
|
|
197
|
+
`>`,
|
|
198
|
+
refinement.name || `anon`,
|
|
199
|
+
`:`,
|
|
200
|
+
refinement(input)
|
|
201
|
+
), refinement(input))
|
|
202
|
+
)
|
|
203
|
+
};
|
|
204
|
+
const checkTypes = Object.assign(_[name], {
|
|
205
|
+
and: (isTypeB) => mustSatisfyAllOfTheFollowing(isTypeB, logging, [
|
|
206
|
+
...refinements,
|
|
207
|
+
isTypeB
|
|
208
|
+
])
|
|
209
|
+
});
|
|
210
|
+
return checkTypes;
|
|
211
|
+
}
|
|
212
|
+
var isIntersection = mustSatisfyAllOfTheFollowing(canExist);
|
|
213
|
+
|
|
214
|
+
// ../anvl/src/refinement/is-union.ts
|
|
215
|
+
var mustSatisfyOneOfTheFollowing = (isTypeA, logging = false, refinements = [isTypeA]) => {
|
|
216
|
+
const name = `(${refinements.map((r) => (r == null ? void 0 : r.name) || `anon`).join(` | `)})`;
|
|
217
|
+
const _ = {
|
|
218
|
+
[name]: (input) => refinements.some(
|
|
219
|
+
(refinement) => {
|
|
220
|
+
var _a;
|
|
221
|
+
return logging && console.log(
|
|
222
|
+
refinements.map((r) => r.name || `anon`).join(` | `),
|
|
223
|
+
`>`,
|
|
224
|
+
(_a = refinement.name) != null ? _a : `anon`,
|
|
225
|
+
`:`,
|
|
226
|
+
refinement(input)
|
|
227
|
+
), refinement(input);
|
|
205
228
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
string: (input) => typeof input === `string`,
|
|
213
|
-
boolean: (input) => typeof input === `boolean`,
|
|
214
|
-
object: isPlainObject,
|
|
215
|
-
array: (input) => Array.isArray(input),
|
|
216
|
-
null: (input) => input === null
|
|
217
|
-
});
|
|
218
|
-
var discoverType = (input) => {
|
|
219
|
-
if (input === void 0) {
|
|
220
|
-
return `undefined`;
|
|
221
|
-
}
|
|
222
|
-
const refined = jsonRefinery.refine(input);
|
|
223
|
-
if (refined) {
|
|
224
|
-
return refined.type;
|
|
225
|
-
}
|
|
226
|
-
return Object.getPrototypeOf(input).constructor.name;
|
|
229
|
+
)
|
|
230
|
+
};
|
|
231
|
+
const checkTypes = Object.assign(_[name], {
|
|
232
|
+
or: (isTypeB) => mustSatisfyOneOfTheFollowing(isTypeB, logging, [...refinements, isTypeB])
|
|
233
|
+
});
|
|
234
|
+
return checkTypes;
|
|
227
235
|
};
|
|
236
|
+
var isUnion = mustSatisfyOneOfTheFollowing(cannotExist);
|
|
228
237
|
|
|
229
238
|
// ../anvl/src/json/index.ts
|
|
230
239
|
var stringifyJson = (json) => JSON.stringify(json);
|
|
@@ -278,59 +287,50 @@ var isJson = (input) => {
|
|
|
278
287
|
return refine;
|
|
279
288
|
};
|
|
280
289
|
|
|
281
|
-
// ../anvl/src/refinement/
|
|
282
|
-
var
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
290
|
+
// ../anvl/src/refinement/refinery.ts
|
|
291
|
+
var Refinery = class {
|
|
292
|
+
constructor(supported) {
|
|
293
|
+
this.supported = supported;
|
|
294
|
+
}
|
|
295
|
+
refine(input) {
|
|
296
|
+
for (const [key, refiner] of Object.entries(this.supported)) {
|
|
297
|
+
try {
|
|
298
|
+
if (
|
|
299
|
+
// @ts-expect-error that's the point
|
|
300
|
+
refiner(input) === true && refiner !== Boolean
|
|
301
|
+
) {
|
|
302
|
+
return { type: key, data: input };
|
|
303
|
+
}
|
|
304
|
+
} catch (e) {
|
|
305
|
+
try {
|
|
306
|
+
if (input instanceof refiner) {
|
|
307
|
+
return { type: key, data: input };
|
|
308
|
+
}
|
|
309
|
+
} catch (_) {
|
|
310
|
+
}
|
|
301
311
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
var jsonRefinery = new Refinery({
|
|
317
|
+
number: (input) => typeof input === `number`,
|
|
318
|
+
string: (input) => typeof input === `string`,
|
|
319
|
+
boolean: (input) => typeof input === `boolean`,
|
|
320
|
+
object: isPlainObject,
|
|
321
|
+
array: (input) => Array.isArray(input),
|
|
322
|
+
null: (input) => input === null
|
|
323
|
+
});
|
|
324
|
+
var discoverType = (input) => {
|
|
325
|
+
if (input === void 0) {
|
|
326
|
+
return `undefined`;
|
|
327
|
+
}
|
|
328
|
+
const refined = jsonRefinery.refine(input);
|
|
329
|
+
if (refined) {
|
|
330
|
+
return refined.type;
|
|
331
|
+
}
|
|
332
|
+
return Object.getPrototypeOf(input).constructor.name;
|
|
308
333
|
};
|
|
309
|
-
var isUnion = mustSatisfyOneOfTheFollowing(cannotExist);
|
|
310
|
-
|
|
311
|
-
// ../anvl/src/refinement/is-intersection.ts
|
|
312
|
-
function mustSatisfyAllOfTheFollowing(isTypeA, logging = false, refinements = [isTypeA]) {
|
|
313
|
-
const name = `(${refinements.map((r) => (r == null ? void 0 : r.name) || `anon`).join(` & `)})`;
|
|
314
|
-
const _ = {
|
|
315
|
-
[name]: (input) => refinements.every(
|
|
316
|
-
(refinement) => (logging && console.log(
|
|
317
|
-
refinements.map((r) => r.name || `anon`).join(` & `),
|
|
318
|
-
`>`,
|
|
319
|
-
refinement.name || `anon`,
|
|
320
|
-
`:`,
|
|
321
|
-
refinement(input)
|
|
322
|
-
), refinement(input))
|
|
323
|
-
)
|
|
324
|
-
};
|
|
325
|
-
const checkTypes = Object.assign(_[name], {
|
|
326
|
-
and: (isTypeB) => mustSatisfyAllOfTheFollowing(isTypeB, logging, [
|
|
327
|
-
...refinements,
|
|
328
|
-
isTypeB
|
|
329
|
-
])
|
|
330
|
-
});
|
|
331
|
-
return checkTypes;
|
|
332
|
-
}
|
|
333
|
-
var isIntersection = mustSatisfyAllOfTheFollowing(canExist);
|
|
334
334
|
|
|
335
335
|
// ../anvl/src/refinement/index.ts
|
|
336
336
|
var isLiteral = (value) => (input) => input === value;
|
|
@@ -4,6 +4,8 @@ import { AtomToken, ReadonlySelectorToken, WritableSelectorToken } from 'atom.io
|
|
|
4
4
|
|
|
5
5
|
type ClassSignature = abstract new (...args: any) => any;
|
|
6
6
|
|
|
7
|
+
type Refinement<A, B extends A> = (a: A) => a is B;
|
|
8
|
+
|
|
7
9
|
type RefinementStrategy = ClassSignature | Refinement<unknown, any>;
|
|
8
10
|
type Supported<Refine extends RefinementStrategy> = Refine extends Refinement<unknown, infer T> ? T : Refine extends ClassSignature ? InstanceType<Refine> : never;
|
|
9
11
|
type RefinementSupport = Record<string, RefinementStrategy>;
|
|
@@ -18,8 +20,6 @@ declare class Refinery<SupportedTypes extends RefinementSupport> {
|
|
|
18
20
|
}[keyof SupportedTypes] | null;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
type Refinement<A, B extends A> = (a: A) => a is B;
|
|
22
|
-
|
|
23
23
|
type PlainObject = Record<keyof any, unknown>;
|
|
24
24
|
|
|
25
25
|
type AtomTokenIndex = WritableTokenIndex<AtomToken<unknown>>;
|