atom.io 0.23.5 → 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
package/data/dist/index.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var internal = require('atom.io/internal');
|
|
4
|
-
var atom_io = require('atom.io');
|
|
5
|
-
var immortal = require('atom.io/immortal');
|
|
6
4
|
var json = require('atom.io/json');
|
|
7
5
|
var setRtx = require('atom.io/transceivers/set-rtx');
|
|
8
6
|
|
|
@@ -301,7 +299,10 @@ var Join = class _Join {
|
|
|
301
299
|
},
|
|
302
300
|
find: (token, key) => internal.findInStore(token, key, store),
|
|
303
301
|
seek: (token, key) => internal.seekInStore(token, key, store),
|
|
304
|
-
json: (token) => internal.getJsonToken(token, store)
|
|
302
|
+
json: (token) => internal.getJsonToken(token, store),
|
|
303
|
+
dispose: (token) => {
|
|
304
|
+
internal.disposeFromStore(token, store);
|
|
305
|
+
}
|
|
305
306
|
};
|
|
306
307
|
this.retrieve = (token, key) => {
|
|
307
308
|
const maybeToken = this.transactors.seek(token, key);
|
|
@@ -309,13 +310,14 @@ var Join = class _Join {
|
|
|
309
310
|
return maybeToken;
|
|
310
311
|
}
|
|
311
312
|
const molecule = this.molecules.get(json.stringifyJson(key));
|
|
312
|
-
if (
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
313
|
+
if (molecule) {
|
|
314
|
+
const family = internal.withdraw(token, store);
|
|
315
|
+
return internal.growMoleculeInStore(molecule, family, store);
|
|
316
|
+
}
|
|
317
|
+
if (store.config.lifespan === `immortal`) {
|
|
318
|
+
throw new Error(`No molecule found for key "${json.stringifyJson(key)}"`);
|
|
317
319
|
}
|
|
318
|
-
return
|
|
320
|
+
return internal.initFamilyMemberInStore(token, key, store);
|
|
319
321
|
};
|
|
320
322
|
const aSide = options.between[0];
|
|
321
323
|
const bSide = options.between[1];
|
|
@@ -339,7 +341,6 @@ var Join = class _Join {
|
|
|
339
341
|
set(bKeysState, (bKeys) => bKeys.add(a));
|
|
340
342
|
};
|
|
341
343
|
const deleteRelation = (transactors, a, b) => {
|
|
342
|
-
var _a, _b;
|
|
343
344
|
const { set } = transactors;
|
|
344
345
|
const aKeysState = this.retrieve(relatedKeysAtoms, a);
|
|
345
346
|
const bKeysState = this.retrieve(relatedKeysAtoms, b);
|
|
@@ -359,13 +360,17 @@ var Join = class _Join {
|
|
|
359
360
|
}
|
|
360
361
|
return bKeys;
|
|
361
362
|
});
|
|
362
|
-
if (stringA
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
if (stringA) {
|
|
364
|
+
const molecule = this.molecules.get(stringA);
|
|
365
|
+
if (molecule) {
|
|
366
|
+
this.transactors.dispose(molecule);
|
|
367
|
+
}
|
|
365
368
|
}
|
|
366
|
-
if (stringB
|
|
367
|
-
|
|
368
|
-
|
|
369
|
+
if (stringB) {
|
|
370
|
+
const molecule = this.molecules.get(stringB);
|
|
371
|
+
if (molecule) {
|
|
372
|
+
this.transactors.dispose(molecule);
|
|
373
|
+
}
|
|
369
374
|
}
|
|
370
375
|
};
|
|
371
376
|
const replaceRelationsSafely = (transactors, a, newRelationsOfA) => {
|
|
@@ -412,8 +417,9 @@ var Join = class _Join {
|
|
|
412
417
|
}
|
|
413
418
|
for (const previousOwner of previousOwnersToDispose) {
|
|
414
419
|
const molecule = this.molecules.get(previousOwner);
|
|
415
|
-
|
|
416
|
-
|
|
420
|
+
if (molecule) {
|
|
421
|
+
this.transactors.dispose(molecule);
|
|
422
|
+
}
|
|
417
423
|
const sorted = [newRelationB, previousOwner].sort();
|
|
418
424
|
const compositeKey = `"${sorted[0]}:${sorted[1]}"`;
|
|
419
425
|
this.molecules.delete(compositeKey);
|
|
@@ -481,12 +487,20 @@ var Join = class _Join {
|
|
|
481
487
|
},
|
|
482
488
|
store
|
|
483
489
|
);
|
|
484
|
-
|
|
490
|
+
const joinToken = {
|
|
491
|
+
key: options.key,
|
|
492
|
+
type: `join`,
|
|
493
|
+
a: options.between[0],
|
|
494
|
+
b: options.between[1],
|
|
495
|
+
cardinality: options.cardinality
|
|
496
|
+
};
|
|
497
|
+
contentMolecules = internal.createMoleculeFamily(
|
|
485
498
|
{
|
|
486
499
|
key: `${options.key}/content-molecules`,
|
|
487
|
-
new:
|
|
488
|
-
constructor(
|
|
489
|
-
|
|
500
|
+
new: class ContentMolecule {
|
|
501
|
+
constructor(transactors, key) {
|
|
502
|
+
this.key = key;
|
|
503
|
+
transactors.join(joinToken);
|
|
490
504
|
}
|
|
491
505
|
}
|
|
492
506
|
},
|
|
@@ -497,8 +511,11 @@ var Join = class _Join {
|
|
|
497
511
|
set(this.retrieve(contentAtoms, key), content);
|
|
498
512
|
};
|
|
499
513
|
const deleteContent = (_, compositeKey) => {
|
|
500
|
-
|
|
501
|
-
|
|
514
|
+
const contentMolecule = store.molecules.get(`"${compositeKey}"`);
|
|
515
|
+
if (contentMolecule) {
|
|
516
|
+
this.transactors.dispose(contentMolecule);
|
|
517
|
+
this.molecules.delete(`"${compositeKey}"`);
|
|
518
|
+
}
|
|
502
519
|
};
|
|
503
520
|
const externalStoreWithContentConfiguration = {
|
|
504
521
|
getContent: (contentKey) => {
|
|
@@ -528,10 +545,17 @@ var Join = class _Join {
|
|
|
528
545
|
(key) => this.molecules.get(json.stringifyJson(key))
|
|
529
546
|
);
|
|
530
547
|
if (store.config.lifespan === `immortal` && m0 && m1) {
|
|
531
|
-
const composite = m0.with(m1)(compositeKey);
|
|
532
|
-
this.molecules.set(`"${compositeKey}"`, composite);
|
|
533
548
|
const target = internal.newest(store);
|
|
534
|
-
|
|
549
|
+
const moleculeToken = internal.makeMoleculeInStore(
|
|
550
|
+
target,
|
|
551
|
+
[m0, m1],
|
|
552
|
+
contentMolecules,
|
|
553
|
+
compositeKey
|
|
554
|
+
);
|
|
555
|
+
this.molecules.set(
|
|
556
|
+
`"${compositeKey}"`,
|
|
557
|
+
internal.withdraw(moleculeToken, target)
|
|
558
|
+
);
|
|
535
559
|
}
|
|
536
560
|
return compositeKey;
|
|
537
561
|
}
|
package/data/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as AtomIO from 'atom.io';
|
|
2
|
-
import { ReadonlySelectorFamily, MutableAtomFamily, Transactors, ReadonlySelectorToken, MutableAtomFamilyToken } from 'atom.io';
|
|
3
|
-
import { Store } from 'atom.io/internal';
|
|
2
|
+
import { ReadonlySelectorFamily, MutableAtomFamily, Transactors, disposeState, ReadonlySelectorToken, MutableAtomFamilyToken } from 'atom.io';
|
|
3
|
+
import { Store, Molecule } from 'atom.io/internal';
|
|
4
4
|
import { Json, Stringified } from 'atom.io/json';
|
|
5
5
|
import { findState } from 'atom.io/ephemeral';
|
|
6
|
-
import { Molecule } from 'atom.io/immortal';
|
|
7
6
|
import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
|
|
8
7
|
|
|
9
8
|
declare function dict<State, Key extends Json.Serializable>(findState: AtomIO.ReadonlySelectorFamilyToken<State, Key> | AtomIO.RegularAtomFamilyToken<State, Key> | AtomIO.WritableSelectorFamily<State, Key>, index: AtomIO.ReadonlySelectorToken<Key[]> | AtomIO.RegularAtomToken<Key[]> | AtomIO.WritableSelectorToken<Key[]>, store?: Store): AtomIO.ReadonlySelectorToken<{
|
|
@@ -128,7 +127,9 @@ declare class Join<const ASide extends string, const BSide extends string, const
|
|
|
128
127
|
core: {
|
|
129
128
|
findRelatedKeysState: MutableAtomFamily<SetRTX<string>, SetRTXJson<string>, string>;
|
|
130
129
|
};
|
|
131
|
-
transact(transactors: Transactors
|
|
130
|
+
transact(transactors: Transactors & {
|
|
131
|
+
dispose: typeof disposeState;
|
|
132
|
+
}, run: (join: Join<ASide, BSide, Cardinality, Content>) => void): void;
|
|
132
133
|
store: Store;
|
|
133
134
|
alternates: Map<string, Join<ASide, BSide, Cardinality, Content>>;
|
|
134
135
|
[Symbol.dispose](): void;
|