atom.io 0.30.0 → 0.30.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.d.ts +84 -51
- package/data/dist/index.js +35 -31
- package/data/src/join.ts +240 -134
- package/dist/chunk-ADMEAXYU.js +167 -0
- package/dist/{chunk-7PUUHSXC.js → chunk-SMKF3ZNG.js} +45 -171
- package/dist/index.d.ts +53 -5
- package/dist/index.js +1 -1
- package/internal/dist/index.d.ts +62 -35
- package/internal/dist/index.js +2 -2
- package/internal/src/junction.ts +152 -84
- package/internal/src/molecule/make-molecule-in-store.ts +3 -1
- package/internal/src/molecule/molecule-internal.ts +1 -1
- package/internal/src/mutable/create-mutable-atom-family.ts +2 -2
- package/internal/src/mutable/get-json-family.ts +2 -2
- package/internal/src/store/store.ts +4 -0
- package/internal/src/transaction/index.ts +1 -1
- package/json/dist/index.js +2 -2
- package/package.json +15 -15
- package/realtime/dist/index.d.ts +1 -1
- package/realtime/dist/index.js +3 -1
- package/realtime/src/shared-room-store.ts +2 -0
- package/realtime-server/dist/index.d.ts +13 -4
- package/realtime-server/dist/index.js +4 -2
- package/realtime-server/src/realtime-continuity-synchronizer.ts +2 -2
- package/realtime-server/src/realtime-server-stores/server-user-store.ts +17 -1
- package/realtime-testing/dist/index.d.ts +3 -0
- package/realtime-testing/dist/index.js +11 -4
- package/realtime-testing/src/setup-realtime-test.tsx +12 -4
- package/src/allocate.ts +7 -8
- package/src/index.ts +1 -0
- package/src/molecule.ts +5 -3
- package/dist/chunk-ZKG6ZA4I.js +0 -20
package/data/dist/index.d.ts
CHANGED
|
@@ -1,116 +1,149 @@
|
|
|
1
1
|
import * as AtomIO from 'atom.io';
|
|
2
2
|
import { ReadonlySelectorFamilyToken, MutableAtomFamilyToken, SetterToolkit, disposeState, ReadonlySelectorToken } from 'atom.io';
|
|
3
|
-
import { Store,
|
|
3
|
+
import { Store, JunctionSchemaBase, JunctionEntriesBase, Molecule, Junction } from 'atom.io/internal';
|
|
4
4
|
import { Canonical, stringified, Json } from 'atom.io/json';
|
|
5
5
|
import { findState } from 'atom.io/ephemeral';
|
|
6
|
+
import { Refinement } from 'atom.io/introspection';
|
|
6
7
|
import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
|
|
7
8
|
|
|
8
9
|
declare function dict<State, Key extends Canonical>(family: AtomIO.ReadonlySelectorFamilyToken<State, Key> | AtomIO.RegularAtomFamilyToken<State, Key> | AtomIO.WritableSelectorFamilyToken<State, Key>, index: AtomIO.ReadonlySelectorToken<Key[]> | AtomIO.RegularAtomToken<Key[]> | AtomIO.WritableSelectorToken<Key[]>, store?: Store): AtomIO.ReadonlySelectorToken<{
|
|
9
10
|
[K in stringified<Key>]: State;
|
|
10
11
|
}>;
|
|
11
12
|
|
|
12
|
-
interface JoinOptions<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> extends
|
|
13
|
+
interface JoinOptions<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> extends JunctionSchemaBase<ASide, BSide>, Partial<JunctionEntriesBase<AType, BType, Content>> {
|
|
13
14
|
readonly key: string;
|
|
14
15
|
readonly cardinality: Cardinality;
|
|
16
|
+
readonly isAType: Refinement<string, AType>;
|
|
17
|
+
readonly isBType: Refinement<string, BType>;
|
|
15
18
|
}
|
|
16
|
-
type JoinStateFamilies<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
|
|
17
|
-
readonly [
|
|
18
|
-
|
|
19
|
+
type JoinStateFamilies<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
|
|
20
|
+
readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
|
|
21
|
+
AType,
|
|
22
|
+
Content
|
|
23
|
+
] | null, BType>;
|
|
24
|
+
} & {
|
|
25
|
+
readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
|
|
26
|
+
BType,
|
|
19
27
|
Content
|
|
20
|
-
] | null,
|
|
28
|
+
] | null, AType>;
|
|
21
29
|
} : {}) & {
|
|
22
|
-
readonly [
|
|
30
|
+
readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
|
|
31
|
+
} & {
|
|
32
|
+
readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType | null, AType>;
|
|
23
33
|
} : Cardinality extends `1:n` ? (Content extends Json.Object ? {
|
|
24
34
|
readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
|
|
25
|
-
|
|
35
|
+
AType,
|
|
26
36
|
Content
|
|
27
|
-
] | null,
|
|
37
|
+
] | null, BType>;
|
|
28
38
|
} & {
|
|
29
39
|
readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
|
|
30
|
-
|
|
40
|
+
BType,
|
|
31
41
|
Content
|
|
32
|
-
][],
|
|
42
|
+
][], AType>;
|
|
33
43
|
} : {}) & {
|
|
34
|
-
readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<
|
|
44
|
+
readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
|
|
35
45
|
} & {
|
|
36
|
-
readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<
|
|
46
|
+
readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
|
|
37
47
|
} : Cardinality extends `n:n` ? (Content extends Json.Object ? {
|
|
38
|
-
readonly [
|
|
39
|
-
|
|
48
|
+
readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
|
|
49
|
+
AType,
|
|
40
50
|
Content
|
|
41
|
-
][],
|
|
51
|
+
][], BType>;
|
|
52
|
+
} & {
|
|
53
|
+
readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
|
|
54
|
+
BType,
|
|
55
|
+
Content
|
|
56
|
+
][], AType>;
|
|
42
57
|
} : {}) & {
|
|
43
|
-
readonly [
|
|
58
|
+
readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType[], BType>;
|
|
59
|
+
} & {
|
|
60
|
+
readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
|
|
44
61
|
} : never;
|
|
45
|
-
declare class Join<const ASide extends string, const BSide extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object | null = null> {
|
|
62
|
+
declare class Join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object | null = null> {
|
|
46
63
|
private options;
|
|
47
64
|
private defaultContent;
|
|
48
65
|
private toolkit;
|
|
49
66
|
retrieve: typeof findState;
|
|
50
67
|
molecules: Map<string, Molecule<any>>;
|
|
51
|
-
relations: Junction<ASide, BSide, Content>;
|
|
52
|
-
states: JoinStateFamilies<ASide, BSide, Cardinality, Content>;
|
|
68
|
+
relations: Junction<ASide, AType, BSide, BType, Content>;
|
|
69
|
+
states: JoinStateFamilies<ASide, AType, BSide, BType, Cardinality, Content>;
|
|
53
70
|
core: {
|
|
54
71
|
findRelatedKeysState: MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
|
|
55
72
|
};
|
|
56
73
|
transact(toolkit: SetterToolkit & {
|
|
57
74
|
dispose: typeof disposeState;
|
|
58
|
-
}, run: (join: Join<ASide, BSide, Cardinality, Content>) => void): void;
|
|
75
|
+
}, run: (join: Join<ASide, AType, BSide, BType, Cardinality, Content>) => void): void;
|
|
59
76
|
store: Store;
|
|
60
|
-
alternates: Map<string, Join<ASide, BSide, Cardinality, Content>>;
|
|
77
|
+
alternates: Map<string, Join<ASide, AType, BSide, BType, Cardinality, Content>>;
|
|
61
78
|
[Symbol.dispose](): void;
|
|
62
|
-
in(store: Store): Join<ASide, BSide, Cardinality, Content>;
|
|
63
|
-
constructor(options: JoinOptions<ASide, BSide, Cardinality, Content>, defaultContent: Content | undefined, store?: Store);
|
|
79
|
+
in(store: Store): Join<ASide, AType, BSide, BType, Cardinality, Content>;
|
|
80
|
+
constructor(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content | undefined, store?: Store);
|
|
64
81
|
}
|
|
65
|
-
type JoinToken<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null = null> = {
|
|
82
|
+
type JoinToken<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null = null> = {
|
|
66
83
|
key: string;
|
|
67
84
|
type: `join`;
|
|
68
85
|
cardinality: Cardinality;
|
|
69
86
|
a: ASide;
|
|
70
87
|
b: BSide;
|
|
88
|
+
__aType?: AType;
|
|
89
|
+
__bType?: BType;
|
|
71
90
|
__content?: Content;
|
|
72
91
|
};
|
|
73
|
-
declare function join<const ASide extends string, const BSide extends string, const Cardinality extends `1:1` | `1:n` | `n:n`>(options: JoinOptions<ASide, BSide, Cardinality, null>, defaultContent?: undefined, store?: Store): JoinToken<ASide, BSide, Cardinality, null>;
|
|
74
|
-
declare function join<const ASide extends string, const BSide extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object>(options: JoinOptions<ASide, BSide, Cardinality, Content>, defaultContent: Content, store?: Store): JoinToken<ASide, BSide, Cardinality, Content>;
|
|
92
|
+
declare function join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, null>, defaultContent?: undefined, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, null>;
|
|
93
|
+
declare function join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, Content>;
|
|
75
94
|
declare function getJoinMap(store: Store & {
|
|
76
|
-
joins?: Map<string, Join<any, any, any, any>>;
|
|
77
|
-
}): Map<string, Join<any, any, any, any>>;
|
|
78
|
-
declare function getJoin<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, BSide, Cardinality, Content>, store: Store): Join<ASide, BSide, Cardinality, Content>;
|
|
79
|
-
type JoinStates<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
|
|
80
|
-
readonly [
|
|
81
|
-
|
|
95
|
+
joins?: Map<string, Join<any, any, any, any, any, any>>;
|
|
96
|
+
}): Map<string, Join<any, any, any, any, any, any>>;
|
|
97
|
+
declare function getJoin<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, store: Store): Join<ASide, AType, BSide, BType, Cardinality, Content>;
|
|
98
|
+
type JoinStates<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
|
|
99
|
+
readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
|
|
100
|
+
AType,
|
|
101
|
+
Content
|
|
102
|
+
] | null, BType>;
|
|
103
|
+
} & {
|
|
104
|
+
readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
|
|
105
|
+
BType,
|
|
82
106
|
Content
|
|
83
|
-
] | null>;
|
|
107
|
+
] | null, AType>;
|
|
84
108
|
} : {}) & {
|
|
85
|
-
readonly [
|
|
109
|
+
readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
|
|
110
|
+
} & {
|
|
111
|
+
readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType | null, AType>;
|
|
86
112
|
} : Cardinality extends `1:n` ? (Content extends Json.Object ? {
|
|
87
113
|
readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
|
|
88
|
-
|
|
114
|
+
AType,
|
|
89
115
|
Content
|
|
90
|
-
] | null>;
|
|
116
|
+
] | null, BType>;
|
|
91
117
|
} & {
|
|
92
118
|
readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
|
|
93
|
-
|
|
119
|
+
BType,
|
|
94
120
|
Content
|
|
95
|
-
][]>;
|
|
121
|
+
][], AType>;
|
|
96
122
|
} : {}) & {
|
|
97
|
-
readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<
|
|
123
|
+
readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
|
|
98
124
|
} & {
|
|
99
|
-
readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<
|
|
125
|
+
readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
|
|
100
126
|
} : Cardinality extends `n:n` ? (Content extends Json.Object ? {
|
|
101
|
-
readonly [
|
|
102
|
-
|
|
127
|
+
readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
|
|
128
|
+
AType,
|
|
103
129
|
Content
|
|
104
|
-
][]>;
|
|
130
|
+
][], BType>;
|
|
131
|
+
} & {
|
|
132
|
+
readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
|
|
133
|
+
BType,
|
|
134
|
+
Content
|
|
135
|
+
][], AType>;
|
|
105
136
|
} : {}) & {
|
|
106
|
-
readonly [
|
|
137
|
+
readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType[], BType>;
|
|
138
|
+
} & {
|
|
139
|
+
readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
|
|
107
140
|
} : never;
|
|
108
|
-
declare function findRelationsInStore<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, BSide, Cardinality, Content>, key:
|
|
109
|
-
declare function findRelations<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, BSide, Cardinality, Content>, key:
|
|
110
|
-
declare function editRelationsInStore<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, BSide, Cardinality, Content>, change: (relations: Junction<ASide, BSide, Content>) => void, store: Store): void;
|
|
111
|
-
declare function editRelations<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, BSide, Cardinality, Content>, change: (relations: Junction<ASide, BSide, Content>) => void): void;
|
|
112
|
-
declare function getInternalRelationsFromStore(token: JoinToken<any, any, any, any>, store: Store): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
|
|
113
|
-
declare function getInternalRelations<ASide extends string, BSide extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, BSide, Cardinality, Content>): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
|
|
141
|
+
declare function findRelationsInStore<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, key: AType | BType, store: Store): JoinStates<ASide, AType, BSide, BType, Cardinality, Content>;
|
|
142
|
+
declare function findRelations<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, key: AType | BType): JoinStates<ASide, AType, BSide, BType, Cardinality, Content>;
|
|
143
|
+
declare function editRelationsInStore<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, change: (relations: Junction<ASide, AType, BSide, BType, Content>) => void, store: Store): void;
|
|
144
|
+
declare function editRelations<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, change: (relations: Junction<ASide, AType, BSide, BType, Content>) => void): void;
|
|
145
|
+
declare function getInternalRelationsFromStore(token: JoinToken<any, any, any, any, any, any>, store: Store): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
|
|
146
|
+
declare function getInternalRelations<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
|
|
114
147
|
|
|
115
148
|
declare function struct<Struct extends {
|
|
116
149
|
[key: string]: unknown;
|
package/data/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var Join = class _Join {
|
|
|
61
61
|
if (maybeToken) {
|
|
62
62
|
return maybeToken;
|
|
63
63
|
}
|
|
64
|
-
const molecule = this.molecules.get(stringifyJson(key));
|
|
64
|
+
const molecule = this.store.molecules.get(stringifyJson(key));
|
|
65
65
|
if (molecule) {
|
|
66
66
|
const family = withdraw(token, store);
|
|
67
67
|
return growMoleculeInStore(molecule, family, store);
|
|
@@ -231,13 +231,6 @@ var Join = class _Join {
|
|
|
231
231
|
},
|
|
232
232
|
[`join`, `content`]
|
|
233
233
|
);
|
|
234
|
-
({
|
|
235
|
-
key: options.key,
|
|
236
|
-
type: `join`,
|
|
237
|
-
a: options.between[0],
|
|
238
|
-
b: options.between[1],
|
|
239
|
-
cardinality: options.cardinality
|
|
240
|
-
});
|
|
241
234
|
contentMolecules = createMoleculeFamily(store, {
|
|
242
235
|
key: `${options.key}/content-molecules`,
|
|
243
236
|
new: class ContentMolecule {
|
|
@@ -276,30 +269,35 @@ var Join = class _Join {
|
|
|
276
269
|
} else {
|
|
277
270
|
externalStore = baseExternalStoreConfiguration;
|
|
278
271
|
}
|
|
279
|
-
const relations = new Junction(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
target,
|
|
291
|
-
[m0, m1],
|
|
292
|
-
contentMolecules,
|
|
293
|
-
compositeKey
|
|
294
|
-
);
|
|
295
|
-
this.molecules.set(
|
|
296
|
-
`"${compositeKey}"`,
|
|
297
|
-
withdraw(moleculeToken, target)
|
|
272
|
+
const relations = new Junction(
|
|
273
|
+
options,
|
|
274
|
+
{
|
|
275
|
+
externalStore,
|
|
276
|
+
isAType: options.isAType,
|
|
277
|
+
isBType: options.isBType,
|
|
278
|
+
makeContentKey: (...args) => {
|
|
279
|
+
const sorted = args.sort();
|
|
280
|
+
const compositeKey = `${sorted[0]}:${sorted[1]}`;
|
|
281
|
+
const [m0, m1] = sorted.map(
|
|
282
|
+
(key) => this.molecules.get(stringifyJson(key))
|
|
298
283
|
);
|
|
284
|
+
if (store.config.lifespan === `immortal` && m0 && m1) {
|
|
285
|
+
const target = newest(store);
|
|
286
|
+
const moleculeToken = makeMoleculeInStore(
|
|
287
|
+
target,
|
|
288
|
+
[m0, m1],
|
|
289
|
+
contentMolecules,
|
|
290
|
+
compositeKey
|
|
291
|
+
);
|
|
292
|
+
this.molecules.set(
|
|
293
|
+
`"${compositeKey}"`,
|
|
294
|
+
withdraw(moleculeToken, target)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
return compositeKey;
|
|
299
298
|
}
|
|
300
|
-
return compositeKey;
|
|
301
299
|
}
|
|
302
|
-
|
|
300
|
+
);
|
|
303
301
|
const createSingleKeyStateFamily = () => createReadonlySelectorFamily(
|
|
304
302
|
store,
|
|
305
303
|
{
|
|
@@ -338,7 +336,10 @@ var Join = class _Join {
|
|
|
338
336
|
const relatedKeysState = this.retrieve(relatedKeysAtoms, key);
|
|
339
337
|
const relatedKeys = get(relatedKeysState);
|
|
340
338
|
for (const relatedKey of relatedKeys) {
|
|
341
|
-
const contentKey = relations.makeContentKey(
|
|
339
|
+
const contentKey = relations.makeContentKey(
|
|
340
|
+
key,
|
|
341
|
+
relatedKey
|
|
342
|
+
);
|
|
342
343
|
const contentState = this.retrieve(contentAtoms, contentKey);
|
|
343
344
|
const content = get(contentState);
|
|
344
345
|
return [relatedKey, content];
|
|
@@ -357,7 +358,10 @@ var Join = class _Join {
|
|
|
357
358
|
const jsonState = this.retrieve(jsonFamily, key);
|
|
358
359
|
const json = get(jsonState);
|
|
359
360
|
return json.members.map((relatedKey) => {
|
|
360
|
-
const contentKey = relations.makeContentKey(
|
|
361
|
+
const contentKey = relations.makeContentKey(
|
|
362
|
+
key,
|
|
363
|
+
relatedKey
|
|
364
|
+
);
|
|
361
365
|
const contentState = this.retrieve(contentAtoms, contentKey);
|
|
362
366
|
const content = get(contentState);
|
|
363
367
|
return [relatedKey, content];
|