atom.io 0.32.0 → 0.32.2
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 +8 -925
- package/data/dist/index.js +2 -2
- package/dist/{chunk-5F2V7S3B.js → chunk-HEEVASKG.js} +1 -1
- package/dist/{chunk-ECOMOMUN.js → chunk-KMBRCA5Q.js} +20 -19
- package/dist/{chunk-R3ZUK5EH.js → chunk-NDTM5IY3.js} +22 -11
- package/dist/{chunk-354XQWHH.js → chunk-QRPY4LSO.js} +5 -5
- package/dist/{chunk-GY2XQYZY.js → chunk-RXQWAO26.js} +50 -41
- package/dist/{chunk-Z2UJW4NQ.js → chunk-XN3EO2UT.js} +3 -3
- package/dist/{chunk-NF7FJKJD.js → chunk-YPME5OLO.js} +6 -4
- package/dist/index.d.ts +45 -516
- package/dist/index.js +1 -1
- package/eslint-plugin/dist/index.js +3 -3
- package/eslint-plugin/src/rules/explicit-state-types.ts +1 -0
- package/eslint-plugin/src/rules/synchronous-selector-dependencies.ts +1 -0
- package/eslint-plugin/src/walk.ts +1 -0
- package/internal/dist/index.d.ts +9 -657
- package/internal/dist/index.js +1 -1
- package/internal/src/join/join-internal.ts +1 -1
- package/internal/src/junction.ts +7 -4
- package/internal/src/lazy-map.ts +3 -1
- package/internal/src/set-state/emit-update.ts +3 -1
- package/internal/src/timeline/create-timeline.ts +2 -1
- package/internal/src/timeline/time-travel.ts +2 -1
- package/introspection/dist/index.d.ts +6 -922
- package/introspection/dist/index.js +2 -2
- package/introspection/src/auditor.ts +3 -3
- package/json/dist/index.d.ts +5 -899
- package/json/dist/index.js +1 -1
- package/package.json +10 -10
- package/react/dist/index.d.ts +3 -921
- package/react/dist/index.js +2 -2
- package/react-devtools/dist/index.d.ts +1 -26
- package/react-devtools/dist/index.js +28 -15
- package/react-devtools/src/Updates.tsx +12 -0
- package/react-devtools/src/json-editor/editors-by-type/utilities/cast-to-json.ts +2 -1
- package/realtime/dist/index.d.ts +8 -203
- package/realtime/dist/index.js +2 -2
- package/realtime/src/realtime-continuity.ts +5 -1
- package/realtime-client/dist/index.d.ts +21 -959
- package/realtime-client/dist/index.js +2 -2
- package/realtime-react/dist/index.d.ts +12 -166
- package/realtime-react/dist/index.js +4 -4
- package/realtime-server/dist/index.d.ts +27 -972
- package/realtime-server/dist/index.js +3 -3
- package/realtime-server/src/ipc-sockets/child-socket.ts +2 -0
- package/realtime-server/src/ipc-sockets/custom-socket.ts +6 -1
- package/realtime-server/src/realtime-server-stores/server-sync-store.ts +10 -2
- package/realtime-testing/dist/index.d.ts +3 -1091
- package/realtime-testing/dist/index.js +7 -7
- package/src/logger.ts +12 -4
- package/transceivers/set-rtx/dist/index.d.ts +6 -40
- package/transceivers/set-rtx/dist/index.js +1 -1
- package/transceivers/set-rtx/src/set-rtx.ts +4 -7
- package/web/dist/index.d.ts +1 -30
- package/react-devtools/src/json-editor/assets/Untitled-1.ai +2 -1436
- package/react-devtools/src/json-editor/assets/data-vis.ai +1 -1548
- package/react-devtools/src/json-editor/comp/json-editor-sketches.ai +5 -1449
package/data/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createStandaloneSelector, findInStore,
|
|
1
|
+
import { IMPLICIT, createStandaloneSelector, findInStore, capitalize, createRegularAtom, createRegularAtomFamily, createSelectorFamily } from '../../dist/chunk-RXQWAO26.js';
|
|
2
2
|
import '../../dist/chunk-XWL6SNVU.js';
|
|
3
3
|
|
|
4
4
|
// data/src/dict.ts
|
|
@@ -25,7 +25,7 @@ function struct(options, store = IMPLICIT.STORE) {
|
|
|
25
25
|
key: `${options.key}.${key}`,
|
|
26
26
|
default: options.default[key]
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
void 0
|
|
29
29
|
);
|
|
30
30
|
return acc;
|
|
31
31
|
}, {});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMPLICIT, setIntoStore, subscribeToState, getFromStore, findInStore, getJsonToken, withdraw, subscribeToTimeline,
|
|
1
|
+
import { IMPLICIT, setIntoStore, subscribeToState, getFromStore, findInStore, getJsonToken, withdraw, subscribeToTimeline, redo, undo } from './chunk-RXQWAO26.js';
|
|
2
2
|
import * as React5 from 'react';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMPLICIT, getState,
|
|
1
|
+
import { IMPLICIT, getState, createReadonlySelectorFamily, createRegularAtomFamily, Subject, createSelectorFamily, createRegularAtom, createStandaloneSelector, deposit } from './chunk-RXQWAO26.js';
|
|
2
2
|
|
|
3
3
|
// introspection/src/attach-atom-index.ts
|
|
4
4
|
var attachAtomIndex = (store) => {
|
|
@@ -38,7 +38,7 @@ var attachAtomIndex = (store) => {
|
|
|
38
38
|
if (atomToken.family) {
|
|
39
39
|
const { key: familyKey, subKey } = atomToken.family;
|
|
40
40
|
let familyNode = self.get(familyKey);
|
|
41
|
-
if (familyNode ===
|
|
41
|
+
if (familyNode === void 0 || !(`familyMembers` in familyNode)) {
|
|
42
42
|
familyNode = {
|
|
43
43
|
key: familyKey,
|
|
44
44
|
familyMembers: /* @__PURE__ */ new Map()
|
|
@@ -72,7 +72,7 @@ var attachAtomIndex = (store) => {
|
|
|
72
72
|
}
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
|
-
|
|
75
|
+
void 0
|
|
76
76
|
);
|
|
77
77
|
return createStandaloneSelector(store, {
|
|
78
78
|
key: `\u{1F50D} Atom Token Index`,
|
|
@@ -122,7 +122,7 @@ var attachSelectorIndex = (store) => {
|
|
|
122
122
|
if (selectorToken.family) {
|
|
123
123
|
const { key: familyKey, subKey } = selectorToken.family;
|
|
124
124
|
let familyNode = self.get(familyKey);
|
|
125
|
-
if (familyNode ===
|
|
125
|
+
if (familyNode === void 0 || !(`familyMembers` in familyNode)) {
|
|
126
126
|
familyNode = {
|
|
127
127
|
key: familyKey,
|
|
128
128
|
familyMembers: /* @__PURE__ */ new Map()
|
|
@@ -160,7 +160,7 @@ var attachSelectorIndex = (store) => {
|
|
|
160
160
|
}
|
|
161
161
|
]
|
|
162
162
|
},
|
|
163
|
-
|
|
163
|
+
void 0
|
|
164
164
|
);
|
|
165
165
|
return createStandaloneSelector(store, {
|
|
166
166
|
key: `\u{1F50D} Selector Token Index`,
|
|
@@ -224,7 +224,7 @@ var attachTimelineIndex = (store) => {
|
|
|
224
224
|
}
|
|
225
225
|
]
|
|
226
226
|
},
|
|
227
|
-
|
|
227
|
+
void 0
|
|
228
228
|
);
|
|
229
229
|
const timelineTokenIndex = createStandaloneSelector(store, {
|
|
230
230
|
key: `\u{1F50D} Timeline Token Index`,
|
|
@@ -253,7 +253,7 @@ var attachTransactionIndex = (store) => {
|
|
|
253
253
|
}
|
|
254
254
|
]
|
|
255
255
|
},
|
|
256
|
-
|
|
256
|
+
void 0
|
|
257
257
|
);
|
|
258
258
|
const transactionTokenIndex = createStandaloneSelector(store, {
|
|
259
259
|
key: `\u{1F50D} Transaction Token Index`,
|
|
@@ -334,7 +334,7 @@ var jsonRefinery = new Refinery({
|
|
|
334
334
|
...jsonTreeRefinery.supported
|
|
335
335
|
});
|
|
336
336
|
var discoverType = (input) => {
|
|
337
|
-
if (input ===
|
|
337
|
+
if (input === void 0) {
|
|
338
338
|
return `undefined`;
|
|
339
339
|
}
|
|
340
340
|
const refined = jsonRefinery.refine(input);
|
|
@@ -381,6 +381,16 @@ var attachIntrospectionStates = (store) => {
|
|
|
381
381
|
|
|
382
382
|
// introspection/src/auditor.ts
|
|
383
383
|
var Auditor = class _Auditor {
|
|
384
|
+
store;
|
|
385
|
+
auditorCreatedAt = performance.now();
|
|
386
|
+
statesCreatedAt = /* @__PURE__ */ new Map();
|
|
387
|
+
atomIndex;
|
|
388
|
+
selectorIndex;
|
|
389
|
+
disposed = false;
|
|
390
|
+
unsubscribeFromAtomCreation;
|
|
391
|
+
unsubscribeFromAtomDisposal;
|
|
392
|
+
unsubscribeFromSelectorCreation;
|
|
393
|
+
unsubscribeFromSelectorDisposal;
|
|
384
394
|
/**
|
|
385
395
|
* @param {Store} store - The store to audit.
|
|
386
396
|
*/
|
|
@@ -416,15 +426,6 @@ var Auditor = class _Auditor {
|
|
|
416
426
|
}
|
|
417
427
|
);
|
|
418
428
|
}
|
|
419
|
-
auditorCreatedAt = performance.now();
|
|
420
|
-
statesCreatedAt = /* @__PURE__ */ new Map();
|
|
421
|
-
atomIndex;
|
|
422
|
-
selectorIndex;
|
|
423
|
-
disposed = false;
|
|
424
|
-
unsubscribeFromAtomCreation;
|
|
425
|
-
unsubscribeFromAtomDisposal;
|
|
426
|
-
unsubscribeFromSelectorCreation;
|
|
427
|
-
unsubscribeFromSelectorDisposal;
|
|
428
429
|
static DEFAULT_LIST_RESOURCES_PARAM = {
|
|
429
430
|
atomFamilies: true,
|
|
430
431
|
selectorFamilies: true
|
|
@@ -533,7 +534,7 @@ function diffObject(a, b, recurse) {
|
|
|
533
534
|
let key;
|
|
534
535
|
for (key of path) {
|
|
535
536
|
const nodeB = b[key];
|
|
536
|
-
if (nodeB ===
|
|
537
|
+
if (nodeB === void 0) {
|
|
537
538
|
removed.push([key, JSON.stringify(nodeA)]);
|
|
538
539
|
} else {
|
|
539
540
|
const delta = recurse(nodeA, nodeB);
|
|
@@ -547,7 +548,7 @@ function diffObject(a, b, recurse) {
|
|
|
547
548
|
let key;
|
|
548
549
|
for (key of path) {
|
|
549
550
|
const nodeA = a[key];
|
|
550
|
-
if (nodeA ===
|
|
551
|
+
if (nodeA === void 0) {
|
|
551
552
|
added.push([key, JSON.stringify(nodeB)]);
|
|
552
553
|
}
|
|
553
554
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { roomIndex, usersInRooms } from './chunk-
|
|
2
|
-
import { atomFamily, selectorFamily, transaction, editRelationsInStore, atom, SetRTX, join, parseJson, Subject, stringifyJson, findRelationsInStore, getFromStore, subscribeToState, findInStore,
|
|
1
|
+
import { roomIndex, usersInRooms } from './chunk-YPME5OLO.js';
|
|
2
|
+
import { atomFamily, selectorFamily, transaction, editRelationsInStore, atom, SetRTX, join, parseJson, Subject, stringifyJson, findRelationsInStore, IMPLICIT, getFromStore, subscribeToState, findInStore, getJsonToken, getUpdateToken, actUponStore, setIntoStore, subscribeToTransaction, isRootStore } from './chunk-RXQWAO26.js';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
|
|
5
5
|
// realtime-server/src/ipc-sockets/custom-socket.ts
|
|
6
6
|
var CustomSocket = class {
|
|
7
|
-
constructor(emit) {
|
|
8
|
-
this.emit = emit;
|
|
9
|
-
this.listeners = /* @__PURE__ */ new Map();
|
|
10
|
-
this.globalListeners = /* @__PURE__ */ new Set();
|
|
11
|
-
}
|
|
12
7
|
listeners;
|
|
13
8
|
globalListeners;
|
|
14
9
|
handleEvent(event, ...args) {
|
|
@@ -23,6 +18,12 @@ var CustomSocket = class {
|
|
|
23
18
|
}
|
|
24
19
|
}
|
|
25
20
|
id = `no_id_retrieved`;
|
|
21
|
+
emit;
|
|
22
|
+
constructor(emit) {
|
|
23
|
+
this.emit = emit;
|
|
24
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
25
|
+
this.globalListeners = /* @__PURE__ */ new Set();
|
|
26
|
+
}
|
|
26
27
|
on(event, listener) {
|
|
27
28
|
const listeners = this.listeners.get(event);
|
|
28
29
|
if (listeners) {
|
|
@@ -76,6 +77,8 @@ var ChildSocket = class extends CustomSocket {
|
|
|
76
77
|
case `e`:
|
|
77
78
|
this.logger.error(...rest);
|
|
78
79
|
break;
|
|
80
|
+
default:
|
|
81
|
+
return;
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
}
|
|
@@ -409,7 +412,13 @@ function redactTransactionUpdateContent(visibleStateKeys, updates) {
|
|
|
409
412
|
);
|
|
410
413
|
return { ...update, updates: redacted };
|
|
411
414
|
}
|
|
412
|
-
|
|
415
|
+
case `atom_update`:
|
|
416
|
+
case `selector_update`:
|
|
417
|
+
case `molecule_creation`:
|
|
418
|
+
case `molecule_disposal`:
|
|
419
|
+
case `molecule_transfer`:
|
|
420
|
+
case `state_creation`:
|
|
421
|
+
case `state_disposal`:
|
|
413
422
|
return update;
|
|
414
423
|
}
|
|
415
424
|
}).filter((update) => {
|
|
@@ -418,10 +427,12 @@ function redactTransactionUpdateContent(visibleStateKeys, updates) {
|
|
|
418
427
|
case `selector_update`:
|
|
419
428
|
return visibleStateKeys.includes(update.key);
|
|
420
429
|
case `state_creation`:
|
|
430
|
+
case `state_disposal`:
|
|
421
431
|
return visibleStateKeys.includes(update.token.key);
|
|
422
432
|
case `molecule_creation`:
|
|
423
|
-
return true;
|
|
424
433
|
case `transaction_update`:
|
|
434
|
+
case `molecule_disposal`:
|
|
435
|
+
case `molecule_transfer`:
|
|
425
436
|
return true;
|
|
426
437
|
}
|
|
427
438
|
});
|
|
@@ -980,7 +991,7 @@ function realtimeStateProvider({
|
|
|
980
991
|
socket.off(`unsub:${token.key}`, fillUnsubRequest);
|
|
981
992
|
if (unsubscribeFromStateUpdates) {
|
|
982
993
|
unsubscribeFromStateUpdates();
|
|
983
|
-
unsubscribeFromStateUpdates =
|
|
994
|
+
unsubscribeFromStateUpdates = void 0;
|
|
984
995
|
}
|
|
985
996
|
};
|
|
986
997
|
socket.on(`unsub:${token.key}`, fillUnsubRequest);
|
|
@@ -990,7 +1001,7 @@ function realtimeStateProvider({
|
|
|
990
1001
|
socket.off(`sub:${token.key}`, fillSubRequest);
|
|
991
1002
|
if (unsubscribeFromStateUpdates) {
|
|
992
1003
|
unsubscribeFromStateUpdates();
|
|
993
|
-
unsubscribeFromStateUpdates =
|
|
1004
|
+
unsubscribeFromStateUpdates = void 0;
|
|
994
1005
|
}
|
|
995
1006
|
};
|
|
996
1007
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { myIdState__INTERNAL, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity } from './chunk-
|
|
2
|
-
import { useI, StoreContext, useO } from './chunk-
|
|
3
|
-
import { findInStore, actUponStore, arbitrary } from './chunk-
|
|
1
|
+
import { myIdState__INTERNAL, pullAtom, pullAtomFamilyMember, pullMutableAtom, pullMutableAtomFamilyMember, pullSelector, pullSelectorFamilyMember, pushState, serverAction, syncContinuity } from './chunk-XN3EO2UT.js';
|
|
2
|
+
import { useI, StoreContext, useO } from './chunk-HEEVASKG.js';
|
|
3
|
+
import { findInStore, actUponStore, arbitrary } from './chunk-RXQWAO26.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ var RealtimeProvider = ({ children, socket }) => {
|
|
|
17
17
|
setMyId(socket.id);
|
|
18
18
|
});
|
|
19
19
|
socket?.on(`disconnect`, () => {
|
|
20
|
-
setMyId(
|
|
20
|
+
setMyId(void 0);
|
|
21
21
|
});
|
|
22
22
|
}, [socket, setMyId]);
|
|
23
23
|
return /* @__PURE__ */ jsx(RealtimeContext.Provider, { value: { socket, services }, children });
|
|
@@ -59,7 +59,7 @@ function useRealtimeService(key, create) {
|
|
|
59
59
|
if (service) {
|
|
60
60
|
service[0]++;
|
|
61
61
|
} else {
|
|
62
|
-
const dispose = socket ? create(socket) :
|
|
62
|
+
const dispose = socket ? create(socket) : void 0;
|
|
63
63
|
service = [1, dispose];
|
|
64
64
|
services?.set(key, service);
|
|
65
65
|
}
|
|
@@ -54,7 +54,7 @@ var Future = class extends Promise {
|
|
|
54
54
|
);
|
|
55
55
|
} else {
|
|
56
56
|
this.resolve(value);
|
|
57
|
-
this.fate =
|
|
57
|
+
this.fate = void 0;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -202,6 +202,9 @@ var simpleLogger = {
|
|
|
202
202
|
warn: simpleLog(`warn`)
|
|
203
203
|
};
|
|
204
204
|
var AtomIOLogger = class {
|
|
205
|
+
logLevel;
|
|
206
|
+
filter;
|
|
207
|
+
logger;
|
|
205
208
|
constructor(logLevel, filter, logger = simpleLogger) {
|
|
206
209
|
this.logLevel = logLevel;
|
|
207
210
|
this.filter = filter;
|
|
@@ -451,7 +454,9 @@ var emitUpdate = (store, state, update) => {
|
|
|
451
454
|
state.subject.subscribers
|
|
452
455
|
);
|
|
453
456
|
break;
|
|
454
|
-
|
|
457
|
+
case `atom`:
|
|
458
|
+
case `selector`:
|
|
459
|
+
case `readonly_selector`:
|
|
455
460
|
store.logger.info(
|
|
456
461
|
`\u{1F4E2}`,
|
|
457
462
|
state.type,
|
|
@@ -911,11 +916,11 @@ var createWritableSelector = (store, options, family) => {
|
|
|
911
916
|
function createStandaloneSelector(store, options) {
|
|
912
917
|
const isWritable = `set` in options;
|
|
913
918
|
if (isWritable) {
|
|
914
|
-
const state2 = createWritableSelector(store, options,
|
|
919
|
+
const state2 = createWritableSelector(store, options, void 0);
|
|
915
920
|
store.on.selectorCreation.next(state2);
|
|
916
921
|
return state2;
|
|
917
922
|
}
|
|
918
|
-
const state = createReadonlySelector(store, options,
|
|
923
|
+
const state = createReadonlySelector(store, options, void 0);
|
|
919
924
|
store.on.selectorCreation.next(state);
|
|
920
925
|
return state;
|
|
921
926
|
}
|
|
@@ -1101,7 +1106,7 @@ function createSelectorFamily(store, options) {
|
|
|
1101
1106
|
// internal/src/families/init-family-member.ts
|
|
1102
1107
|
function initFamilyMemberInStore(store, token, key) {
|
|
1103
1108
|
const family = store.families.get(token.key);
|
|
1104
|
-
if (family ===
|
|
1109
|
+
if (family === void 0) {
|
|
1105
1110
|
throw new NotFoundError(token, store);
|
|
1106
1111
|
}
|
|
1107
1112
|
const state = family(key);
|
|
@@ -1669,7 +1674,7 @@ function setEpochNumberOfAction(store, transactionKey, newEpoch) {
|
|
|
1669
1674
|
return;
|
|
1670
1675
|
}
|
|
1671
1676
|
const continuityKey = store.transactionMeta.actionContinuities.getRelatedKey(transactionKey);
|
|
1672
|
-
if (continuityKey !==
|
|
1677
|
+
if (continuityKey !== void 0) {
|
|
1673
1678
|
store.transactionMeta.epoch.set(continuityKey, newEpoch);
|
|
1674
1679
|
}
|
|
1675
1680
|
}
|
|
@@ -1843,8 +1848,8 @@ var Junction = class {
|
|
|
1843
1848
|
}
|
|
1844
1849
|
replaceRelationsSafely(x, ys) {
|
|
1845
1850
|
const xRelationsPrev = this.relations.get(x);
|
|
1846
|
-
let a = this.isAType?.(x) ? x :
|
|
1847
|
-
let b = a ===
|
|
1851
|
+
let a = this.isAType?.(x) ? x : void 0;
|
|
1852
|
+
let b = a === void 0 ? x : void 0;
|
|
1848
1853
|
if (xRelationsPrev) {
|
|
1849
1854
|
for (const y of xRelationsPrev) {
|
|
1850
1855
|
a ??= y;
|
|
@@ -1926,8 +1931,8 @@ var Junction = class {
|
|
|
1926
1931
|
};
|
|
1927
1932
|
}
|
|
1928
1933
|
for (const [x, ys] of data.relations ?? []) {
|
|
1929
|
-
let a = this.isAType?.(x) ? x :
|
|
1930
|
-
let b = a ===
|
|
1934
|
+
let a = this.isAType?.(x) ? x : void 0;
|
|
1935
|
+
let b = a === void 0 ? x : void 0;
|
|
1931
1936
|
for (const y of ys) {
|
|
1932
1937
|
a ??= y;
|
|
1933
1938
|
b ??= y;
|
|
@@ -1961,7 +1966,7 @@ var Junction = class {
|
|
|
1961
1966
|
const relation = params[0];
|
|
1962
1967
|
a = relation[this.a];
|
|
1963
1968
|
b = relation[this.b];
|
|
1964
|
-
content =
|
|
1969
|
+
content = void 0;
|
|
1965
1970
|
break;
|
|
1966
1971
|
}
|
|
1967
1972
|
case 2: {
|
|
@@ -1988,10 +1993,12 @@ var Junction = class {
|
|
|
1988
1993
|
const bPrev = this.getRelatedKey(a);
|
|
1989
1994
|
if (bPrev && bPrev !== b) this.delete(a, bPrev);
|
|
1990
1995
|
}
|
|
1991
|
-
case `1:n`:
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1996
|
+
case `1:n`:
|
|
1997
|
+
{
|
|
1998
|
+
const aPrev = this.getRelatedKey(b);
|
|
1999
|
+
if (aPrev && aPrev !== a) this.delete(aPrev, b);
|
|
2000
|
+
}
|
|
2001
|
+
break;
|
|
1995
2002
|
}
|
|
1996
2003
|
if (content) {
|
|
1997
2004
|
const contentKey = this.makeContentKey(a, b);
|
|
@@ -2006,7 +2013,7 @@ var Junction = class {
|
|
|
2006
2013
|
// @ts-expect-error we deduce that this.a may index x
|
|
2007
2014
|
typeof x === `string` ? x : x[this.a]
|
|
2008
2015
|
);
|
|
2009
|
-
if (a ===
|
|
2016
|
+
if (a === void 0 && typeof b === `string`) {
|
|
2010
2017
|
const bRelations = this.getRelatedKeys(b);
|
|
2011
2018
|
if (bRelations) {
|
|
2012
2019
|
for (const bRelation of bRelations) {
|
|
@@ -2014,7 +2021,7 @@ var Junction = class {
|
|
|
2014
2021
|
}
|
|
2015
2022
|
}
|
|
2016
2023
|
}
|
|
2017
|
-
if (typeof a === `string` && b ===
|
|
2024
|
+
if (typeof a === `string` && b === void 0) {
|
|
2018
2025
|
const aRelations = this.getRelatedKeys(a);
|
|
2019
2026
|
if (aRelations) {
|
|
2020
2027
|
for (const aRelation of aRelations) {
|
|
@@ -2071,7 +2078,7 @@ var Junction = class {
|
|
|
2071
2078
|
getRelationEntries(input) {
|
|
2072
2079
|
const a = input[this.a];
|
|
2073
2080
|
const b = input[this.b];
|
|
2074
|
-
if (a !==
|
|
2081
|
+
if (a !== void 0 && b === void 0) {
|
|
2075
2082
|
const aRelations = this.getRelatedKeys(a);
|
|
2076
2083
|
if (aRelations) {
|
|
2077
2084
|
return [...aRelations].map((aRelation) => {
|
|
@@ -2079,7 +2086,7 @@ var Junction = class {
|
|
|
2079
2086
|
});
|
|
2080
2087
|
}
|
|
2081
2088
|
}
|
|
2082
|
-
if (a ===
|
|
2089
|
+
if (a === void 0 && b !== void 0) {
|
|
2083
2090
|
const bRelations = this.getRelatedKeys(b);
|
|
2084
2091
|
if (bRelations) {
|
|
2085
2092
|
return [...bRelations].map((bRelation) => {
|
|
@@ -2100,11 +2107,12 @@ var Junction = class {
|
|
|
2100
2107
|
|
|
2101
2108
|
// internal/src/lazy-map.ts
|
|
2102
2109
|
var LazyMap = class extends Map {
|
|
2110
|
+
deleted = /* @__PURE__ */ new Set();
|
|
2111
|
+
source;
|
|
2103
2112
|
constructor(source) {
|
|
2104
2113
|
super();
|
|
2105
2114
|
this.source = source;
|
|
2106
2115
|
}
|
|
2107
|
-
deleted = /* @__PURE__ */ new Set();
|
|
2108
2116
|
get(key) {
|
|
2109
2117
|
const has = super.has(key);
|
|
2110
2118
|
if (has) {
|
|
@@ -2114,7 +2122,7 @@ var LazyMap = class extends Map {
|
|
|
2114
2122
|
const value = this.source.get(key);
|
|
2115
2123
|
return value;
|
|
2116
2124
|
}
|
|
2117
|
-
return
|
|
2125
|
+
return void 0;
|
|
2118
2126
|
}
|
|
2119
2127
|
set(key, value) {
|
|
2120
2128
|
this.deleted.delete(key);
|
|
@@ -2179,10 +2187,10 @@ var buildTransaction = (store, key, params, id) => {
|
|
|
2179
2187
|
type: `transaction_update`,
|
|
2180
2188
|
key,
|
|
2181
2189
|
id,
|
|
2182
|
-
epoch: epoch ===
|
|
2190
|
+
epoch: epoch === void 0 ? Number.NaN : epoch + 1,
|
|
2183
2191
|
updates: [],
|
|
2184
2192
|
params,
|
|
2185
|
-
output:
|
|
2193
|
+
output: void 0
|
|
2186
2194
|
},
|
|
2187
2195
|
toolkit: {
|
|
2188
2196
|
get: (...ps) => getFromStore(child, ...ps),
|
|
@@ -2244,18 +2252,18 @@ function createTransaction(store, options) {
|
|
|
2244
2252
|
// internal/src/transaction/get-epoch-number.ts
|
|
2245
2253
|
function getContinuityKey(store, transactionKey) {
|
|
2246
2254
|
const isRoot = isRootStore(store);
|
|
2247
|
-
const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) :
|
|
2255
|
+
const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) : void 0;
|
|
2248
2256
|
return continuity;
|
|
2249
2257
|
}
|
|
2250
2258
|
function getEpochNumberOfContinuity(store, continuityKey) {
|
|
2251
2259
|
const isRoot = isRootStore(store);
|
|
2252
|
-
const epoch = isRoot && continuityKey ? store.transactionMeta.epoch.get(continuityKey) :
|
|
2260
|
+
const epoch = isRoot && continuityKey ? store.transactionMeta.epoch.get(continuityKey) : void 0;
|
|
2253
2261
|
return epoch;
|
|
2254
2262
|
}
|
|
2255
2263
|
function getEpochNumberOfAction(store, transactionKey) {
|
|
2256
2264
|
const isRoot = isRootStore(store);
|
|
2257
|
-
const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) :
|
|
2258
|
-
const epoch = isRoot && continuity !==
|
|
2265
|
+
const continuity = isRoot ? store.transactionMeta.actionContinuities.getRelatedKey(transactionKey) : void 0;
|
|
2266
|
+
const epoch = isRoot && continuity !== void 0 ? store.transactionMeta.epoch.get(continuity) : void 0;
|
|
2259
2267
|
return epoch;
|
|
2260
2268
|
}
|
|
2261
2269
|
|
|
@@ -2616,7 +2624,7 @@ var subscribeToRootAtoms = (store, selector2) => {
|
|
|
2616
2624
|
const dependencySubscriptions = traceAllSelectorAtoms(selector2, store).map(
|
|
2617
2625
|
(atomKey) => {
|
|
2618
2626
|
const atom2 = target.atoms.get(atomKey);
|
|
2619
|
-
if (atom2 ===
|
|
2627
|
+
if (atom2 === void 0) {
|
|
2620
2628
|
throw new Error(
|
|
2621
2629
|
`Atom "${atomKey}", a dependency of selector "${selector2.key}", not found in store "${store.config.name}".`
|
|
2622
2630
|
);
|
|
@@ -2749,7 +2757,7 @@ var Tracker = class {
|
|
|
2749
2757
|
const familyMetaData = mutableState.family ? {
|
|
2750
2758
|
key: `*${mutableState.family.key}`,
|
|
2751
2759
|
subKey: mutableState.family.subKey
|
|
2752
|
-
} :
|
|
2760
|
+
} : void 0;
|
|
2753
2761
|
const latestUpdateState = createRegularAtom(
|
|
2754
2762
|
store,
|
|
2755
2763
|
{
|
|
@@ -3093,7 +3101,7 @@ function copyMutableIfNeeded(target, atom2, origin) {
|
|
|
3093
3101
|
const originValue = origin.valueMap.get(atom2.key);
|
|
3094
3102
|
const targetValue = target.valueMap.get(atom2.key);
|
|
3095
3103
|
if (originValue === targetValue) {
|
|
3096
|
-
if (originValue ===
|
|
3104
|
+
if (originValue === void 0) {
|
|
3097
3105
|
return typeof atom2.default === `function` ? atom2.default() : atom2.default;
|
|
3098
3106
|
}
|
|
3099
3107
|
origin.logger.info(`\u{1F4C3}`, `atom`, atom2.key, `copying`);
|
|
@@ -3241,11 +3249,11 @@ function createRegularAtom(store, options, family) {
|
|
|
3241
3249
|
function createStandaloneAtom(store, options) {
|
|
3242
3250
|
const isMutable = `mutable` in options;
|
|
3243
3251
|
if (isMutable) {
|
|
3244
|
-
const state2 = createMutableAtom(store, options,
|
|
3252
|
+
const state2 = createMutableAtom(store, options, void 0);
|
|
3245
3253
|
store.on.atomCreation.next(state2);
|
|
3246
3254
|
return state2;
|
|
3247
3255
|
}
|
|
3248
|
-
const state = createRegularAtom(store, options,
|
|
3256
|
+
const state = createRegularAtom(store, options, void 0);
|
|
3249
3257
|
store.on.atomCreation.next(state);
|
|
3250
3258
|
return state;
|
|
3251
3259
|
}
|
|
@@ -3766,8 +3774,8 @@ var Join = class {
|
|
|
3766
3774
|
get: (x) => ({ get }) => {
|
|
3767
3775
|
const relatedKeys = get(relatedKeysAtoms, x);
|
|
3768
3776
|
for (const y of relatedKeys) {
|
|
3769
|
-
let a = relations.isAType?.(x) ? x :
|
|
3770
|
-
let b = a ===
|
|
3777
|
+
let a = relations.isAType?.(x) ? x : void 0;
|
|
3778
|
+
let b = a === void 0 ? x : void 0;
|
|
3771
3779
|
a ??= y;
|
|
3772
3780
|
b ??= y;
|
|
3773
3781
|
const contentKey = relations.makeContentKey(a, b);
|
|
@@ -3787,8 +3795,8 @@ var Join = class {
|
|
|
3787
3795
|
const jsonFamily = getJsonFamily(relatedKeysAtoms, store);
|
|
3788
3796
|
const json = get(jsonFamily, x);
|
|
3789
3797
|
return json.members.map((y) => {
|
|
3790
|
-
let a = relations.isAType?.(x) ? x :
|
|
3791
|
-
let b = a ===
|
|
3798
|
+
let a = relations.isAType?.(x) ? x : void 0;
|
|
3799
|
+
let b = a === void 0 ? x : void 0;
|
|
3792
3800
|
a ??= y;
|
|
3793
3801
|
b ??= y;
|
|
3794
3802
|
const contentKey = relations.makeContentKey(a, b);
|
|
@@ -3854,7 +3862,7 @@ var Join = class {
|
|
|
3854
3862
|
this.states = states;
|
|
3855
3863
|
break;
|
|
3856
3864
|
}
|
|
3857
|
-
|
|
3865
|
+
case `n:n`: {
|
|
3858
3866
|
const multipleRelatedKeysSelectors = getMultipleKeySelectorFamily();
|
|
3859
3867
|
const stateKeyA = `${aSide}KeysOf${capitalize(bSide)}`;
|
|
3860
3868
|
const stateKeyB = `${bSide}KeysOf${capitalize(aSide)}`;
|
|
@@ -3889,10 +3897,10 @@ var Join = class {
|
|
|
3889
3897
|
// internal/src/join/get-join.ts
|
|
3890
3898
|
function getJoin(token, store) {
|
|
3891
3899
|
let myJoin = store.joins.get(token.key);
|
|
3892
|
-
if (myJoin ===
|
|
3900
|
+
if (myJoin === void 0) {
|
|
3893
3901
|
const rootJoinMap = IMPLICIT.STORE.joins;
|
|
3894
3902
|
const rootJoin = rootJoinMap.get(token.key);
|
|
3895
|
-
if (rootJoin ===
|
|
3903
|
+
if (rootJoin === void 0) {
|
|
3896
3904
|
throw new Error(
|
|
3897
3905
|
`Join "${token.key}" not found in store "${store.config.name}"`
|
|
3898
3906
|
);
|
|
@@ -4312,7 +4320,8 @@ function filterTransactionUpdates(updates, timelineTopics) {
|
|
|
4312
4320
|
case `molecule_transfer`:
|
|
4313
4321
|
return true;
|
|
4314
4322
|
// always include
|
|
4315
|
-
|
|
4323
|
+
case `atom_update`:
|
|
4324
|
+
case `selector_update`:
|
|
4316
4325
|
key = updateFromTx.key;
|
|
4317
4326
|
familyKey = updateFromTx.family?.key;
|
|
4318
4327
|
break;
|
|
@@ -4474,7 +4483,7 @@ var JSON_PROTOTYPES = [
|
|
|
4474
4483
|
];
|
|
4475
4484
|
var isJson = (input) => {
|
|
4476
4485
|
if (input === null) return true;
|
|
4477
|
-
if (input ===
|
|
4486
|
+
if (input === void 0) return false;
|
|
4478
4487
|
const prototype = Object.getPrototypeOf(input);
|
|
4479
4488
|
return JSON_PROTOTYPES.includes(prototype);
|
|
4480
4489
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { persistSync } from './chunk-4LWKCEW3.js';
|
|
2
|
-
import { atom, selector, setIntoStore, getEpochNumberOfContinuity, isRootStore, ingestTransactionUpdate, setEpochNumberOfContinuity, disposeAtom, parseJson, getJsonToken, getUpdateToken, subscribeToState, subscribeToTransaction, getFromStore, assignTransactionToContinuity, actUponStore } from './chunk-
|
|
2
|
+
import { atom, selector, setIntoStore, getEpochNumberOfContinuity, isRootStore, ingestTransactionUpdate, setEpochNumberOfContinuity, disposeAtom, parseJson, getJsonToken, getUpdateToken, subscribeToState, subscribeToTransaction, getFromStore, assignTransactionToContinuity, actUponStore } from './chunk-RXQWAO26.js';
|
|
3
3
|
|
|
4
4
|
// realtime-client/src/continuity/register-and-attempt-confirmed-update.ts
|
|
5
5
|
var useRegisterAndAttemptConfirmedUpdate = (store, continuityKey, socket, optimisticUpdates, confirmedUpdates) => (confirmed) => {
|
|
@@ -162,7 +162,7 @@ var useRegisterAndAttemptConfirmedUpdate = (store, continuityKey, socket, optimi
|
|
|
162
162
|
ingestTransactionUpdate(`newValue`, confirmed, store);
|
|
163
163
|
socket.emit(`ack:${continuityKey}`, confirmed.epoch);
|
|
164
164
|
setEpochNumberOfContinuity(store, continuityKey, confirmed.epoch);
|
|
165
|
-
} else if (isRoot && continuityEpoch !==
|
|
165
|
+
} else if (isRoot && continuityEpoch !== void 0) {
|
|
166
166
|
store.logger.info(
|
|
167
167
|
`\u{1F9D1}\u200D\u2696\uFE0F`,
|
|
168
168
|
`continuity`,
|
|
@@ -385,7 +385,7 @@ function pushState(store, socket, token) {
|
|
|
385
385
|
// realtime-client/src/realtime-client-stores/client-main-store.ts
|
|
386
386
|
var myIdState__INTERNAL = atom({
|
|
387
387
|
key: `mySocketId__INTERNAL`,
|
|
388
|
-
default:
|
|
388
|
+
default: void 0
|
|
389
389
|
});
|
|
390
390
|
var myIdState = selector({
|
|
391
391
|
key: `mySocketId`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { atom, SetRTX, join, selectorFamily, getInternalRelations, assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity } from './chunk-
|
|
1
|
+
import { atom, SetRTX, join, selectorFamily, getInternalRelations, assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity } from './chunk-RXQWAO26.js';
|
|
2
2
|
|
|
3
3
|
// realtime/src/realtime-continuity.ts
|
|
4
4
|
var InvariantMap = class extends Map {
|
|
@@ -17,13 +17,14 @@ var InvariantMap = class extends Map {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
var SyncGroup = class _SyncGroup {
|
|
20
|
-
constructor(key) {
|
|
21
|
-
this.key = key;
|
|
22
|
-
}
|
|
23
20
|
type = `continuity`;
|
|
24
21
|
globals = [];
|
|
25
22
|
actions = [];
|
|
26
23
|
perspectives = [];
|
|
24
|
+
key;
|
|
25
|
+
constructor(key) {
|
|
26
|
+
this.key = key;
|
|
27
|
+
}
|
|
27
28
|
static existing = new InvariantMap();
|
|
28
29
|
static create(key, builder) {
|
|
29
30
|
const group = new _SyncGroup(key);
|
|
@@ -43,6 +44,7 @@ var SyncGroup = class _SyncGroup {
|
|
|
43
44
|
this.actions.push(...args);
|
|
44
45
|
break;
|
|
45
46
|
case `atom_family`:
|
|
47
|
+
case `mutable_atom_family`:
|
|
46
48
|
{
|
|
47
49
|
const [family, index] = args;
|
|
48
50
|
this.perspectives.push({
|