atom.io 0.17.0 → 0.18.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 +62 -40
- package/data/dist/index.cjs.map +1 -1
- package/data/dist/index.d.ts +8 -2
- package/data/dist/index.js +64 -42
- package/data/dist/index.js.map +1 -1
- package/data/src/dict.ts +8 -4
- package/data/src/join.ts +74 -33
- package/data/src/struct-family.ts +18 -17
- package/dist/chunk-OEVFAUPE.js +289 -0
- package/dist/chunk-OEVFAUPE.js.map +1 -0
- package/dist/index.cjs +4 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +62 -51
- package/dist/index.js +5 -11
- package/dist/index.js.map +1 -1
- package/internal/dist/index.cjs +163 -64
- package/internal/dist/index.cjs.map +1 -1
- package/internal/dist/index.d.ts +94 -70
- package/internal/dist/index.js +155 -59
- package/internal/dist/index.js.map +1 -1
- package/internal/src/arbitrary.ts +3 -0
- package/internal/src/caching.ts +8 -6
- package/internal/src/families/find-in-store.ts +16 -0
- package/internal/src/get-environment-data.ts +4 -7
- package/internal/src/index.ts +6 -5
- package/internal/src/ingest-updates/ingest-transaction-update.ts +0 -1
- package/internal/src/selector/create-standalone-selector.ts +0 -2
- package/internal/src/set-state/set-atom.ts +14 -18
- package/internal/src/store/store.ts +14 -2
- package/internal/src/store/withdraw.ts +72 -2
- package/internal/src/subscribe/subscribe-to-timeline.ts +2 -2
- package/internal/src/subscribe/subscribe-to-transaction.ts +2 -2
- package/internal/src/timeline/create-timeline.ts +12 -1
- package/internal/src/transaction/act-upon-store.ts +19 -0
- package/internal/src/transaction/apply-transaction.ts +7 -1
- package/internal/src/transaction/assign-transaction-to-continuity.ts +18 -0
- package/internal/src/transaction/build-transaction.ts +7 -6
- package/internal/src/transaction/create-transaction.ts +1 -1
- package/internal/src/transaction/get-epoch-number.ts +40 -0
- package/internal/src/transaction/index.ts +10 -1
- package/internal/src/transaction/set-epoch-number.ts +31 -0
- package/introspection/dist/index.cjs.map +1 -1
- package/introspection/dist/index.d.ts +3 -3
- package/introspection/dist/index.js.map +1 -1
- package/introspection/src/attach-introspection-states.ts +6 -2
- package/introspection/src/attach-timeline-family.ts +5 -2
- package/introspection/src/attach-transaction-logs.ts +2 -2
- package/json/dist/index.d.ts +3 -1
- package/json/src/index.ts +6 -2
- package/package.json +24 -13
- package/react/dist/index.cjs.map +1 -1
- package/react/dist/index.d.ts +1 -1
- package/react/dist/index.js.map +1 -1
- package/react/src/use-json.ts +1 -1
- package/react-devtools/dist/index.cjs +131 -134
- package/react-devtools/dist/index.cjs.map +1 -1
- package/react-devtools/dist/index.css +2 -2
- package/react-devtools/dist/index.css.map +1 -1
- package/react-devtools/dist/index.d.ts +3 -3
- package/react-devtools/dist/index.js +103 -106
- package/react-devtools/dist/index.js.map +1 -1
- package/react-devtools/src/StateEditor.tsx +6 -6
- package/react-devtools/src/StateIndex.tsx +2 -5
- package/react-devtools/src/TimelineIndex.tsx +3 -3
- package/react-devtools/src/TransactionIndex.tsx +9 -8
- package/react-devtools/src/Updates.tsx +1 -1
- package/react-devtools/src/index.ts +4 -4
- package/realtime/dist/index.cjs +72 -0
- package/realtime/dist/index.cjs.map +1 -0
- package/realtime/dist/index.d.ts +39 -0
- package/realtime/dist/index.js +68 -0
- package/realtime/dist/index.js.map +1 -0
- package/realtime/package.json +16 -0
- package/realtime/src/index.ts +1 -0
- package/realtime/src/realtime-continuity.ts +152 -0
- package/realtime-client/dist/index.cjs +389 -48
- package/realtime-client/dist/index.cjs.map +1 -1
- package/realtime-client/dist/index.d.ts +16 -9
- package/realtime-client/dist/index.js +100 -37
- package/realtime-client/dist/index.js.map +1 -1
- package/realtime-client/src/index.ts +8 -5
- package/realtime-client/src/{pull-family-member.ts → pull-atom-family-member.ts} +2 -2
- package/realtime-client/src/{pull-state.ts → pull-atom.ts} +2 -2
- package/realtime-client/src/{pull-mutable-family-member.ts → pull-mutable-atom-family-member.ts} +1 -1
- package/realtime-client/src/{pull-mutable.ts → pull-mutable-atom.ts} +1 -1
- package/realtime-client/src/pull-selector-family-member.ts +42 -0
- package/realtime-client/src/pull-selector.ts +38 -0
- package/realtime-client/src/realtime-client-stores/client-main-store.ts +2 -2
- package/realtime-client/src/realtime-client-stores/client-sync-store.ts +7 -7
- package/realtime-client/src/sync-continuity.ts +321 -0
- package/realtime-client/src/sync-server-action.ts +18 -20
- package/realtime-react/dist/index.cjs +330 -15
- package/realtime-react/dist/index.cjs.map +1 -1
- package/realtime-react/dist/index.d.ts +26 -6
- package/realtime-react/dist/index.js +43 -12
- package/realtime-react/dist/index.js.map +1 -1
- package/realtime-react/src/index.ts +6 -3
- package/realtime-react/src/use-pull-atom-family-member.ts +21 -0
- package/realtime-react/src/{use-pull-family-member.ts → use-pull-atom.ts} +6 -5
- package/realtime-react/src/{use-pull-mutable.ts → use-pull-mutable-atom.ts} +4 -3
- package/realtime-react/src/use-pull-mutable-family-member.ts +9 -4
- package/realtime-react/src/use-pull-selector-family-member.ts +21 -0
- package/realtime-react/src/{use-pull.ts → use-pull-selector.ts} +7 -5
- package/realtime-react/src/use-push.ts +3 -2
- package/realtime-react/src/use-server-action.ts +3 -2
- package/realtime-react/src/use-sync-continuity.ts +12 -0
- package/realtime-react/src/use-sync-server-action.ts +3 -2
- package/realtime-server/dist/index.cjs +568 -242
- package/realtime-server/dist/index.cjs.map +1 -1
- package/realtime-server/dist/index.d.ts +124 -49
- package/realtime-server/dist/index.js +555 -238
- package/realtime-server/dist/index.js.map +1 -1
- package/realtime-server/src/index.ts +18 -2
- package/realtime-server/src/ipc-socket.ts +230 -0
- package/realtime-server/src/realtime-action-receiver.ts +8 -5
- package/realtime-server/src/realtime-action-synchronizer.ts +40 -28
- package/realtime-server/src/realtime-continuity-synchronizer.ts +247 -0
- package/realtime-server/src/realtime-family-provider.ts +30 -71
- package/realtime-server/src/realtime-mutable-family-provider.ts +24 -86
- package/realtime-server/src/realtime-server-stores/index.ts +3 -1
- package/realtime-server/src/realtime-server-stores/realtime-continuity-store.ts +90 -0
- package/realtime-server/src/realtime-server-stores/server-room-store.ts +97 -0
- package/realtime-server/src/realtime-server-stores/server-sync-store.ts +2 -72
- package/realtime-server/src/realtime-server-stores/server-user-store.ts +14 -29
- package/realtime-server/src/realtime-state-receiver.ts +0 -1
- package/realtime-testing/dist/index.cjs +28 -28
- package/realtime-testing/dist/index.cjs.map +1 -1
- package/realtime-testing/dist/index.js +28 -27
- package/realtime-testing/dist/index.js.map +1 -1
- package/realtime-testing/src/setup-realtime-test.tsx +38 -28
- package/src/atom.ts +49 -31
- package/src/logger.ts +10 -5
- package/src/selector.ts +44 -25
- package/src/subscribe.ts +2 -1
- package/src/timeline.ts +4 -4
- package/src/transaction.ts +13 -17
- package/src/validators.ts +15 -9
- package/dist/chunk-H4Q5FTPZ.js +0 -11
- package/dist/chunk-H4Q5FTPZ.js.map +0 -1
- package/internal/src/set-state/copy-mutable-in-transaction.ts +0 -19
|
@@ -2,12 +2,12 @@ import type { ReadonlySelectorToken, WritableToken } from "atom.io"
|
|
|
2
2
|
import { useI, useO } from "atom.io/react"
|
|
3
3
|
import type { FC } from "react"
|
|
4
4
|
|
|
5
|
-
import { fallback } from "
|
|
6
|
-
import { Join } from "
|
|
7
|
-
import { isJson } from "
|
|
8
|
-
import { RelationEditor } from "
|
|
9
|
-
import { ElasticInput } from "
|
|
10
|
-
import { JsonEditor } from "
|
|
5
|
+
import { fallback } from "anvl/function"
|
|
6
|
+
import { Join } from "anvl/join"
|
|
7
|
+
import { isJson } from "anvl/refinement"
|
|
8
|
+
import { RelationEditor } from "hamr/react-data-designer"
|
|
9
|
+
import { ElasticInput } from "hamr/react-elastic-input"
|
|
10
|
+
import { JsonEditor } from "hamr/react-json-editor"
|
|
11
11
|
|
|
12
12
|
export const StateEditor: FC<{
|
|
13
13
|
token: WritableToken<unknown>
|
|
@@ -8,11 +8,8 @@ import type { FamilyNode, WritableTokenIndex } from "atom.io/introspection"
|
|
|
8
8
|
import { useI, useO } from "atom.io/react"
|
|
9
9
|
import type { FC } from "react"
|
|
10
10
|
|
|
11
|
-
import { recordToEntries } from "
|
|
12
|
-
import {
|
|
13
|
-
isJson,
|
|
14
|
-
refineJsonType,
|
|
15
|
-
} from "~/packages/anvl/src/refinement/refine-json"
|
|
11
|
+
import { recordToEntries } from "anvl/object"
|
|
12
|
+
import { isJson, refineJsonType } from "anvl/refinement"
|
|
16
13
|
|
|
17
14
|
import { findViewIsOpenState, primitiveRefinery } from "."
|
|
18
15
|
import { button } from "./Button"
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
RegularAtomToken,
|
|
4
4
|
TimelineToken,
|
|
5
5
|
} from "atom.io"
|
|
6
|
-
import { redo, undo } from "atom.io"
|
|
6
|
+
import { findState, redo, undo } from "atom.io"
|
|
7
7
|
import type { Timeline } from "atom.io/internal"
|
|
8
8
|
import { useI, useO } from "atom.io/react"
|
|
9
9
|
import { type FC, Fragment } from "react"
|
|
@@ -82,8 +82,8 @@ export const TimelineIndex: FC = () => {
|
|
|
82
82
|
<TimelineLog
|
|
83
83
|
key={token.key}
|
|
84
84
|
token={token}
|
|
85
|
-
isOpenState={findViewIsOpenState
|
|
86
|
-
timelineState={findTimelineState
|
|
85
|
+
isOpenState={findState(findViewIsOpenState, token.key)}
|
|
86
|
+
timelineState={findState(findTimelineState, token.key)}
|
|
87
87
|
/>
|
|
88
88
|
)
|
|
89
89
|
})}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
ReadonlySelectorToken,
|
|
3
|
-
RegularAtomToken,
|
|
4
|
-
TransactionToken,
|
|
5
|
-
TransactionUpdate,
|
|
6
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ReadonlySelectorToken,
|
|
3
|
+
type RegularAtomToken,
|
|
4
|
+
type TransactionToken,
|
|
5
|
+
type TransactionUpdate,
|
|
6
|
+
findState,
|
|
7
|
+
type ƒn,
|
|
7
8
|
} from "atom.io"
|
|
8
9
|
import { useI, useO } from "atom.io/react"
|
|
9
10
|
import type { FC } from "react"
|
|
@@ -60,8 +61,8 @@ export const TransactionIndex: FC = () => {
|
|
|
60
61
|
<TransactionLog
|
|
61
62
|
key={token.key}
|
|
62
63
|
token={token}
|
|
63
|
-
isOpenState={findViewIsOpenState
|
|
64
|
-
logState={findTransactionLogState
|
|
64
|
+
isOpenState={findState(findViewIsOpenState, token.key)}
|
|
65
|
+
logState={findState(findTransactionLogState, token.key)}
|
|
65
66
|
/>
|
|
66
67
|
)
|
|
67
68
|
})}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { atom, atomFamily } from "atom.io"
|
|
2
2
|
import { attachIntrospectionStates } from "atom.io/introspection"
|
|
3
|
-
import { lazyLocalStorageEffect } from "~/packages/atom.io/__unstable__/web-effects/src"
|
|
4
3
|
|
|
5
|
-
import { isPlainObject } from "
|
|
6
|
-
import { Refinery } from "
|
|
4
|
+
import { isPlainObject } from "anvl/object"
|
|
5
|
+
import { Refinery } from "anvl/refinement"
|
|
7
6
|
import {
|
|
8
7
|
Differ,
|
|
9
8
|
diffArray,
|
|
@@ -11,7 +10,8 @@ import {
|
|
|
11
10
|
diffNumber,
|
|
12
11
|
diffObject,
|
|
13
12
|
diffString,
|
|
14
|
-
} from "
|
|
13
|
+
} from "anvl/tree/differ"
|
|
14
|
+
import { lazyLocalStorageEffect } from "~/packages/atom.io/__unstable__/web-effects/src"
|
|
15
15
|
|
|
16
16
|
export * from "./AtomIODevtools"
|
|
17
17
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var internal = require('atom.io/internal');
|
|
4
|
+
|
|
5
|
+
// realtime/src/realtime-continuity.ts
|
|
6
|
+
var InvariantMap = class extends Map {
|
|
7
|
+
set(key, value) {
|
|
8
|
+
if (this.has(key)) {
|
|
9
|
+
console.warn(`Tried to set a key that already exists in an InvariantMap`, {
|
|
10
|
+
key,
|
|
11
|
+
value
|
|
12
|
+
});
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
return super.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
clear() {
|
|
18
|
+
throw new Error(`Cannot clear an InvariantMap`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var _SyncGroup = class _SyncGroup {
|
|
22
|
+
constructor(key) {
|
|
23
|
+
this.key = key;
|
|
24
|
+
this.type = `continuity`;
|
|
25
|
+
this.globals = [];
|
|
26
|
+
this.actions = [];
|
|
27
|
+
this.perspectives = [];
|
|
28
|
+
}
|
|
29
|
+
static create(key, builder) {
|
|
30
|
+
const group = new _SyncGroup(key);
|
|
31
|
+
const { type, globals, actions, perspectives } = builder(group);
|
|
32
|
+
const token = { type, key, globals, actions, perspectives };
|
|
33
|
+
_SyncGroup.existing.set(key, token);
|
|
34
|
+
return token;
|
|
35
|
+
}
|
|
36
|
+
add(...args) {
|
|
37
|
+
const zeroth = args[0];
|
|
38
|
+
if (zeroth.type === `atom` || zeroth.type === `mutable_atom`) {
|
|
39
|
+
const globals = args;
|
|
40
|
+
this.globals.push(...globals);
|
|
41
|
+
} else if (zeroth.type === `transaction`) {
|
|
42
|
+
const actions = args;
|
|
43
|
+
this.actions.push(...actions);
|
|
44
|
+
} else {
|
|
45
|
+
const [family, index] = args;
|
|
46
|
+
this.perspectives.push({
|
|
47
|
+
type: `realtime_perspective`,
|
|
48
|
+
resourceAtoms: family,
|
|
49
|
+
perspectiveAtoms: index
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
_SyncGroup.existing = new InvariantMap();
|
|
56
|
+
var SyncGroup = _SyncGroup;
|
|
57
|
+
function continuity(options) {
|
|
58
|
+
const { key, config } = options;
|
|
59
|
+
const token = SyncGroup.create(key, config);
|
|
60
|
+
const { actions } = token;
|
|
61
|
+
for (const action of actions) {
|
|
62
|
+
internal.assignTransactionToContinuity(key, action.key, internal.IMPLICIT.STORE);
|
|
63
|
+
}
|
|
64
|
+
internal.setEpochNumberOfContinuity(key, -1, internal.IMPLICIT.STORE);
|
|
65
|
+
return token;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
exports.InvariantMap = InvariantMap;
|
|
69
|
+
exports.SyncGroup = SyncGroup;
|
|
70
|
+
exports.continuity = continuity;
|
|
71
|
+
//# sourceMappingURL=out.js.map
|
|
72
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/realtime-continuity.ts"],"names":[],"mappings":";AAOA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAGA,IAAM,eAAN,cAAiC,IAAU;AAAA,EAC1C,IAAI,KAAQ,OAAgB;AAClC,QAAI,KAAK,IAAI,GAAG,GAAG;AAClB,cAAQ,KAAK,6DAA6D;AAAA,QACzE;AAAA,QACA;AAAA,MACD,CAAC;AACD,aAAO;AAAA,IACR;AACA,WAAO,MAAM,IAAI,KAAK,KAAK;AAAA,EAC5B;AAAA,EAEO,QAAc;AACpB,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAC/C;AACD;AAsBO,IAAM,aAAN,MAAM,WAAU;AAAA,EAOZ,YAA+B,KAAa;AAAb;AANzC,SAAU,OAAO;AAEjB,SAAU,UAA4B,CAAC;AACvC,SAAU,UAAmC,CAAC;AAC9C,SAAU,eAA6C,CAAC;AAAA,EAED;AAAA,EAIvD,OAAc,OACb,KACA,SACkB;AAClB,UAAM,QAAQ,IAAI,WAAU,GAAG;AAC/B,UAAM,EAAE,MAAM,SAAS,SAAS,aAAa,IAAI,QAAQ,KAAK;AAC9D,UAAM,QAAQ,EAAE,MAAM,KAAK,SAAS,SAAS,aAAa;AAC1D,eAAU,SAAS,IAAI,KAAK,KAAK;AACjC,WAAO;AAAA,EACR;AAAA,EAWO,OACH,MAIS;AACZ,UAAM,SAAS,KAAK,CAAC;AACrB,QAAI,OAAO,SAAS,UAAU,OAAO,SAAS,gBAAgB;AAC7D,YAAM,UAAU;AAChB,WAAK,QAAQ,KAAK,GAAG,OAAO;AAAA,IAC7B,WAAW,OAAO,SAAS,eAAe;AACzC,YAAM,UAAU;AAChB,WAAK,QAAQ,KAAK,GAAG,OAAO;AAAA,IAC7B,OAAO;AACN,YAAM,CAAC,QAAQ,KAAK,IAAI;AAIxB,WAAK,aAAa,KAAK;AAAA,QACtB,MAAM;AAAA,QACN,eAAe;AAAA,QACf,kBAAkB;AAAA,MACnB,CAAC;AAAA,IACF;AACA,WAAO;AAAA,EACR;AACD;AAzDa,WASE,WACb,IAAI,aAAa;AAVZ,IAAM,YAAN;AAgEA,SAAS,WAAW,SAA6C;AACvE,QAAM,EAAE,KAAK,OAAO,IAAI;AACxB,QAAM,QAAQ,UAAU,OAAO,KAAK,MAAM;AAC1C,QAAM,EAAE,QAAQ,IAAI;AACpB,aAAW,UAAU,SAAS;AAC7B,kCAA8B,KAAK,OAAO,KAAK,SAAS,KAAK;AAAA,EAC9D;AACA,6BAA2B,KAAK,IAAI,SAAS,KAAK;AAClD,SAAO;AACR","sourcesContent":["import type {\n\tAtomFamilyToken,\n\tAtomToken,\n\tReadableFamilyToken,\n\tReadableToken,\n\tTransactionToken,\n} from \"atom.io\"\nimport {\n\tIMPLICIT,\n\tassignTransactionToContinuity,\n\tsetEpochNumberOfContinuity,\n} from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\n\nexport class InvariantMap<K, V> extends Map<K, V> {\n\tpublic set(key: K, value: V): this {\n\t\tif (this.has(key)) {\n\t\t\tconsole.warn(`Tried to set a key that already exists in an InvariantMap`, {\n\t\t\t\tkey,\n\t\t\t\tvalue,\n\t\t\t})\n\t\t\treturn this\n\t\t}\n\t\treturn super.set(key, value)\n\t}\n\n\tpublic clear(): void {\n\t\tthrow new Error(`Cannot clear an InvariantMap`)\n\t}\n}\n\nexport type PerspectiveToken<\n\tF extends AtomFamilyToken<any>,\n\tT extends F extends AtomFamilyToken<infer T, any> ? T : never,\n> = {\n\ttype: `realtime_perspective`\n\tresourceAtoms: F\n\tperspectiveAtoms: ReadableFamilyToken<Iterable<ReadableToken<T>>, string>\n}\n\nexport type ContinuityToken = {\n\treadonly type: `continuity`\n\treadonly key: string\n\treadonly globals: AtomToken<any>[]\n\treadonly actions: TransactionToken<any>[]\n\treadonly perspectives: PerspectiveToken<\n\t\tAtomFamilyToken<any, Json.Serializable>,\n\t\tJson.Serializable\n\t>[]\n}\n\nexport class SyncGroup {\n\tprotected type = `continuity` as const\n\n\tprotected globals: AtomToken<any>[] = []\n\tprotected actions: TransactionToken<any>[] = []\n\tprotected perspectives: PerspectiveToken<any, any>[] = []\n\n\tprotected constructor(protected readonly key: string) {}\n\n\tpublic static existing: InvariantMap<string, ContinuityToken> =\n\t\tnew InvariantMap()\n\tpublic static create(\n\t\tkey: string,\n\t\tbuilder: (group: SyncGroup) => SyncGroup,\n\t): ContinuityToken {\n\t\tconst group = new SyncGroup(key)\n\t\tconst { type, globals, actions, perspectives } = builder(group)\n\t\tconst token = { type, key, globals, actions, perspectives }\n\t\tSyncGroup.existing.set(key, token)\n\t\treturn token\n\t}\n\n\tpublic add(...atoms: AtomToken<any>[]): SyncGroup\n\tpublic add(...args: TransactionToken<any>[]): SyncGroup\n\tpublic add<\n\t\tF extends AtomFamilyToken<any>,\n\t\tT extends F extends AtomFamilyToken<infer T> ? T : never,\n\t>(\n\t\tfamily: AtomFamilyToken<T, any>,\n\t\tindex: ReadableFamilyToken<Iterable<AtomToken<T>>, string>,\n\t): SyncGroup\n\tpublic add(\n\t\t...args:\n\t\t\t| readonly AtomToken<any>[]\n\t\t\t| readonly TransactionToken<any>[]\n\t\t\t| [AtomFamilyToken<any, any>, ReadableFamilyToken<Iterable<any>, string>]\n\t): SyncGroup {\n\t\tconst zeroth = args[0]\n\t\tif (zeroth.type === `atom` || zeroth.type === `mutable_atom`) {\n\t\t\tconst globals = args as AtomToken<any>[]\n\t\t\tthis.globals.push(...globals)\n\t\t} else if (zeroth.type === `transaction`) {\n\t\t\tconst actions = args as TransactionToken<any>[]\n\t\t\tthis.actions.push(...actions)\n\t\t} else {\n\t\t\tconst [family, index] = args as [\n\t\t\t\tAtomFamilyToken<any, any>,\n\t\t\t\tReadableFamilyToken<Iterable<any>, string>,\n\t\t\t]\n\t\t\tthis.perspectives.push({\n\t\t\t\ttype: `realtime_perspective`,\n\t\t\t\tresourceAtoms: family,\n\t\t\t\tperspectiveAtoms: index,\n\t\t\t})\n\t\t}\n\t\treturn this\n\t}\n}\n\nexport type ContinuityOptions = {\n\tkey: string\n\tconfig: (group: SyncGroup) => SyncGroup\n}\n\nexport function continuity(options: ContinuityOptions): ContinuityToken {\n\tconst { key, config } = options\n\tconst token = SyncGroup.create(key, config)\n\tconst { actions } = token\n\tfor (const action of actions) {\n\t\tassignTransactionToContinuity(key, action.key, IMPLICIT.STORE)\n\t}\n\tsetEpochNumberOfContinuity(key, -1, IMPLICIT.STORE)\n\treturn token\n}\n\n// const counterStates = atomFamily<number, { c: string }>({\n// \tkey: `counter`,\n// \tdefault: 0,\n// })\n// const counterIndices = atomFamily<{ c: string }[], string>({\n// \tkey: `counterIndex`,\n// \tdefault: [],\n// })\n// const nameStates = atomFamily<number, { n: string }>({\n// \tkey: `name`,\n// \tdefault: 0,\n// })\n// const nameIndices = atomFamily<{ n: string }[], string>({\n// \tkey: `nameIndex`,\n// \tdefault: [],\n// })\n\n// const counterContinuity = continuity({\n// \tkey: `counter`,\n// \tconfig: (group) =>\n// \t\tgroup\n// \t\t\t.add(counterStates, counterIndices)\n// \t\t\t.add(nameStates, nameIndices)\n// \t\t\t.add(nameStates, nameIndices)\n// \t\t\t.add(nameStates, nameIndices),\n// })\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AtomFamilyToken, ReadableFamilyToken, ReadableToken, AtomToken, TransactionToken } from 'atom.io';
|
|
2
|
+
import { Json } from 'atom.io/json';
|
|
3
|
+
|
|
4
|
+
declare class InvariantMap<K, V> extends Map<K, V> {
|
|
5
|
+
set(key: K, value: V): this;
|
|
6
|
+
clear(): void;
|
|
7
|
+
}
|
|
8
|
+
type PerspectiveToken<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer T, any> ? T : never> = {
|
|
9
|
+
type: `realtime_perspective`;
|
|
10
|
+
resourceAtoms: F;
|
|
11
|
+
perspectiveAtoms: ReadableFamilyToken<Iterable<ReadableToken<T>>, string>;
|
|
12
|
+
};
|
|
13
|
+
type ContinuityToken = {
|
|
14
|
+
readonly type: `continuity`;
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly globals: AtomToken<any>[];
|
|
17
|
+
readonly actions: TransactionToken<any>[];
|
|
18
|
+
readonly perspectives: PerspectiveToken<AtomFamilyToken<any, Json.Serializable>, Json.Serializable>[];
|
|
19
|
+
};
|
|
20
|
+
declare class SyncGroup {
|
|
21
|
+
protected readonly key: string;
|
|
22
|
+
protected type: "continuity";
|
|
23
|
+
protected globals: AtomToken<any>[];
|
|
24
|
+
protected actions: TransactionToken<any>[];
|
|
25
|
+
protected perspectives: PerspectiveToken<any, any>[];
|
|
26
|
+
protected constructor(key: string);
|
|
27
|
+
static existing: InvariantMap<string, ContinuityToken>;
|
|
28
|
+
static create(key: string, builder: (group: SyncGroup) => SyncGroup): ContinuityToken;
|
|
29
|
+
add(...atoms: AtomToken<any>[]): SyncGroup;
|
|
30
|
+
add(...args: TransactionToken<any>[]): SyncGroup;
|
|
31
|
+
add<F extends AtomFamilyToken<any>, T extends F extends AtomFamilyToken<infer T> ? T : never>(family: AtomFamilyToken<T, any>, index: ReadableFamilyToken<Iterable<AtomToken<T>>, string>): SyncGroup;
|
|
32
|
+
}
|
|
33
|
+
type ContinuityOptions = {
|
|
34
|
+
key: string;
|
|
35
|
+
config: (group: SyncGroup) => SyncGroup;
|
|
36
|
+
};
|
|
37
|
+
declare function continuity(options: ContinuityOptions): ContinuityToken;
|
|
38
|
+
|
|
39
|
+
export { type ContinuityOptions, type ContinuityToken, InvariantMap, type PerspectiveToken, SyncGroup, continuity };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import '../../dist/chunk-PZLG2HP3.js';
|
|
2
|
+
import { assignTransactionToContinuity, IMPLICIT, setEpochNumberOfContinuity } from 'atom.io/internal';
|
|
3
|
+
|
|
4
|
+
var InvariantMap = class extends Map {
|
|
5
|
+
set(key, value) {
|
|
6
|
+
if (this.has(key)) {
|
|
7
|
+
console.warn(`Tried to set a key that already exists in an InvariantMap`, {
|
|
8
|
+
key,
|
|
9
|
+
value
|
|
10
|
+
});
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
return super.set(key, value);
|
|
14
|
+
}
|
|
15
|
+
clear() {
|
|
16
|
+
throw new Error(`Cannot clear an InvariantMap`);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var _SyncGroup = class _SyncGroup {
|
|
20
|
+
constructor(key) {
|
|
21
|
+
this.key = key;
|
|
22
|
+
this.type = `continuity`;
|
|
23
|
+
this.globals = [];
|
|
24
|
+
this.actions = [];
|
|
25
|
+
this.perspectives = [];
|
|
26
|
+
}
|
|
27
|
+
static create(key, builder) {
|
|
28
|
+
const group = new _SyncGroup(key);
|
|
29
|
+
const { type, globals, actions, perspectives } = builder(group);
|
|
30
|
+
const token = { type, key, globals, actions, perspectives };
|
|
31
|
+
_SyncGroup.existing.set(key, token);
|
|
32
|
+
return token;
|
|
33
|
+
}
|
|
34
|
+
add(...args) {
|
|
35
|
+
const zeroth = args[0];
|
|
36
|
+
if (zeroth.type === `atom` || zeroth.type === `mutable_atom`) {
|
|
37
|
+
const globals = args;
|
|
38
|
+
this.globals.push(...globals);
|
|
39
|
+
} else if (zeroth.type === `transaction`) {
|
|
40
|
+
const actions = args;
|
|
41
|
+
this.actions.push(...actions);
|
|
42
|
+
} else {
|
|
43
|
+
const [family, index] = args;
|
|
44
|
+
this.perspectives.push({
|
|
45
|
+
type: `realtime_perspective`,
|
|
46
|
+
resourceAtoms: family,
|
|
47
|
+
perspectiveAtoms: index
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
_SyncGroup.existing = new InvariantMap();
|
|
54
|
+
var SyncGroup = _SyncGroup;
|
|
55
|
+
function continuity(options) {
|
|
56
|
+
const { key, config } = options;
|
|
57
|
+
const token = SyncGroup.create(key, config);
|
|
58
|
+
const { actions } = token;
|
|
59
|
+
for (const action of actions) {
|
|
60
|
+
assignTransactionToContinuity(key, action.key, IMPLICIT.STORE);
|
|
61
|
+
}
|
|
62
|
+
setEpochNumberOfContinuity(key, -1, IMPLICIT.STORE);
|
|
63
|
+
return token;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { InvariantMap, SyncGroup, continuity };
|
|
67
|
+
//# sourceMappingURL=out.js.map
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/realtime-continuity.ts"],"names":[],"mappings":";;;AAOA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAGA,IAAM,eAAN,cAAiC,IAAU;AAAA,EAC1C,IAAI,KAAQ,OAAgB;AAClC,QAAI,KAAK,IAAI,GAAG,GAAG;AAClB,cAAQ,KAAK,6DAA6D;AAAA,QACzE;AAAA,QACA;AAAA,MACD,CAAC;AACD,aAAO;AAAA,IACR;AACA,WAAO,MAAM,IAAI,KAAK,KAAK;AAAA,EAC5B;AAAA,EAEO,QAAc;AACpB,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAC/C;AACD;AAsBO,IAAM,aAAN,MAAM,WAAU;AAAA,EAOZ,YAA+B,KAAa;AAAb;AANzC,SAAU,OAAO;AAEjB,SAAU,UAA4B,CAAC;AACvC,SAAU,UAAmC,CAAC;AAC9C,SAAU,eAA6C,CAAC;AAAA,EAED;AAAA,EAIvD,OAAc,OACb,KACA,SACkB;AAClB,UAAM,QAAQ,IAAI,WAAU,GAAG;AAC/B,UAAM,EAAE,MAAM,SAAS,SAAS,aAAa,IAAI,QAAQ,KAAK;AAC9D,UAAM,QAAQ,EAAE,MAAM,KAAK,SAAS,SAAS,aAAa;AAC1D,eAAU,SAAS,IAAI,KAAK,KAAK;AACjC,WAAO;AAAA,EACR;AAAA,EAWO,OACH,MAIS;AACZ,UAAM,SAAS,KAAK,CAAC;AACrB,QAAI,OAAO,SAAS,UAAU,OAAO,SAAS,gBAAgB;AAC7D,YAAM,UAAU;AAChB,WAAK,QAAQ,KAAK,GAAG,OAAO;AAAA,IAC7B,WAAW,OAAO,SAAS,eAAe;AACzC,YAAM,UAAU;AAChB,WAAK,QAAQ,KAAK,GAAG,OAAO;AAAA,IAC7B,OAAO;AACN,YAAM,CAAC,QAAQ,KAAK,IAAI;AAIxB,WAAK,aAAa,KAAK;AAAA,QACtB,MAAM;AAAA,QACN,eAAe;AAAA,QACf,kBAAkB;AAAA,MACnB,CAAC;AAAA,IACF;AACA,WAAO;AAAA,EACR;AACD;AAzDa,WASE,WACb,IAAI,aAAa;AAVZ,IAAM,YAAN;AAgEA,SAAS,WAAW,SAA6C;AACvE,QAAM,EAAE,KAAK,OAAO,IAAI;AACxB,QAAM,QAAQ,UAAU,OAAO,KAAK,MAAM;AAC1C,QAAM,EAAE,QAAQ,IAAI;AACpB,aAAW,UAAU,SAAS;AAC7B,kCAA8B,KAAK,OAAO,KAAK,SAAS,KAAK;AAAA,EAC9D;AACA,6BAA2B,KAAK,IAAI,SAAS,KAAK;AAClD,SAAO;AACR","sourcesContent":["import type {\n\tAtomFamilyToken,\n\tAtomToken,\n\tReadableFamilyToken,\n\tReadableToken,\n\tTransactionToken,\n} from \"atom.io\"\nimport {\n\tIMPLICIT,\n\tassignTransactionToContinuity,\n\tsetEpochNumberOfContinuity,\n} from \"atom.io/internal\"\nimport type { Json } from \"atom.io/json\"\n\nexport class InvariantMap<K, V> extends Map<K, V> {\n\tpublic set(key: K, value: V): this {\n\t\tif (this.has(key)) {\n\t\t\tconsole.warn(`Tried to set a key that already exists in an InvariantMap`, {\n\t\t\t\tkey,\n\t\t\t\tvalue,\n\t\t\t})\n\t\t\treturn this\n\t\t}\n\t\treturn super.set(key, value)\n\t}\n\n\tpublic clear(): void {\n\t\tthrow new Error(`Cannot clear an InvariantMap`)\n\t}\n}\n\nexport type PerspectiveToken<\n\tF extends AtomFamilyToken<any>,\n\tT extends F extends AtomFamilyToken<infer T, any> ? T : never,\n> = {\n\ttype: `realtime_perspective`\n\tresourceAtoms: F\n\tperspectiveAtoms: ReadableFamilyToken<Iterable<ReadableToken<T>>, string>\n}\n\nexport type ContinuityToken = {\n\treadonly type: `continuity`\n\treadonly key: string\n\treadonly globals: AtomToken<any>[]\n\treadonly actions: TransactionToken<any>[]\n\treadonly perspectives: PerspectiveToken<\n\t\tAtomFamilyToken<any, Json.Serializable>,\n\t\tJson.Serializable\n\t>[]\n}\n\nexport class SyncGroup {\n\tprotected type = `continuity` as const\n\n\tprotected globals: AtomToken<any>[] = []\n\tprotected actions: TransactionToken<any>[] = []\n\tprotected perspectives: PerspectiveToken<any, any>[] = []\n\n\tprotected constructor(protected readonly key: string) {}\n\n\tpublic static existing: InvariantMap<string, ContinuityToken> =\n\t\tnew InvariantMap()\n\tpublic static create(\n\t\tkey: string,\n\t\tbuilder: (group: SyncGroup) => SyncGroup,\n\t): ContinuityToken {\n\t\tconst group = new SyncGroup(key)\n\t\tconst { type, globals, actions, perspectives } = builder(group)\n\t\tconst token = { type, key, globals, actions, perspectives }\n\t\tSyncGroup.existing.set(key, token)\n\t\treturn token\n\t}\n\n\tpublic add(...atoms: AtomToken<any>[]): SyncGroup\n\tpublic add(...args: TransactionToken<any>[]): SyncGroup\n\tpublic add<\n\t\tF extends AtomFamilyToken<any>,\n\t\tT extends F extends AtomFamilyToken<infer T> ? T : never,\n\t>(\n\t\tfamily: AtomFamilyToken<T, any>,\n\t\tindex: ReadableFamilyToken<Iterable<AtomToken<T>>, string>,\n\t): SyncGroup\n\tpublic add(\n\t\t...args:\n\t\t\t| readonly AtomToken<any>[]\n\t\t\t| readonly TransactionToken<any>[]\n\t\t\t| [AtomFamilyToken<any, any>, ReadableFamilyToken<Iterable<any>, string>]\n\t): SyncGroup {\n\t\tconst zeroth = args[0]\n\t\tif (zeroth.type === `atom` || zeroth.type === `mutable_atom`) {\n\t\t\tconst globals = args as AtomToken<any>[]\n\t\t\tthis.globals.push(...globals)\n\t\t} else if (zeroth.type === `transaction`) {\n\t\t\tconst actions = args as TransactionToken<any>[]\n\t\t\tthis.actions.push(...actions)\n\t\t} else {\n\t\t\tconst [family, index] = args as [\n\t\t\t\tAtomFamilyToken<any, any>,\n\t\t\t\tReadableFamilyToken<Iterable<any>, string>,\n\t\t\t]\n\t\t\tthis.perspectives.push({\n\t\t\t\ttype: `realtime_perspective`,\n\t\t\t\tresourceAtoms: family,\n\t\t\t\tperspectiveAtoms: index,\n\t\t\t})\n\t\t}\n\t\treturn this\n\t}\n}\n\nexport type ContinuityOptions = {\n\tkey: string\n\tconfig: (group: SyncGroup) => SyncGroup\n}\n\nexport function continuity(options: ContinuityOptions): ContinuityToken {\n\tconst { key, config } = options\n\tconst token = SyncGroup.create(key, config)\n\tconst { actions } = token\n\tfor (const action of actions) {\n\t\tassignTransactionToContinuity(key, action.key, IMPLICIT.STORE)\n\t}\n\tsetEpochNumberOfContinuity(key, -1, IMPLICIT.STORE)\n\treturn token\n}\n\n// const counterStates = atomFamily<number, { c: string }>({\n// \tkey: `counter`,\n// \tdefault: 0,\n// })\n// const counterIndices = atomFamily<{ c: string }[], string>({\n// \tkey: `counterIndex`,\n// \tdefault: [],\n// })\n// const nameStates = atomFamily<number, { n: string }>({\n// \tkey: `name`,\n// \tdefault: 0,\n// })\n// const nameIndices = atomFamily<{ n: string }[], string>({\n// \tkey: `nameIndex`,\n// \tdefault: [],\n// })\n\n// const counterContinuity = continuity({\n// \tkey: `counter`,\n// \tconfig: (group) =>\n// \t\tgroup\n// \t\t\t.add(counterStates, counterIndices)\n// \t\t\t.add(nameStates, nameIndices)\n// \t\t\t.add(nameStates, nameIndices)\n// \t\t\t.add(nameStates, nameIndices),\n// })\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "atom.io-realtime",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"browser": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./realtime-continuity"
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AtomFamilyToken,
|
|
3
|
+
AtomToken,
|
|
4
|
+
ReadableFamilyToken,
|
|
5
|
+
ReadableToken,
|
|
6
|
+
TransactionToken,
|
|
7
|
+
} from "atom.io"
|
|
8
|
+
import {
|
|
9
|
+
IMPLICIT,
|
|
10
|
+
assignTransactionToContinuity,
|
|
11
|
+
setEpochNumberOfContinuity,
|
|
12
|
+
} from "atom.io/internal"
|
|
13
|
+
import type { Json } from "atom.io/json"
|
|
14
|
+
|
|
15
|
+
export class InvariantMap<K, V> extends Map<K, V> {
|
|
16
|
+
public set(key: K, value: V): this {
|
|
17
|
+
if (this.has(key)) {
|
|
18
|
+
console.warn(`Tried to set a key that already exists in an InvariantMap`, {
|
|
19
|
+
key,
|
|
20
|
+
value,
|
|
21
|
+
})
|
|
22
|
+
return this
|
|
23
|
+
}
|
|
24
|
+
return super.set(key, value)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public clear(): void {
|
|
28
|
+
throw new Error(`Cannot clear an InvariantMap`)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type PerspectiveToken<
|
|
33
|
+
F extends AtomFamilyToken<any>,
|
|
34
|
+
T extends F extends AtomFamilyToken<infer T, any> ? T : never,
|
|
35
|
+
> = {
|
|
36
|
+
type: `realtime_perspective`
|
|
37
|
+
resourceAtoms: F
|
|
38
|
+
perspectiveAtoms: ReadableFamilyToken<Iterable<ReadableToken<T>>, string>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type ContinuityToken = {
|
|
42
|
+
readonly type: `continuity`
|
|
43
|
+
readonly key: string
|
|
44
|
+
readonly globals: AtomToken<any>[]
|
|
45
|
+
readonly actions: TransactionToken<any>[]
|
|
46
|
+
readonly perspectives: PerspectiveToken<
|
|
47
|
+
AtomFamilyToken<any, Json.Serializable>,
|
|
48
|
+
Json.Serializable
|
|
49
|
+
>[]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class SyncGroup {
|
|
53
|
+
protected type = `continuity` as const
|
|
54
|
+
|
|
55
|
+
protected globals: AtomToken<any>[] = []
|
|
56
|
+
protected actions: TransactionToken<any>[] = []
|
|
57
|
+
protected perspectives: PerspectiveToken<any, any>[] = []
|
|
58
|
+
|
|
59
|
+
protected constructor(protected readonly key: string) {}
|
|
60
|
+
|
|
61
|
+
public static existing: InvariantMap<string, ContinuityToken> =
|
|
62
|
+
new InvariantMap()
|
|
63
|
+
public static create(
|
|
64
|
+
key: string,
|
|
65
|
+
builder: (group: SyncGroup) => SyncGroup,
|
|
66
|
+
): ContinuityToken {
|
|
67
|
+
const group = new SyncGroup(key)
|
|
68
|
+
const { type, globals, actions, perspectives } = builder(group)
|
|
69
|
+
const token = { type, key, globals, actions, perspectives }
|
|
70
|
+
SyncGroup.existing.set(key, token)
|
|
71
|
+
return token
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public add(...atoms: AtomToken<any>[]): SyncGroup
|
|
75
|
+
public add(...args: TransactionToken<any>[]): SyncGroup
|
|
76
|
+
public add<
|
|
77
|
+
F extends AtomFamilyToken<any>,
|
|
78
|
+
T extends F extends AtomFamilyToken<infer T> ? T : never,
|
|
79
|
+
>(
|
|
80
|
+
family: AtomFamilyToken<T, any>,
|
|
81
|
+
index: ReadableFamilyToken<Iterable<AtomToken<T>>, string>,
|
|
82
|
+
): SyncGroup
|
|
83
|
+
public add(
|
|
84
|
+
...args:
|
|
85
|
+
| readonly AtomToken<any>[]
|
|
86
|
+
| readonly TransactionToken<any>[]
|
|
87
|
+
| [AtomFamilyToken<any, any>, ReadableFamilyToken<Iterable<any>, string>]
|
|
88
|
+
): SyncGroup {
|
|
89
|
+
const zeroth = args[0]
|
|
90
|
+
if (zeroth.type === `atom` || zeroth.type === `mutable_atom`) {
|
|
91
|
+
const globals = args as AtomToken<any>[]
|
|
92
|
+
this.globals.push(...globals)
|
|
93
|
+
} else if (zeroth.type === `transaction`) {
|
|
94
|
+
const actions = args as TransactionToken<any>[]
|
|
95
|
+
this.actions.push(...actions)
|
|
96
|
+
} else {
|
|
97
|
+
const [family, index] = args as [
|
|
98
|
+
AtomFamilyToken<any, any>,
|
|
99
|
+
ReadableFamilyToken<Iterable<any>, string>,
|
|
100
|
+
]
|
|
101
|
+
this.perspectives.push({
|
|
102
|
+
type: `realtime_perspective`,
|
|
103
|
+
resourceAtoms: family,
|
|
104
|
+
perspectiveAtoms: index,
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
return this
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type ContinuityOptions = {
|
|
112
|
+
key: string
|
|
113
|
+
config: (group: SyncGroup) => SyncGroup
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function continuity(options: ContinuityOptions): ContinuityToken {
|
|
117
|
+
const { key, config } = options
|
|
118
|
+
const token = SyncGroup.create(key, config)
|
|
119
|
+
const { actions } = token
|
|
120
|
+
for (const action of actions) {
|
|
121
|
+
assignTransactionToContinuity(key, action.key, IMPLICIT.STORE)
|
|
122
|
+
}
|
|
123
|
+
setEpochNumberOfContinuity(key, -1, IMPLICIT.STORE)
|
|
124
|
+
return token
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// const counterStates = atomFamily<number, { c: string }>({
|
|
128
|
+
// key: `counter`,
|
|
129
|
+
// default: 0,
|
|
130
|
+
// })
|
|
131
|
+
// const counterIndices = atomFamily<{ c: string }[], string>({
|
|
132
|
+
// key: `counterIndex`,
|
|
133
|
+
// default: [],
|
|
134
|
+
// })
|
|
135
|
+
// const nameStates = atomFamily<number, { n: string }>({
|
|
136
|
+
// key: `name`,
|
|
137
|
+
// default: 0,
|
|
138
|
+
// })
|
|
139
|
+
// const nameIndices = atomFamily<{ n: string }[], string>({
|
|
140
|
+
// key: `nameIndex`,
|
|
141
|
+
// default: [],
|
|
142
|
+
// })
|
|
143
|
+
|
|
144
|
+
// const counterContinuity = continuity({
|
|
145
|
+
// key: `counter`,
|
|
146
|
+
// config: (group) =>
|
|
147
|
+
// group
|
|
148
|
+
// .add(counterStates, counterIndices)
|
|
149
|
+
// .add(nameStates, nameIndices)
|
|
150
|
+
// .add(nameStates, nameIndices)
|
|
151
|
+
// .add(nameStates, nameIndices),
|
|
152
|
+
// })
|