atom.io 0.27.0 → 0.27.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/internal/dist/index.d.ts +2 -1
- package/internal/src/utility-types.ts +4 -0
- package/json/dist/index.d.ts +12 -2
- package/json/dist/index.js +5 -1
- package/json/src/entries.ts +19 -0
- package/json/src/index.ts +1 -0
- package/package.json +1 -1
package/internal/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ type Flat<R extends {
|
|
|
83
83
|
}> = {
|
|
84
84
|
[K in keyof R]: R[K];
|
|
85
85
|
};
|
|
86
|
+
type Range<N extends number, A extends any[] = []> = A[`length`] extends N ? A[`length`] : A[`length`] | Range<N, [...A, any]>;
|
|
86
87
|
|
|
87
88
|
declare const abortTransaction: (store: Store) => void;
|
|
88
89
|
|
|
@@ -587,4 +588,4 @@ type Selector<T> = ReadonlySelector<T> | WritableSelector<T>;
|
|
|
587
588
|
type WritableState<T> = Atom<T> | WritableSelector<T>;
|
|
588
589
|
type ReadableState<T> = Atom<T> | Selector<T>;
|
|
589
590
|
|
|
590
|
-
export { type Atom, type AtomIOState, type AtomKey, type ChildStore, type EnvironmentData, FamilyTracker, type Flat, type Func, Future, IMPLICIT, LazyMap, type Lineage, type Modify, Molecule, type MutableAtom, NotFoundError, type OperationProgress, type ReadableState, type ReadonlySelector, type ReadonlySelectorKey, type RegularAtom, type RootStore, type Selector, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineMoleculeCreation, type TimelineMoleculeDisposal, type TimelineSelectorUpdate, type TimelineStateCreation, type TimelineStateDisposal, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type Withdrawable, type WritableSelector, type WritableState, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw };
|
|
591
|
+
export { type Atom, type AtomIOState, type AtomKey, type ChildStore, type EnvironmentData, FamilyTracker, type Flat, type Func, Future, IMPLICIT, LazyMap, type Lineage, type Modify, Molecule, type MutableAtom, NotFoundError, type OperationProgress, type Range, type ReadableState, type ReadonlySelector, type ReadonlySelectorKey, type RegularAtom, type RootStore, type Selector, type SelectorKey, type Signal, type StateKey, StatefulSubject, Store, Subject, TRANSACTION_PHASES, type Timeline, type TimelineAtomUpdate, type TimelineMoleculeCreation, type TimelineMoleculeDisposal, type TimelineSelectorUpdate, type TimelineStateCreation, type TimelineStateDisposal, type TimelineTransactionUpdate, Tracker, type Transaction, type TransactionEpoch, type TransactionPhase, type TransactionProgress, type Transceiver, type TransceiverMode, type Withdrawable, type WritableSelector, type WritableState, abortTransaction, actUponStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, clearStore, closeOperation, createAtomFamily, createMoleculeFamily, createMutableAtom, createMutableAtomFamily, createReadonlySelector, createReadonlySelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneAtom, createStandaloneSelector, createTimeline, createTransaction, createWritableSelector, deposit, disposeAtom, disposeFromStore, disposeMolecule, disposeSelector, eldest, evictCachedValue, findInStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getUpdateToken, growMoleculeInStore, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, isAtomDefault, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeMoleculeInStore, markAtomAsDefault, markAtomAsNotDefault, markDone, newest, openOperation, readCachedValue, readOrComputeValue, registerSelector, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeToRootAtoms, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceAllSelectorAtoms, traceSelectorAtoms, updateSelectorAtoms, withdraw };
|
|
@@ -3,3 +3,7 @@ export type Func = (...parameters: any[]) => any
|
|
|
3
3
|
export type Flat<R extends { [K in PropertyKey]: any }> = {
|
|
4
4
|
[K in keyof R]: R[K]
|
|
5
5
|
}
|
|
6
|
+
|
|
7
|
+
export type Range<N extends number, A extends any[] = []> = A[`length`] extends N
|
|
8
|
+
? A[`length`]
|
|
9
|
+
: A[`length`] | Range<N, [...A, any]>
|
package/json/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Range, Flat, Store, Transceiver } from 'atom.io/internal';
|
|
1
2
|
import * as AtomIO from 'atom.io';
|
|
2
|
-
import { Store, Transceiver } from 'atom.io/internal';
|
|
3
3
|
|
|
4
4
|
type JsonInterface<T, J extends Serializable = Serializable> = {
|
|
5
5
|
toJson: (t: T) => J;
|
|
@@ -26,6 +26,16 @@ type stringified<J extends Serializable> = string & {
|
|
|
26
26
|
};
|
|
27
27
|
declare const stringifyJson: <J extends Serializable>(json: J) => stringified<J>;
|
|
28
28
|
|
|
29
|
+
type Entries<K extends keyof any = keyof any, V = any> = [K, V][];
|
|
30
|
+
type KeyOfEntries<E extends Entries> = E extends [infer K, any][] ? K : never;
|
|
31
|
+
type ValueOfEntry<E extends Entries, K extends KeyOfEntries<E>> = {
|
|
32
|
+
[P in Range<E[`length`]>]: E[P] extends [K, infer V] ? V : never;
|
|
33
|
+
}[Range<E[`length`]>];
|
|
34
|
+
type FromEntries<E extends Entries> = Flat<{
|
|
35
|
+
[K in KeyOfEntries<E>]: ValueOfEntry<E, K>;
|
|
36
|
+
}>;
|
|
37
|
+
declare function fromEntries<E extends Entries>(entries: E): FromEntries<E>;
|
|
38
|
+
|
|
29
39
|
declare const selectJson: <T, J extends Serializable>(atom: AtomIO.AtomToken<T>, transform: JsonInterface<T, J>, store?: Store) => AtomIO.WritableSelectorToken<J>;
|
|
30
40
|
|
|
31
41
|
declare function selectJsonFamily<T extends Transceiver<any>, J extends Serializable, K extends Canonical>(atomFamily: AtomIO.MutableAtomFamily<T, J, K>, transform: JsonInterface<T, J>, store: Store): AtomIO.WritableSelectorFamily<J, K>;
|
|
@@ -34,4 +44,4 @@ declare function selectJsonFamily<T, J extends Serializable, K extends Canonical
|
|
|
34
44
|
type Canonical = primitive | ReadonlyArray<Canonical>;
|
|
35
45
|
type JsonIO = (...params: Serializable[]) => Serializable | void;
|
|
36
46
|
|
|
37
|
-
export { type Canonical, json as Json, type JsonIO, type JsonInterface, parseJson, type primitive, selectJson, selectJsonFamily, type stringified, stringifyJson };
|
|
47
|
+
export { type Canonical, type Entries, type FromEntries, json as Json, type JsonIO, type JsonInterface, type KeyOfEntries, type ValueOfEntry, fromEntries, parseJson, type primitive, selectJson, selectJsonFamily, type stringified, stringifyJson };
|
package/json/dist/index.js
CHANGED
|
@@ -3,6 +3,10 @@ export { parseJson, stringifyJson } from '../../dist/chunk-AK23DRMD.js';
|
|
|
3
3
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
4
4
|
import { createStandaloneSelector, IMPLICIT, createSelectorFamily, growMoleculeInStore, initFamilyMemberInStore, seekInStore } from 'atom.io/internal';
|
|
5
5
|
|
|
6
|
+
// json/src/entries.ts
|
|
7
|
+
function fromEntries(entries) {
|
|
8
|
+
return Object.fromEntries(entries);
|
|
9
|
+
}
|
|
6
10
|
var selectJson = (atom, transform, store = IMPLICIT.STORE) => {
|
|
7
11
|
return createStandaloneSelector(
|
|
8
12
|
{
|
|
@@ -71,4 +75,4 @@ function selectJsonFamily(family, transform, store = IMPLICIT.STORE) {
|
|
|
71
75
|
return jsonFamily;
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
export { selectJson, selectJsonFamily };
|
|
78
|
+
export { fromEntries, selectJson, selectJsonFamily };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Flat, Range } from "atom.io/internal"
|
|
2
|
+
|
|
3
|
+
export type Entries<K extends keyof any = keyof any, V = any> = [K, V][]
|
|
4
|
+
|
|
5
|
+
export type KeyOfEntries<E extends Entries> = E extends [infer K, any][]
|
|
6
|
+
? K
|
|
7
|
+
: never
|
|
8
|
+
|
|
9
|
+
export type ValueOfEntry<E extends Entries, K extends KeyOfEntries<E>> = {
|
|
10
|
+
[P in Range<E[`length`]>]: E[P] extends [K, infer V] ? V : never
|
|
11
|
+
}[Range<E[`length`]>]
|
|
12
|
+
|
|
13
|
+
export type FromEntries<E extends Entries> = Flat<{
|
|
14
|
+
[K in KeyOfEntries<E>]: ValueOfEntry<E, K>
|
|
15
|
+
}>
|
|
16
|
+
|
|
17
|
+
export function fromEntries<E extends Entries>(entries: E): FromEntries<E> {
|
|
18
|
+
return Object.fromEntries(entries) as FromEntries<E>
|
|
19
|
+
}
|
package/json/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Json, JsonInterface, stringified } from "~/packages/anvl/src/json"
|
|
|
2
2
|
import { parseJson, stringifyJson } from "~/packages/anvl/src/json"
|
|
3
3
|
import type { primitive } from "~/packages/anvl/src/primitive"
|
|
4
4
|
|
|
5
|
+
export * from "./entries"
|
|
5
6
|
export * from "./select-json"
|
|
6
7
|
export * from "./select-json-family"
|
|
7
8
|
|