atom.io 0.23.4 → 0.24.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.cjs +51 -27
- package/data/dist/index.d.ts +5 -4
- package/data/dist/index.js +625 -9
- package/data/src/join.ts +74 -46
- package/dist/chunk-BF4MVQF6.js +44 -0
- package/dist/index.cjs +27 -0
- package/dist/index.d.ts +63 -18
- package/dist/index.js +27 -3
- package/immortal/dist/index.cjs +4 -262
- package/immortal/dist/index.d.ts +4 -94
- package/immortal/dist/index.js +3 -215
- package/immortal/src/index.ts +0 -2
- package/immortal/src/seek-state.ts +10 -11
- package/internal/dist/index.cjs +279 -111
- package/internal/dist/index.d.ts +63 -93
- package/internal/dist/index.js +273 -88
- package/internal/src/families/dispose-from-store.ts +11 -7
- package/internal/src/families/find-in-store.ts +2 -2
- package/internal/src/families/init-family-member.ts +37 -25
- package/internal/src/families/seek-in-store.ts +11 -15
- package/internal/src/get-environment-data.ts +0 -4
- package/internal/src/index.ts +1 -0
- package/internal/src/ingest-updates/ingest-creation-disposal.ts +8 -8
- package/internal/src/molecule/create-molecule-family.ts +30 -0
- package/internal/src/molecule/dispose-molecule.ts +76 -0
- package/internal/src/molecule/grow-molecule-in-store.ts +89 -0
- package/internal/src/molecule/index.ts +5 -0
- package/internal/src/molecule/make-molecule-in-store.ts +122 -0
- package/internal/src/molecule/molecule-internal.ts +48 -0
- package/internal/src/not-found-error.ts +4 -3
- package/internal/src/set-state/emit-update.ts +1 -2
- package/internal/src/store/deposit.ts +16 -30
- package/internal/src/store/store.ts +7 -12
- package/internal/src/store/withdraw.ts +30 -19
- package/internal/src/timeline/create-timeline.ts +7 -6
- package/internal/src/transaction/build-transaction.ts +2 -1
- package/introspection/dist/index.cjs +29 -33
- package/introspection/dist/index.js +1 -1
- package/introspection/src/auditor.ts +6 -6
- package/json/dist/index.cjs +4 -4
- package/json/dist/index.js +7 -8
- package/json/src/select-json-family.ts +6 -5
- package/package.json +2 -2
- package/react-devtools/dist/index.js +2 -3
- package/realtime-client/dist/index.js +362 -15
- package/realtime-react/dist/index.cjs +1 -326
- package/realtime-react/dist/index.d.ts +1 -14
- package/realtime-react/dist/index.js +1 -1
- package/realtime-react/src/use-sync-continuity.ts +2 -2
- package/realtime-server/dist/index.cjs +3 -151
- package/realtime-server/dist/index.d.ts +1 -3
- package/realtime-server/dist/index.js +2 -18
- package/realtime-server/src/index.ts +0 -2
- package/realtime-server/src/realtime-continuity-synchronizer.ts +1 -1
- package/realtime-testing/dist/index.cjs +4 -82
- package/realtime-testing/dist/index.js +2 -4
- package/realtime-testing/src/setup-realtime-test.tsx +2 -3
- package/src/dispose-state.ts +2 -2
- package/src/index.ts +1 -0
- package/src/logger.ts +2 -0
- package/src/molecule.ts +133 -0
- package/src/timeline.ts +3 -3
- package/src/transaction.ts +15 -13
- package/dist/chunk-6MLFYN32.js +0 -18
- package/dist/chunk-7DT3PVS3.js +0 -598
- package/dist/chunk-GVHKIJ3G.js +0 -329
- package/dist/chunk-O47EQUM6.js +0 -29
- package/dist/chunk-OAYGID5B.js +0 -27
- package/dist/chunk-PNIHPILQ.js +0 -8
- package/immortal/src/make-molecule.ts +0 -234
- package/immortal/src/molecule.ts +0 -167
- package/realtime-server/src/realtime-state-synchronizer.ts +0 -23
|
@@ -3,17 +3,16 @@
|
|
|
3
3
|
var http = require('http');
|
|
4
4
|
var react = require('@testing-library/react');
|
|
5
5
|
var AtomIO = require('atom.io');
|
|
6
|
+
var data = require('atom.io/data');
|
|
6
7
|
var internal = require('atom.io/internal');
|
|
7
8
|
var AR = require('atom.io/react');
|
|
8
9
|
var RT = require('atom.io/realtime');
|
|
10
|
+
var realtimeClient = require('atom.io/realtime-client');
|
|
9
11
|
var RTR = require('atom.io/realtime-react');
|
|
10
12
|
var RTS = require('atom.io/realtime-server');
|
|
11
13
|
var Happy = require('happy-dom');
|
|
12
14
|
var SocketIO = require('socket.io');
|
|
13
15
|
var socket_ioClient = require('socket.io-client');
|
|
14
|
-
require('atom.io/immortal');
|
|
15
|
-
require('atom.io/json');
|
|
16
|
-
require('atom.io/transceivers/set-rtx');
|
|
17
16
|
var jsxRuntime = require('react/jsx-runtime');
|
|
18
17
|
|
|
19
18
|
function _interopNamespace(e) {
|
|
@@ -65,83 +64,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
65
64
|
|
|
66
65
|
// ../anvl/src/object/entries.ts
|
|
67
66
|
var recordToEntries = (obj) => Object.entries(obj);
|
|
68
|
-
function getJoinMap(store) {
|
|
69
|
-
if (`joins` in store && store.joins instanceof Map) {
|
|
70
|
-
return store.joins;
|
|
71
|
-
}
|
|
72
|
-
const joins = /* @__PURE__ */ new Map();
|
|
73
|
-
store.joins = joins;
|
|
74
|
-
return joins;
|
|
75
|
-
}
|
|
76
|
-
function getJoin(token, store) {
|
|
77
|
-
var _a;
|
|
78
|
-
const joinMap = getJoinMap(store);
|
|
79
|
-
let myJoin = joinMap.get(token.key);
|
|
80
|
-
if (myJoin === void 0) {
|
|
81
|
-
const rootJoinMap = getJoinMap(internal.IMPLICIT.STORE);
|
|
82
|
-
myJoin = (_a = rootJoinMap.get(token.key)) == null ? void 0 : _a.in(store);
|
|
83
|
-
if (myJoin === void 0) {
|
|
84
|
-
throw new Error(
|
|
85
|
-
`Join "${token.key}" not found in store "${store.config.name}"`
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
joinMap.set(token.key, myJoin);
|
|
89
|
-
}
|
|
90
|
-
return myJoin;
|
|
91
|
-
}
|
|
92
|
-
function editRelationsInStore(token, change, store) {
|
|
93
|
-
const myJoin = getJoin(token, store);
|
|
94
|
-
const target = internal.newest(store);
|
|
95
|
-
if (internal.isChildStore(target)) {
|
|
96
|
-
const { transactors } = target.transactionMeta;
|
|
97
|
-
myJoin.transact(transactors, ({ relations }) => {
|
|
98
|
-
change(relations);
|
|
99
|
-
});
|
|
100
|
-
} else {
|
|
101
|
-
change(myJoin.relations);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// __unstable__/web-effects/src/storage.ts
|
|
106
|
-
var persistAtom = (storage) => ({ stringify, parse }) => (key) => ({ setSelf, onSet }) => {
|
|
107
|
-
const savedValue = storage.getItem(key);
|
|
108
|
-
if (savedValue != null)
|
|
109
|
-
setSelf(parse(savedValue));
|
|
110
|
-
onSet(({ newValue }) => {
|
|
111
|
-
if (newValue == null) {
|
|
112
|
-
storage.removeItem(key);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
storage.setItem(key, stringify(newValue));
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
var lazyLocalStorageEffect = persistAtom(window.localStorage)(JSON);
|
|
119
|
-
|
|
120
|
-
// realtime-client/src/realtime-client-stores/client-main-store.ts
|
|
121
|
-
var myIdState__INTERNAL = AtomIO__namespace.atom({
|
|
122
|
-
key: `mySocketId__INTERNAL`,
|
|
123
|
-
default: void 0
|
|
124
|
-
});
|
|
125
|
-
AtomIO__namespace.selector({
|
|
126
|
-
key: `mySocketId`,
|
|
127
|
-
get: ({ get }) => get(myIdState__INTERNAL)
|
|
128
|
-
});
|
|
129
|
-
var usernameEffects = typeof window === `undefined` ? [] : [lazyLocalStorageEffect(`myUsername`)];
|
|
130
|
-
var myUsernameState = AtomIO__namespace.atom({
|
|
131
|
-
key: `myUsername`,
|
|
132
|
-
default: null,
|
|
133
|
-
effects: usernameEffects
|
|
134
|
-
});
|
|
135
|
-
AtomIO__namespace.atom({
|
|
136
|
-
key: `updateQueue`,
|
|
137
|
-
default: []
|
|
138
|
-
});
|
|
139
|
-
AtomIO__namespace.atom(
|
|
140
|
-
{
|
|
141
|
-
key: `serverConfirmedUpdateQueue`,
|
|
142
|
-
default: []
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
67
|
var testNumber = 0;
|
|
146
68
|
var setupRealtimeTestServer = (options) => {
|
|
147
69
|
++testNumber;
|
|
@@ -159,7 +81,7 @@ var setupRealtimeTestServer = (options) => {
|
|
|
159
81
|
if (token === `test` && socket.id) {
|
|
160
82
|
const socketState = internal.findInStore(RTS__namespace.socketAtoms, socket.id, silo.store);
|
|
161
83
|
internal.setIntoStore(socketState, socket, silo.store);
|
|
162
|
-
editRelationsInStore(
|
|
84
|
+
data.editRelationsInStore(
|
|
163
85
|
RTS__namespace.usersOfSockets,
|
|
164
86
|
(relations) => {
|
|
165
87
|
relations.set(socket.id, username);
|
|
@@ -209,7 +131,7 @@ var setupRealtimeTestClient = (options, name, port) => {
|
|
|
209
131
|
silo.store.valueMap.set(key, [...value]);
|
|
210
132
|
}
|
|
211
133
|
}
|
|
212
|
-
silo.setState(myUsernameState, `${name}-${testNumber}`);
|
|
134
|
+
silo.setState(realtimeClient.myUsernameState, `${name}-${testNumber}`);
|
|
213
135
|
const { document } = new Happy__namespace.Window();
|
|
214
136
|
document.body.innerHTML = `<div id="app"></div>`;
|
|
215
137
|
const renderResult = react.render(
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { recordToEntries } from '../../dist/chunk-3V3VWQ7X.js';
|
|
2
|
-
import { myUsernameState } from '../../dist/chunk-O47EQUM6.js';
|
|
3
|
-
import '../../dist/chunk-BWWVY5O5.js';
|
|
4
|
-
import { editRelationsInStore } from '../../dist/chunk-7DT3PVS3.js';
|
|
5
|
-
import '../../dist/chunk-FTONNX2R.js';
|
|
6
2
|
import { __spreadProps, __spreadValues } from '../../dist/chunk-F2X4B4VY.js';
|
|
7
3
|
import * as http from 'http';
|
|
8
4
|
import { render, prettyDOM } from '@testing-library/react';
|
|
9
5
|
import * as AtomIO from 'atom.io';
|
|
6
|
+
import { editRelationsInStore } from 'atom.io/data';
|
|
10
7
|
import { IMPLICIT, findInStore, setIntoStore, getFromStore, clearStore } from 'atom.io/internal';
|
|
11
8
|
import * as AR from 'atom.io/react';
|
|
12
9
|
import * as RT from 'atom.io/realtime';
|
|
10
|
+
import { myUsernameState } from 'atom.io/realtime-client';
|
|
13
11
|
import * as RTR from 'atom.io/realtime-react';
|
|
14
12
|
import * as RTS from 'atom.io/realtime-server';
|
|
15
13
|
import * as Happy from 'happy-dom';
|
|
@@ -3,6 +3,7 @@ import * as http from "node:http"
|
|
|
3
3
|
import type { RenderResult } from "@testing-library/react"
|
|
4
4
|
import { prettyDOM, render } from "@testing-library/react"
|
|
5
5
|
import * as AtomIO from "atom.io"
|
|
6
|
+
import { editRelationsInStore } from "atom.io/data"
|
|
6
7
|
import {
|
|
7
8
|
clearStore,
|
|
8
9
|
findInStore,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
} from "atom.io/internal"
|
|
13
14
|
import * as AR from "atom.io/react"
|
|
14
15
|
import * as RT from "atom.io/realtime"
|
|
16
|
+
import { myUsernameState } from "atom.io/realtime-client"
|
|
15
17
|
import * as RTR from "atom.io/realtime-react"
|
|
16
18
|
import * as RTS from "atom.io/realtime-server"
|
|
17
19
|
import * as Happy from "happy-dom"
|
|
@@ -22,9 +24,6 @@ import { io } from "socket.io-client"
|
|
|
22
24
|
|
|
23
25
|
import { recordToEntries } from "~/packages/anvl/src/object"
|
|
24
26
|
|
|
25
|
-
import { editRelationsInStore } from "../../data/src/join"
|
|
26
|
-
import { myUsernameState } from "../../realtime-client/src/realtime-client-stores"
|
|
27
|
-
|
|
28
27
|
let testNumber = 0
|
|
29
28
|
|
|
30
29
|
export type TestSetupOptions = {
|
package/src/dispose-state.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { MoleculeToken } from "atom.io/immortal"
|
|
2
1
|
import * as Internal from "atom.io/internal"
|
|
3
2
|
|
|
4
3
|
import type { ReadableToken } from "."
|
|
4
|
+
import type { MoleculeToken } from "./molecule"
|
|
5
5
|
|
|
6
6
|
export function disposeState(
|
|
7
|
-
token: MoleculeToken<any
|
|
7
|
+
token: MoleculeToken<any> | ReadableToken<any>,
|
|
8
8
|
): void {
|
|
9
9
|
Internal.disposeFromStore(token, Internal.IMPLICIT.STORE)
|
|
10
10
|
}
|
package/src/index.ts
CHANGED
package/src/logger.ts
CHANGED
package/src/molecule.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Flat,
|
|
3
|
+
MoleculeCreation,
|
|
4
|
+
MoleculeDisposal,
|
|
5
|
+
MutableAtomFamilyToken,
|
|
6
|
+
MutableAtomToken,
|
|
7
|
+
ReadableFamilyToken,
|
|
8
|
+
ReadableToken,
|
|
9
|
+
ReadonlySelectorFamilyToken,
|
|
10
|
+
ReadonlySelectorToken,
|
|
11
|
+
RegularAtomFamilyToken,
|
|
12
|
+
RegularAtomToken,
|
|
13
|
+
TransactorsWithRunAndEnv,
|
|
14
|
+
WritableFamilyToken,
|
|
15
|
+
WritableSelectorFamilyToken,
|
|
16
|
+
WritableSelectorToken,
|
|
17
|
+
WritableToken,
|
|
18
|
+
} from "atom.io"
|
|
19
|
+
import type { JoinToken } from "atom.io/data"
|
|
20
|
+
import type { Store, Subject, Transceiver } from "atom.io/internal"
|
|
21
|
+
import {
|
|
22
|
+
createMoleculeFamily,
|
|
23
|
+
IMPLICIT,
|
|
24
|
+
makeMoleculeInStore,
|
|
25
|
+
Molecule,
|
|
26
|
+
} from "atom.io/internal"
|
|
27
|
+
import { type Json, stringifyJson } from "atom.io/json"
|
|
28
|
+
|
|
29
|
+
export type MoleculeTransactors<K extends Json.Serializable> = Flat<
|
|
30
|
+
Omit<TransactorsWithRunAndEnv, `find`> & {
|
|
31
|
+
bond<T extends Transceiver<any>, J extends Json.Serializable>(
|
|
32
|
+
family: MutableAtomFamilyToken<T, J, K>,
|
|
33
|
+
): MutableAtomToken<T, J>
|
|
34
|
+
bond<T>(family: RegularAtomFamilyToken<T, K>): RegularAtomToken<T>
|
|
35
|
+
bond<T>(family: WritableSelectorFamilyToken<T, K>): WritableSelectorToken<T>
|
|
36
|
+
bond<T>(family: ReadonlySelectorFamilyToken<T, K>): ReadonlySelectorToken<T>
|
|
37
|
+
bond<T>(family: WritableFamilyToken<T, K>): WritableToken<T>
|
|
38
|
+
bond<T>(family: ReadableFamilyToken<T, K>): ReadableToken<T>
|
|
39
|
+
|
|
40
|
+
join(joinToken: JoinToken<any, any, any, any>): void
|
|
41
|
+
|
|
42
|
+
spawn<Key extends Json.Serializable, Ctor extends MoleculeConstructor>(
|
|
43
|
+
family: MoleculeFamilyToken<Ctor>,
|
|
44
|
+
key: Key,
|
|
45
|
+
...params: MoleculeParams<Ctor>
|
|
46
|
+
): MoleculeToken<Ctor>
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
export type MoleculeConstructor = new (
|
|
50
|
+
transactors: MoleculeTransactors<any>,
|
|
51
|
+
key: Json.Serializable,
|
|
52
|
+
...params: any
|
|
53
|
+
) => any
|
|
54
|
+
|
|
55
|
+
type Tail<T extends any[]> = T extends [any, ...infer Rest] ? Rest : any[]
|
|
56
|
+
|
|
57
|
+
export type MoleculeParams<M extends MoleculeConstructor> = Tail<
|
|
58
|
+
Tail<ConstructorParameters<M>>
|
|
59
|
+
>
|
|
60
|
+
|
|
61
|
+
export type MoleculeFamilyOptions<M extends MoleculeConstructor> = {
|
|
62
|
+
key: string
|
|
63
|
+
dependsOn?: `all` | `any`
|
|
64
|
+
new: M
|
|
65
|
+
}
|
|
66
|
+
export type MoleculeFamilyToken<M extends MoleculeConstructor> = {
|
|
67
|
+
key: string
|
|
68
|
+
type: `molecule_family`
|
|
69
|
+
dependsOn: `all` | `any`
|
|
70
|
+
__M?: M
|
|
71
|
+
}
|
|
72
|
+
export type MoleculeFamily<M extends MoleculeConstructor> = Flat<
|
|
73
|
+
MoleculeFamilyToken<M> & {
|
|
74
|
+
subject: Subject<MoleculeCreation<M> | MoleculeDisposal>
|
|
75
|
+
dependsOn: `all` | `any`
|
|
76
|
+
new: M
|
|
77
|
+
}
|
|
78
|
+
>
|
|
79
|
+
export type MoleculeToken<M extends MoleculeConstructor> = {
|
|
80
|
+
key: MK<M>
|
|
81
|
+
type: `molecule`
|
|
82
|
+
family?: MoleculeFamilyToken<M>
|
|
83
|
+
__M?: M
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function moleculeFamily<M extends MoleculeConstructor>(
|
|
87
|
+
options: MoleculeFamilyOptions<M>,
|
|
88
|
+
): MoleculeFamilyToken<M> {
|
|
89
|
+
return createMoleculeFamily(options, IMPLICIT.STORE)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function makeMolecule<M extends MoleculeConstructor>(
|
|
93
|
+
context: MoleculeToken<any> | MoleculeToken<any>[],
|
|
94
|
+
family: MoleculeFamilyToken<M>,
|
|
95
|
+
key: MoleculeKey<M>,
|
|
96
|
+
...params: MoleculeParams<M>
|
|
97
|
+
): MoleculeToken<M> {
|
|
98
|
+
return makeMoleculeInStore(IMPLICIT.STORE, context, family, key, ...params)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function useMoleculeFromStore<M extends MoleculeConstructor>(
|
|
102
|
+
token: MoleculeToken<M>,
|
|
103
|
+
store: Store,
|
|
104
|
+
): InstanceType<M> | undefined {
|
|
105
|
+
const molecule = store.molecules.get(stringifyJson(token.key))
|
|
106
|
+
return molecule?.instance
|
|
107
|
+
}
|
|
108
|
+
export function useMolecule<M extends MoleculeConstructor>(
|
|
109
|
+
token: MoleculeToken<M>,
|
|
110
|
+
): InstanceType<M> | undefined {
|
|
111
|
+
return useMoleculeFromStore(token, IMPLICIT.STORE)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type MoleculeType<T extends MoleculeFamilyToken<any>> =
|
|
115
|
+
T extends MoleculeFamilyToken<infer M>
|
|
116
|
+
? M
|
|
117
|
+
: T extends MoleculeToken<infer M>
|
|
118
|
+
? M
|
|
119
|
+
: never
|
|
120
|
+
export type MoleculeKey<M extends MoleculeConstructor> = InstanceType<M>[`key`]
|
|
121
|
+
export type MK<M extends MoleculeConstructor> = MoleculeKey<M>
|
|
122
|
+
|
|
123
|
+
export function makeRootMolecule(
|
|
124
|
+
key: string,
|
|
125
|
+
store: Store = IMPLICIT.STORE,
|
|
126
|
+
): MoleculeToken<ObjectConstructor> {
|
|
127
|
+
const molecule = new Molecule(undefined, key)
|
|
128
|
+
store.molecules.set(stringifyJson(key), molecule)
|
|
129
|
+
return {
|
|
130
|
+
key,
|
|
131
|
+
type: `molecule`,
|
|
132
|
+
} as const
|
|
133
|
+
}
|
package/src/timeline.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MoleculeFamilyToken } from "atom.io
|
|
1
|
+
import type { MoleculeFamilyToken } from "atom.io"
|
|
2
2
|
import type {
|
|
3
3
|
Timeline,
|
|
4
4
|
TimelineAtomUpdate,
|
|
@@ -31,7 +31,7 @@ export type TimelineToken<M> = {
|
|
|
31
31
|
|
|
32
32
|
export type TimelineOptions<ManagedAtom extends TimelineManageable> = {
|
|
33
33
|
key: string
|
|
34
|
-
scope: (ManagedAtom | MoleculeFamilyToken<any
|
|
34
|
+
scope: (ManagedAtom | MoleculeFamilyToken<any>)[]
|
|
35
35
|
shouldCapture?: (
|
|
36
36
|
update: TimelineUpdate<ManagedAtom>,
|
|
37
37
|
timeline: Timeline<TimelineManageable>,
|
|
@@ -41,7 +41,7 @@ export type TimelineOptions<ManagedAtom extends TimelineManageable> = {
|
|
|
41
41
|
export type TimelineUpdate<ManagedAtom extends TimelineManageable> =
|
|
42
42
|
| TimelineAtomUpdate<ManagedAtom>
|
|
43
43
|
| TimelineMoleculeCreation<any>
|
|
44
|
-
| TimelineMoleculeDisposal
|
|
44
|
+
| TimelineMoleculeDisposal
|
|
45
45
|
| TimelineSelectorUpdate<ManagedAtom>
|
|
46
46
|
| TimelineStateCreation<AtomOnly<ManagedAtom>>
|
|
47
47
|
| TimelineStateDisposal<AtomOnly<ManagedAtom>>
|
package/src/transaction.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { findState } from "atom.io/ephemeral"
|
|
2
1
|
import type {
|
|
3
2
|
makeMolecule,
|
|
3
|
+
MoleculeConstructor,
|
|
4
4
|
MoleculeFamilyToken,
|
|
5
|
+
MoleculeParams,
|
|
5
6
|
MoleculeToken,
|
|
6
|
-
|
|
7
|
-
} from "atom.io/
|
|
7
|
+
} from "atom.io"
|
|
8
|
+
import type { findState } from "atom.io/ephemeral"
|
|
9
|
+
import type { seekState } from "atom.io/immortal"
|
|
8
10
|
import type { EnvironmentData, Transceiver } from "atom.io/internal"
|
|
9
11
|
import {
|
|
10
12
|
actUponStore,
|
|
@@ -42,25 +44,25 @@ export type StateDisposal<Token extends ReadableToken<any>> = {
|
|
|
42
44
|
value?: TokenType<Token>
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
export type MoleculeCreation<
|
|
47
|
+
export type MoleculeCreation<M extends MoleculeConstructor> = {
|
|
46
48
|
type: `molecule_creation`
|
|
47
|
-
token: MoleculeToken<
|
|
48
|
-
family: MoleculeFamilyToken<
|
|
49
|
-
context: MoleculeToken<any
|
|
50
|
-
params:
|
|
49
|
+
token: MoleculeToken<M>
|
|
50
|
+
family: MoleculeFamilyToken<M>
|
|
51
|
+
context: MoleculeToken<any>[]
|
|
52
|
+
params: MoleculeParams<M>
|
|
51
53
|
}
|
|
52
|
-
export type MoleculeDisposal
|
|
54
|
+
export type MoleculeDisposal = {
|
|
53
55
|
type: `molecule_disposal`
|
|
54
|
-
token: MoleculeToken<
|
|
55
|
-
family: MoleculeFamilyToken<any
|
|
56
|
-
context: MoleculeToken<any
|
|
56
|
+
token: MoleculeToken<any>
|
|
57
|
+
family: MoleculeFamilyToken<any>
|
|
58
|
+
context: MoleculeToken<any>[]
|
|
57
59
|
familyKeys: string[]
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
export type TransactionUpdateContent =
|
|
61
63
|
| KeyedStateUpdate<unknown>
|
|
62
64
|
| MoleculeCreation<any>
|
|
63
|
-
| MoleculeDisposal
|
|
65
|
+
| MoleculeDisposal
|
|
64
66
|
| StateCreation<ReadableToken<unknown>>
|
|
65
67
|
| StateDisposal<ReadableToken<unknown>>
|
|
66
68
|
| TransactionUpdate<Func>
|
package/dist/chunk-6MLFYN32.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// ../anvl/src/primitive/index.ts
|
|
2
|
-
var isString = (input) => {
|
|
3
|
-
return typeof input === `string`;
|
|
4
|
-
};
|
|
5
|
-
var isNumber = (input) => {
|
|
6
|
-
return typeof input === `number`;
|
|
7
|
-
};
|
|
8
|
-
var isBoolean = (input) => {
|
|
9
|
-
return typeof input === `boolean`;
|
|
10
|
-
};
|
|
11
|
-
var isNull = (input) => {
|
|
12
|
-
return input === null;
|
|
13
|
-
};
|
|
14
|
-
var isPrimitive = (input) => {
|
|
15
|
-
return isString(input) || isNumber(input) || isBoolean(input) || isNull(input);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { isBoolean, isNull, isNumber, isPrimitive, isString };
|