atom.io 0.34.2 → 0.36.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/dist/eslint-plugin/index.d.ts +2 -18
- package/dist/eslint-plugin/index.d.ts.map +1 -1
- package/dist/eslint-plugin/index.js +4 -141
- package/dist/eslint-plugin/index.js.map +1 -1
- package/dist/internal/index.d.ts +74 -77
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +197 -202
- package/dist/internal/index.js.map +1 -1
- package/dist/json/index.d.ts +9 -17
- package/dist/json/index.d.ts.map +1 -1
- package/dist/json/index.js +3 -33
- package/dist/json/index.js.map +1 -1
- package/dist/main/index.d.ts +689 -795
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js +55 -23
- package/dist/main/index.js.map +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-devtools/index.d.ts.map +1 -1
- package/dist/react-devtools/index.js +10 -10
- package/dist/react-devtools/index.js.map +1 -1
- package/dist/realtime/index.d.ts +4 -4
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime/index.js +5 -11
- package/dist/realtime/index.js.map +1 -1
- package/dist/realtime-client/index.d.ts +2 -2
- package/dist/realtime-client/index.d.ts.map +1 -1
- package/dist/realtime-client/index.js +10 -10
- package/dist/realtime-client/index.js.map +1 -1
- package/dist/realtime-react/index.d.ts +2 -2
- package/dist/realtime-react/index.d.ts.map +1 -1
- package/dist/realtime-react/index.js.map +1 -1
- package/dist/realtime-server/index.d.ts +18 -18
- package/dist/realtime-server/index.d.ts.map +1 -1
- package/dist/realtime-server/index.js +13 -19
- package/dist/realtime-server/index.js.map +1 -1
- package/dist/transceivers/set-rtx/index.d.ts +1 -1
- package/dist/transceivers/set-rtx/index.d.ts.map +1 -1
- package/dist/transceivers/set-rtx/index.js.map +1 -1
- package/package.json +7 -7
- package/src/eslint-plugin/index.ts +0 -1
- package/src/eslint-plugin/rules/explicit-state-types.ts +8 -1
- package/src/eslint-plugin/rules/index.ts +0 -1
- package/src/internal/atom/create-regular-atom.ts +1 -0
- package/src/internal/atom/dispose-atom.ts +1 -0
- package/src/internal/atom/index.ts +0 -1
- package/src/internal/families/find-in-store.ts +4 -5
- package/src/internal/families/get-family-of-token.ts +4 -5
- package/src/internal/families/index.ts +0 -1
- package/src/internal/families/init-family-member.ts +3 -4
- package/src/internal/families/seek-in-store.ts +4 -5
- package/src/internal/get-state/read-or-compute-value.ts +14 -2
- package/src/internal/index.ts +116 -96
- package/src/internal/ingest-updates/ingest-creation-disposal.ts +18 -15
- package/src/internal/ingest-updates/ingest-selector-update.ts +9 -5
- package/src/internal/join/get-internal-relations-from-store.ts +2 -2
- package/src/internal/join/join-internal.ts +6 -18
- package/src/internal/molecule.ts +1 -0
- package/src/internal/mutable/create-mutable-atom-family.ts +37 -21
- package/src/internal/mutable/create-mutable-atom.ts +17 -13
- package/src/internal/mutable/get-json-family.ts +7 -6
- package/src/internal/mutable/get-json-token.ts +6 -13
- package/src/internal/mutable/get-update-family.ts +7 -8
- package/src/internal/mutable/get-update-token.ts +5 -9
- package/src/internal/mutable/tracker-family.ts +10 -13
- package/src/internal/mutable/tracker.ts +66 -90
- package/src/internal/mutable/transceiver.ts +35 -8
- package/src/internal/selector/dispose-selector.ts +9 -9
- package/src/internal/selector/register-selector.ts +2 -2
- package/src/internal/set-state/copy-mutable-if-needed.ts +8 -6
- package/src/internal/set-state/reset-atom-or-selector.ts +11 -4
- package/src/internal/set-state/set-atom.ts +1 -1
- package/src/internal/store/counterfeit.ts +3 -4
- package/src/internal/store/deposit.ts +7 -9
- package/src/internal/store/store.ts +2 -2
- package/src/internal/store/withdraw.ts +7 -11
- package/src/json/entries.ts +7 -7
- package/src/json/index.ts +0 -2
- package/src/main/atom.ts +68 -127
- package/src/main/dispose-state.ts +4 -6
- package/src/main/find-state.ts +6 -13
- package/src/main/get-state.ts +0 -2
- package/src/main/index.ts +1 -176
- package/src/main/join.ts +2 -9
- package/src/main/logger.ts +7 -7
- package/src/main/reset-state.ts +0 -2
- package/src/main/selector.ts +5 -72
- package/src/main/set-state.ts +1 -4
- package/src/main/silo.ts +14 -5
- package/src/main/subscribe.ts +0 -7
- package/src/main/timeline.ts +1 -18
- package/src/main/tokens.ts +245 -0
- package/src/main/transaction.ts +28 -60
- package/src/main/validators.ts +2 -2
- package/src/react/use-json.ts +15 -25
- package/src/react-devtools/store.ts +61 -45
- package/src/realtime/shared-room-store.ts +12 -25
- package/src/realtime-client/pull-mutable-atom-family-member.ts +5 -9
- package/src/realtime-client/pull-mutable-atom.ts +5 -9
- package/src/realtime-react/use-pull-mutable-atom.ts +3 -5
- package/src/realtime-react/use-pull-mutable-family-member.ts +3 -4
- package/src/realtime-server/realtime-mutable-family-provider.ts +3 -4
- package/src/realtime-server/realtime-mutable-provider.ts +2 -3
- package/src/realtime-server/realtime-server-stores/server-room-external-actions.ts +6 -5
- package/src/realtime-server/realtime-server-stores/server-user-store.ts +9 -18
- package/src/transceivers/set-rtx/set-rtx.ts +1 -1
- package/src/eslint-plugin/rules/synchronous-selector-dependencies.ts +0 -140
- package/src/eslint-plugin/walk.ts +0 -81
- package/src/internal/atom/create-standalone-atom.ts +0 -39
- package/src/internal/families/create-atom-family.ts +0 -38
- package/src/json/select-json-family.ts +0 -55
- package/src/json/select-json.ts +0 -19
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
-
import { ESLint
|
|
3
|
-
import { RuleType } from "@eslint/core";
|
|
2
|
+
import { ESLint } from "eslint";
|
|
4
3
|
|
|
5
4
|
//#region src/eslint-plugin/rules/explicit-state-types.d.ts
|
|
6
5
|
declare const explicitStateTypes: ESLintUtils.RuleModule<`noTypeArgument`, [], unknown, ESLintUtils.RuleListener>;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/eslint-plugin/rules/synchronous-selector-dependencies.d.ts
|
|
9
|
-
declare const synchronousSelectorDependencies: {
|
|
10
|
-
meta: {
|
|
11
|
-
type: RuleType;
|
|
12
|
-
docs: {
|
|
13
|
-
description: string;
|
|
14
|
-
category: string;
|
|
15
|
-
recommended: boolean;
|
|
16
|
-
url: string;
|
|
17
|
-
};
|
|
18
|
-
schema: never[];
|
|
19
|
-
};
|
|
20
|
-
create(context: Rule.RuleContext): Rule.NodeListener;
|
|
21
|
-
};
|
|
22
6
|
declare namespace index_d_exports {
|
|
23
|
-
export { explicitStateTypes
|
|
7
|
+
export { explicitStateTypes };
|
|
24
8
|
}
|
|
25
9
|
//#endregion
|
|
26
10
|
//#region src/eslint-plugin/index.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin"],"sources":["../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":[],"mappings":";;;;cAgBaA,oBAAoB,WAAA,CAAY,0CAI5C,WAAA,CAAY;;;;;;cEdPC,QAAQ,MAAA,CAAO"}
|
|
@@ -6,6 +6,8 @@ const createRule = ESLintUtils.RuleCreator((name) => `https://atom.io.fyi/docs/e
|
|
|
6
6
|
const STATE_FUNCTIONS = [
|
|
7
7
|
`atom`,
|
|
8
8
|
`atomFamily`,
|
|
9
|
+
`mutableAtom`,
|
|
10
|
+
`mutableAtomFamily`,
|
|
9
11
|
`selector`,
|
|
10
12
|
`selectorFamily`
|
|
11
13
|
];
|
|
@@ -41,153 +43,14 @@ const explicitStateTypes = createRule({
|
|
|
41
43
|
}
|
|
42
44
|
});
|
|
43
45
|
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/eslint-plugin/walk.ts
|
|
46
|
-
function walk(node, callback, depth = 0) {
|
|
47
|
-
callback(node, depth);
|
|
48
|
-
switch (node.type) {
|
|
49
|
-
case `AwaitExpression`:
|
|
50
|
-
walk(node.argument, callback, depth + 1);
|
|
51
|
-
break;
|
|
52
|
-
case `FunctionExpression`:
|
|
53
|
-
case `ArrowFunctionExpression`:
|
|
54
|
-
for (const param of node.params) walk(param, callback, depth + 1);
|
|
55
|
-
walk(node.body, callback, depth + 1);
|
|
56
|
-
break;
|
|
57
|
-
case `BlockStatement`:
|
|
58
|
-
for (const statement of node.body) walk(statement, callback, depth + 1);
|
|
59
|
-
break;
|
|
60
|
-
case `IfStatement`:
|
|
61
|
-
walk(node.test, callback, depth);
|
|
62
|
-
walk(node.consequent, callback, depth);
|
|
63
|
-
if (node.alternate) walk(node.alternate, callback, depth);
|
|
64
|
-
break;
|
|
65
|
-
case `SwitchStatement`:
|
|
66
|
-
walk(node.discriminant, callback, depth + 1);
|
|
67
|
-
for (const caseOrDefault of node.cases) walk(caseOrDefault, callback, depth);
|
|
68
|
-
break;
|
|
69
|
-
case `ReturnStatement`:
|
|
70
|
-
if (node.argument) walk(node.argument, callback, depth);
|
|
71
|
-
break;
|
|
72
|
-
case `SwitchCase`:
|
|
73
|
-
if (node.test) walk(node.test, callback, depth);
|
|
74
|
-
for (const statement of node.consequent) walk(statement, callback, depth);
|
|
75
|
-
break;
|
|
76
|
-
case `VariableDeclaration`:
|
|
77
|
-
for (const declaration of node.declarations) {
|
|
78
|
-
walk(declaration, callback, depth);
|
|
79
|
-
if (declaration.init) walk(declaration.init, callback, depth);
|
|
80
|
-
}
|
|
81
|
-
break;
|
|
82
|
-
case `BinaryExpression`:
|
|
83
|
-
walk(node.left, callback, depth);
|
|
84
|
-
walk(node.right, callback, depth);
|
|
85
|
-
break;
|
|
86
|
-
case `ConditionalExpression`:
|
|
87
|
-
walk(node.test, callback, depth + 1);
|
|
88
|
-
walk(node.consequent, callback, depth + 1);
|
|
89
|
-
walk(node.alternate, callback, depth + 1);
|
|
90
|
-
break;
|
|
91
|
-
case `MemberExpression`:
|
|
92
|
-
walk(node.object, callback, depth);
|
|
93
|
-
walk(node.property, callback, depth);
|
|
94
|
-
break;
|
|
95
|
-
case `CallExpression`:
|
|
96
|
-
walk(node.callee, callback, depth);
|
|
97
|
-
for (const argument of node.arguments) walk(argument, callback, depth);
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/eslint-plugin/rules/synchronous-selector-dependencies.ts
|
|
104
|
-
const synchronousSelectorDependencies = {
|
|
105
|
-
meta: {
|
|
106
|
-
type: `problem`,
|
|
107
|
-
docs: {
|
|
108
|
-
description: `disallow await before calling get on the parameter's get method inside selector`,
|
|
109
|
-
category: `Possible Errors`,
|
|
110
|
-
recommended: false,
|
|
111
|
-
url: ``
|
|
112
|
-
},
|
|
113
|
-
schema: []
|
|
114
|
-
},
|
|
115
|
-
create(context) {
|
|
116
|
-
return { CallExpression(node) {
|
|
117
|
-
let selectorComputation;
|
|
118
|
-
if (`name` in node.callee && node.callee.name === `selectorFamily`) {
|
|
119
|
-
if (node.arguments[0].type === `ObjectExpression`) {
|
|
120
|
-
const selectorLookupProperty = node.arguments[0].properties.find((prop) => {
|
|
121
|
-
return `key` in prop && `name` in prop.key && prop.key.name === `get`;
|
|
122
|
-
});
|
|
123
|
-
const selectorLookup = selectorLookupProperty?.value;
|
|
124
|
-
if (selectorLookup?.type === `FunctionExpression` || selectorLookup?.type === `ArrowFunctionExpression`) {
|
|
125
|
-
if (selectorLookup.body.type === `BlockStatement`) {
|
|
126
|
-
for (const statement of selectorLookup.body.body) if (statement.type === `ReturnStatement` && statement.argument) selectorComputation = statement.argument;
|
|
127
|
-
} else if (selectorLookup.body.type === `FunctionExpression` || selectorLookup.body.type === `ArrowFunctionExpression`) selectorComputation = selectorLookup.body;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (`name` in node.callee && node.callee.name === `selector`) {
|
|
132
|
-
if (node.arguments[0].type === `ObjectExpression`) {
|
|
133
|
-
const selectorComputationProperty = node.arguments[0].properties.find((prop) => {
|
|
134
|
-
return `key` in prop && `name` in prop.key && prop.key.name === `get`;
|
|
135
|
-
});
|
|
136
|
-
selectorComputation = selectorComputationProperty?.value;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (selectorComputation?.type === `FunctionExpression` || selectorComputation?.type === `ArrowFunctionExpression`) {
|
|
140
|
-
const nonDestructuredTransactorsName = selectorComputation.params[0] && `name` in selectorComputation.params[0] ? selectorComputation.params[0].name : void 0;
|
|
141
|
-
let awaited;
|
|
142
|
-
let awaitNode;
|
|
143
|
-
walk(selectorComputation, (n, depth) => {
|
|
144
|
-
if (typeof awaited === `number`) {
|
|
145
|
-
if (awaited > depth) {
|
|
146
|
-
awaited = void 0;
|
|
147
|
-
awaitNode = void 0;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
switch (n.type) {
|
|
151
|
-
case `AwaitExpression`:
|
|
152
|
-
awaited = depth;
|
|
153
|
-
awaitNode = n;
|
|
154
|
-
break;
|
|
155
|
-
case `CallExpression`: if (awaitNode) {
|
|
156
|
-
let willReport = false;
|
|
157
|
-
switch (n.callee.type) {
|
|
158
|
-
case `MemberExpression`:
|
|
159
|
-
if (n.callee.object.type === `Identifier` && n.callee.object.name === nonDestructuredTransactorsName && n.callee.property.type === `Identifier` && n.callee.property.name === `get`) willReport = true;
|
|
160
|
-
break;
|
|
161
|
-
case `Identifier`:
|
|
162
|
-
if (n.callee.name === `get`) willReport = true;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
if (willReport) context.report({
|
|
166
|
-
node: awaitNode,
|
|
167
|
-
message: `Using await before calling the 'get' transactor is not allowed.`
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
} };
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
|
|
177
46
|
//#endregion
|
|
178
47
|
//#region src/eslint-plugin/rules/index.ts
|
|
179
48
|
var rules_exports = {};
|
|
180
|
-
__export(rules_exports, {
|
|
181
|
-
explicitStateTypes: () => explicitStateTypes,
|
|
182
|
-
synchronousSelectorDependencies: () => synchronousSelectorDependencies
|
|
183
|
-
});
|
|
49
|
+
__export(rules_exports, { explicitStateTypes: () => explicitStateTypes });
|
|
184
50
|
|
|
185
51
|
//#endregion
|
|
186
52
|
//#region src/eslint-plugin/index.ts
|
|
187
|
-
const plugin = { rules: {
|
|
188
|
-
"explicit-state-types": explicitStateTypes,
|
|
189
|
-
"synchronous-selector-dependencies": synchronousSelectorDependencies
|
|
190
|
-
} };
|
|
53
|
+
const plugin = { rules: { "explicit-state-types": explicitStateTypes } };
|
|
191
54
|
var eslint_plugin_default = plugin;
|
|
192
55
|
|
|
193
56
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","node: ESTree.Node","callback: (node: ESTree.Node, depth: number) => void","synchronousSelectorDependencies: {\n\tmeta: {\n\t\ttype: RuleType\n\t\tdocs: {\n\t\t\tdescription: string\n\t\t\tcategory: string\n\t\t\trecommended: boolean\n\t\t\turl: string\n\t\t}\n\t\tschema: never[]\n\t}\n\tcreate(context: Rule.RuleContext): Rule.NodeListener\n}","selectorComputation: ESTree.Node | undefined","awaited: number | undefined","awaitNode: ESTree.AwaitExpression | undefined","plugin: ESLint.Plugin"],"sources":["../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/walk.ts","../../src/eslint-plugin/rules/synchronous-selector-dependencies.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/switch-exhaustiveness-check */\nimport { ESLintUtils } from \"@typescript-eslint/utils\"\n\nconst createRule = ESLintUtils.RuleCreator(\n\t(name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`,\n)\n\nconst STATE_FUNCTIONS = [`atom`, `atomFamily`, `selector`, `selectorFamily`]\n\nexport const explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n> = createRule({\n\tname: `explicit-state-types`,\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `State declarations must have generic type arguments directly passed to them`,\n\t\t},\n\t\tmessages: {\n\t\t\tnoTypeArgument: `State declarations must have generic type arguments directly passed to them.`,\n\t\t},\n\t\tschema: [], // no options\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst { callee } = node\n\t\t\t\tswitch (callee.type) {\n\t\t\t\t\tcase `Identifier`: {\n\t\t\t\t\t\tif (STATE_FUNCTIONS.includes(callee.name)) {\n\t\t\t\t\t\t\tif (!node.typeArguments) {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase `MemberExpression`: {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcallee.property.type === `Identifier` &&\n\t\t\t\t\t\t\tSTATE_FUNCTIONS.includes(callee.property.name)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tif (!node.typeArguments) {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t},\n})\n","/* eslint-disable @typescript-eslint/switch-exhaustiveness-check */\nimport type * as ESTree from \"estree\"\n\nexport function walk(\n\tnode: ESTree.Node,\n\tcallback: (node: ESTree.Node, depth: number) => void,\n\tdepth = 0,\n): void {\n\tcallback(node, depth)\n\n\tswitch (node.type) {\n\t\tcase `AwaitExpression`:\n\t\t\twalk(node.argument, callback, depth + 1)\n\t\t\tbreak\n\t\tcase `FunctionExpression`:\n\t\tcase `ArrowFunctionExpression`:\n\t\t\tfor (const param of node.params) {\n\t\t\t\twalk(param, callback, depth + 1)\n\t\t\t}\n\t\t\twalk(node.body, callback, depth + 1)\n\t\t\tbreak\n\t\tcase `BlockStatement`:\n\t\t\tfor (const statement of node.body) {\n\t\t\t\twalk(statement, callback, depth + 1)\n\t\t\t}\n\t\t\tbreak\n\t\tcase `IfStatement`:\n\t\t\twalk(node.test, callback, depth)\n\t\t\twalk(node.consequent, callback, depth)\n\t\t\tif (node.alternate) {\n\t\t\t\twalk(node.alternate, callback, depth)\n\t\t\t}\n\t\t\tbreak\n\t\tcase `SwitchStatement`:\n\t\t\twalk(node.discriminant, callback, depth + 1)\n\t\t\tfor (const caseOrDefault of node.cases) {\n\t\t\t\twalk(caseOrDefault, callback, depth)\n\t\t\t}\n\t\t\tbreak\n\t\tcase `ReturnStatement`:\n\t\t\tif (node.argument) {\n\t\t\t\twalk(node.argument, callback, depth)\n\t\t\t}\n\t\t\tbreak\n\t\tcase `SwitchCase`:\n\t\t\tif (node.test) {\n\t\t\t\twalk(node.test, callback, depth)\n\t\t\t}\n\t\t\tfor (const statement of node.consequent) {\n\t\t\t\twalk(statement, callback, depth)\n\t\t\t}\n\t\t\tbreak\n\t\tcase `VariableDeclaration`:\n\t\t\tfor (const declaration of node.declarations) {\n\t\t\t\twalk(declaration, callback, depth)\n\t\t\t\tif (declaration.init) {\n\t\t\t\t\twalk(declaration.init, callback, depth)\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\tcase `BinaryExpression`:\n\t\t\twalk(node.left, callback, depth)\n\t\t\twalk(node.right, callback, depth)\n\t\t\tbreak\n\t\tcase `ConditionalExpression`:\n\t\t\twalk(node.test, callback, depth + 1)\n\t\t\twalk(node.consequent, callback, depth + 1)\n\t\t\twalk(node.alternate, callback, depth + 1)\n\t\t\tbreak\n\t\tcase `MemberExpression`:\n\t\t\twalk(node.object, callback, depth)\n\t\t\twalk(node.property, callback, depth)\n\t\t\tbreak\n\t\tcase `CallExpression`:\n\t\t\twalk(node.callee, callback, depth)\n\t\t\tfor (const argument of node.arguments) {\n\t\t\t\twalk(argument, callback, depth)\n\t\t\t}\n\t\t\tbreak\n\t}\n}\n","/* eslint-disable @typescript-eslint/switch-exhaustiveness-check */\nimport type { RuleType } from \"@eslint/core\"\nimport type { Rule } from \"eslint\"\nimport type * as ESTree from \"estree\"\n\nimport { walk } from \"../walk\"\n\nexport const synchronousSelectorDependencies: {\n\tmeta: {\n\t\ttype: RuleType\n\t\tdocs: {\n\t\t\tdescription: string\n\t\t\tcategory: string\n\t\t\trecommended: boolean\n\t\t\turl: string\n\t\t}\n\t\tschema: never[]\n\t}\n\tcreate(context: Rule.RuleContext): Rule.NodeListener\n} = {\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `disallow await before calling get on the parameter's get method inside selector`,\n\t\t\tcategory: `Possible Errors`,\n\t\t\trecommended: false,\n\t\t\turl: ``, // URL to documentation page for this rule\n\t\t},\n\t\tschema: [], // no options\n\t},\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tlet selectorComputation: ESTree.Node | undefined\n\t\t\t\tif (`name` in node.callee && node.callee.name === `selectorFamily`) {\n\t\t\t\t\tif (node.arguments[0].type === `ObjectExpression`) {\n\t\t\t\t\t\tconst selectorLookupProperty = node.arguments[0].properties.find(\n\t\t\t\t\t\t\t(prop): prop is ESTree.Property => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t`key` in prop && `name` in prop.key && prop.key.name === `get`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst selectorLookup = selectorLookupProperty?.value\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tselectorLookup?.type === `FunctionExpression` ||\n\t\t\t\t\t\t\tselectorLookup?.type === `ArrowFunctionExpression`\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tif (selectorLookup.body.type === `BlockStatement`) {\n\t\t\t\t\t\t\t\tfor (const statement of selectorLookup.body.body) {\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tstatement.type === `ReturnStatement` &&\n\t\t\t\t\t\t\t\t\t\tstatement.argument\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tselectorComputation = statement.argument\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tselectorLookup.body.type === `FunctionExpression` ||\n\t\t\t\t\t\t\t\tselectorLookup.body.type === `ArrowFunctionExpression`\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tselectorComputation = selectorLookup.body\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (`name` in node.callee && node.callee.name === `selector`) {\n\t\t\t\t\tif (node.arguments[0].type === `ObjectExpression`) {\n\t\t\t\t\t\tconst selectorComputationProperty =\n\t\t\t\t\t\t\tnode.arguments[0].properties.find(\n\t\t\t\t\t\t\t\t(prop): prop is ESTree.Property => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t`key` in prop &&\n\t\t\t\t\t\t\t\t\t\t`name` in prop.key &&\n\t\t\t\t\t\t\t\t\t\tprop.key.name === `get`\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tselectorComputation = selectorComputationProperty?.value\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\tselectorComputation?.type === `FunctionExpression` ||\n\t\t\t\t\tselectorComputation?.type === `ArrowFunctionExpression`\n\t\t\t\t) {\n\t\t\t\t\tconst nonDestructuredTransactorsName =\n\t\t\t\t\t\tselectorComputation.params[0] &&\n\t\t\t\t\t\t`name` in selectorComputation.params[0]\n\t\t\t\t\t\t\t? selectorComputation.params[0].name\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\tlet awaited: number | undefined\n\t\t\t\t\tlet awaitNode: ESTree.AwaitExpression | undefined\n\t\t\t\t\twalk(selectorComputation, (n, depth) => {\n\t\t\t\t\t\t// console.log(`${`\\t`.repeat(depth)}${n.type} ${n.name ?? ``}`)\n\t\t\t\t\t\tif (typeof awaited === `number`) {\n\t\t\t\t\t\t\tif (awaited > depth) {\n\t\t\t\t\t\t\t\tawaited = undefined\n\t\t\t\t\t\t\t\tawaitNode = undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tswitch (n.type) {\n\t\t\t\t\t\t\tcase `AwaitExpression`:\n\t\t\t\t\t\t\t\tawaited = depth\n\t\t\t\t\t\t\t\tawaitNode = n\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tcase `CallExpression`:\n\t\t\t\t\t\t\t\tif (awaitNode) {\n\t\t\t\t\t\t\t\t\tlet willReport = false\n\t\t\t\t\t\t\t\t\tswitch (n.callee.type) {\n\t\t\t\t\t\t\t\t\t\tcase `MemberExpression`:\n\t\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t\tn.callee.object.type === `Identifier` &&\n\t\t\t\t\t\t\t\t\t\t\t\tn.callee.object.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tnonDestructuredTransactorsName &&\n\t\t\t\t\t\t\t\t\t\t\t\tn.callee.property.type === `Identifier` &&\n\t\t\t\t\t\t\t\t\t\t\t\tn.callee.property.name === `get`\n\t\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\t\twillReport = true\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\tcase `Identifier`:\n\t\t\t\t\t\t\t\t\t\t\tif (n.callee.name === `get`) {\n\t\t\t\t\t\t\t\t\t\t\t\twillReport = true\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (willReport) {\n\t\t\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\t\t\tnode: awaitNode,\n\t\t\t\t\t\t\t\t\t\t\tmessage: `Using await before calling the 'get' transactor is not allowed.`,\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t},\n} satisfies Rule.RuleModule\n","export * from \"./explicit-state-types\"\nexport * from \"./synchronous-selector-dependencies\"\n","import type { ESLint } from \"eslint\"\n\nimport * as Rules from \"./rules\"\n\nexport { Rules }\n\nconst plugin: ESLint.Plugin = {\n\trules: {\n\t\t\"explicit-state-types\": Rules.explicitStateTypes as any,\n\t\t\"synchronous-selector-dependencies\": Rules.synchronousSelectorDependencies,\n\t},\n} satisfies ESLint.Plugin\n\nexport default plugin\n"],"mappings":";;;;AAGA,MAAM,aAAa,YAAY,YAC9B,CAAC,SAAS,CAAC,uCAAuC,EAAE,MAAM,CAC1D;AAED,MAAM,kBAAkB;CAAC,CAAC,IAAI,CAAC;CAAE,CAAC,UAAU,CAAC;CAAE,CAAC,QAAQ,C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Ae"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin"],"sources":["../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/switch-exhaustiveness-check */\nimport { ESLintUtils } from \"@typescript-eslint/utils\"\n\nconst createRule = ESLintUtils.RuleCreator(\n\t(name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`,\n)\n\nconst STATE_FUNCTIONS = [\n\t`atom`,\n\t`atomFamily`,\n\t`mutableAtom`,\n\t`mutableAtomFamily`,\n\t`selector`,\n\t`selectorFamily`,\n]\n\nexport const explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n> = createRule({\n\tname: `explicit-state-types`,\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `State declarations must have generic type arguments directly passed to them`,\n\t\t},\n\t\tmessages: {\n\t\t\tnoTypeArgument: `State declarations must have generic type arguments directly passed to them.`,\n\t\t},\n\t\tschema: [], // no options\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst { callee } = node\n\t\t\t\tswitch (callee.type) {\n\t\t\t\t\tcase `Identifier`: {\n\t\t\t\t\t\tif (STATE_FUNCTIONS.includes(callee.name)) {\n\t\t\t\t\t\t\tif (!node.typeArguments) {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase `MemberExpression`: {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcallee.property.type === `Identifier` &&\n\t\t\t\t\t\t\tSTATE_FUNCTIONS.includes(callee.property.name)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tif (!node.typeArguments) {\n\t\t\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t},\n})\n","export * from \"./explicit-state-types\"\n","import type { ESLint } from \"eslint\"\n\nimport * as Rules from \"./rules\"\n\nexport { Rules }\n\nconst plugin: ESLint.Plugin = {\n\trules: {\n\t\t\"explicit-state-types\": Rules.explicitStateTypes as any,\n\t},\n} satisfies ESLint.Plugin\n\nexport default plugin\n"],"mappings":";;;;AAGA,MAAM,aAAa,YAAY,YAC9B,CAAC,SAAS,CAAC,uCAAuC,EAAE,MAAM,CAC1D;AAED,MAAM,kBAAkB;CACvB,CAAC,IAAI,CAAC;CACN,CAAC,UAAU,CAAC;CACZ,CAAC,WAAW,CAAC;CACb,CAAC,iBAAiB,CAAC;CACnB,CAAC,QAAQ,CAAC;CACV,CAAC,cAAc,CAAC;AAChB;AAED,MAAaA,qBAKT,WAAW;CACd,MAAM,CAAC,oBAAoB,CAAC;CAC5B,MAAM;EACL,MAAM,CAAC,OAAO,CAAC;EACf,MAAM,EACL,aAAa,CAAC,2EAA2E,CAAC,CAC1F;EACD,UAAU,EACT,gBAAgB,CAAC,4EAA4E,CAAC,CAC9F;EACD,QAAQ,CAAE;CACV;CACD,gBAAgB,CAAE;CAClB,OAAO,SAAS;AACf,SAAO,EACN,eAAe,MAAM;GACpB,MAAM,EAAE,QAAQ,GAAG;AACnB,WAAQ,OAAO,MAAf;IACC,KAAK,CAAC,UAAU,CAAC;AAChB,SAAI,gBAAgB,SAAS,OAAO,KAAK,EACxC;UAAI,CAAC,KAAK,eACT,QAAQ,OAAO;OACd;OACA,WAAW,CAAC,cAAc,CAAC;MAC3B,EAAC;KACF;AAEF;IAED,KAAK,CAAC,gBAAgB,CAAC,CACtB,KACC,OAAO,SAAS,SAAS,CAAC,UAAU,CAAC,IACrC,gBAAgB,SAAS,OAAO,SAAS,KAAK,EAE9C;SAAI,CAAC,KAAK,eACT,QAAQ,OAAO;MACd;MACA,WAAW,CAAC,cAAc,CAAC;KAC3B,EAAC;IACF;GAGH;EACD,EACD;CACD;AACD,EAAC;;;;;;;;;AE7DF,MAAMC,SAAwB,EAC7B,OAAO,EACN,2CACA,EACD;AAED,4BAAe"}
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Func as Func$1, Store as Store$1 } from "atom.io/internal";
|
|
2
|
-
import { Canonical, Json,
|
|
3
|
-
import { Above, ActorToolkit, Anarchy, AtomFamilyToken, AtomIOLogger, AtomIOToken, AtomToken, Claim, CompoundFrom, CompoundTypedKey, FamilyMetadata, HeldSelectorFamilyToken, HeldSelectorToken, Hierarchy, JoinOptions, JoinStates, JoinToken, KeyedStateUpdate, Logger, MoleculeCreation, MoleculeDisposal, MoleculeTransfer, MutableAtomFamilyOptions, MutableAtomFamilyToken, MutableAtomOptions, MutableAtomToken, PureSelectorFamilyToken, PureSelectorToken, ReadableFamilyToken, ReadableToken, ReadonlyHeldSelectorFamilyOptions, ReadonlyHeldSelectorFamilyToken, ReadonlyHeldSelectorOptions, ReadonlyHeldSelectorToken, ReadonlyPureSelectorFamilyOptions, ReadonlyPureSelectorFamilyToken, ReadonlyPureSelectorOptions, ReadonlyPureSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, RegularAtomFamilyOptions, RegularAtomFamilyToken, RegularAtomOptions, RegularAtomToken, SelectorFamilyToken, SelectorToken,
|
|
4
|
-
import { SetRTX
|
|
2
|
+
import { Canonical, Json, stringified } from "atom.io/json";
|
|
3
|
+
import { Above, ActorToolkit, Anarchy, AtomFamilyToken, AtomIOLogger, AtomIOToken, AtomToken, Claim, CompoundFrom, CompoundTypedKey, FamilyMetadata, HeldSelectorFamilyToken, HeldSelectorToken, Hierarchy, JoinOptions, JoinStates, JoinToken, KeyedStateUpdate, Logger, MoleculeCreation, MoleculeDisposal, MoleculeTransfer, MutableAtomFamilyOptions, MutableAtomFamilyToken, MutableAtomOptions, MutableAtomToken, PureSelectorFamilyToken, PureSelectorToken, ReadableFamilyToken, ReadableToken, ReadonlyHeldSelectorFamilyOptions, ReadonlyHeldSelectorFamilyToken, ReadonlyHeldSelectorOptions, ReadonlyHeldSelectorToken, ReadonlyPureSelectorFamilyOptions, ReadonlyPureSelectorFamilyToken, ReadonlyPureSelectorOptions, ReadonlyPureSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, RegularAtomFamilyOptions, RegularAtomFamilyToken, RegularAtomOptions, RegularAtomToken, SelectorFamilyToken, SelectorToken, SingularTypedKey, StateCreation, StateDisposal, StateUpdate, TimelineManageable, TimelineOptions, TimelineToken, TimelineUpdate, TokenType, TransactionOptions, TransactionToken, TransactionUpdate, TransactionUpdateHandler, UpdateHandler, Vassal, WritableFamilyToken, WritableHeldSelectorFamilyOptions, WritableHeldSelectorFamilyToken, WritableHeldSelectorOptions, WritableHeldSelectorToken, WritablePureSelectorFamilyOptions, WritablePureSelectorFamilyToken, WritablePureSelectorOptions, WritablePureSelectorToken, WritableSelectorFamilyToken, WritableSelectorToken, WritableToken, WriterToolkit } from "atom.io";
|
|
4
|
+
import { SetRTX } from "atom.io/transceivers/set-rtx";
|
|
5
5
|
|
|
6
6
|
//#region src/internal/store/circular-buffer.d.ts
|
|
7
7
|
declare class CircularBuffer<T> {
|
|
@@ -25,7 +25,7 @@ declare const FAMILY_MEMBER_TOKEN_TYPES: {
|
|
|
25
25
|
readonly writable_held_selector_family: "writable_held_selector";
|
|
26
26
|
readonly writable_pure_selector_family: "writable_pure_selector";
|
|
27
27
|
};
|
|
28
|
-
declare function counterfeit<T extends Transceiver<any>,
|
|
28
|
+
declare function counterfeit<T extends Transceiver<any, any>, K extends Canonical, Key extends K>(token: MutableAtomFamilyToken<T, K>, key: Key): MutableAtomToken<T>;
|
|
29
29
|
declare function counterfeit<T, K extends Canonical, Key extends K>(token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T>;
|
|
30
30
|
declare function counterfeit<T, K extends Canonical, Key extends K>(token: AtomFamilyToken<T, K>, key: Key): AtomToken<T>;
|
|
31
31
|
declare function counterfeit<T, K extends Canonical, Key extends K>(token: WritablePureSelectorFamilyToken<T, K>, key: Key): WritablePureSelectorToken<T>;
|
|
@@ -200,7 +200,7 @@ type TransactionEpoch = {
|
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region src/internal/store/deposit.d.ts
|
|
202
202
|
declare function deposit<T>(state: RegularAtom<T>): RegularAtomToken<T>;
|
|
203
|
-
declare function deposit<T extends Transceiver<any>>(state: MutableAtom<T
|
|
203
|
+
declare function deposit<T extends Transceiver<any, any>>(state: MutableAtom<T>): MutableAtomToken<T>;
|
|
204
204
|
declare function deposit<T>(state: Atom<T>): AtomToken<T>;
|
|
205
205
|
declare function deposit<T>(state: WritablePureSelector<T>): WritablePureSelectorToken<T>;
|
|
206
206
|
declare function deposit<T>(state: ReadonlyPureSelector<T>): ReadonlyPureSelectorToken<T>;
|
|
@@ -208,7 +208,7 @@ declare function deposit<T>(state: Selector<T>): SelectorToken<T>;
|
|
|
208
208
|
declare function deposit<T>(state: WritableState<T>): WritableToken<T>;
|
|
209
209
|
declare function deposit<T>(state: ReadableState<T>): ReadableToken<T>;
|
|
210
210
|
declare function deposit<T, K extends Canonical>(state: RegularAtomFamily<T, K>): RegularAtomFamilyToken<T, K>;
|
|
211
|
-
declare function deposit<T extends Transceiver<any>,
|
|
211
|
+
declare function deposit<T extends Transceiver<any, any>, K extends Canonical>(state: MutableAtomFamily<T, K>): MutableAtomFamilyToken<T, K>;
|
|
212
212
|
declare function deposit<T>(state: AtomFamily<T, any>): AtomFamilyToken<T, any>;
|
|
213
213
|
declare function deposit<T>(state: WritablePureSelectorFamily<T, any>): WritablePureSelectorFamilyToken<T, any>;
|
|
214
214
|
declare function deposit<T>(state: ReadonlyPureSelectorFamily<T, any>): ReadonlyPureSelectorFamilyToken<T, any>;
|
|
@@ -229,7 +229,7 @@ declare function editRelationsInStore<ASide extends string, AType extends string
|
|
|
229
229
|
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>;
|
|
230
230
|
//#endregion
|
|
231
231
|
//#region src/internal/join/get-internal-relations-from-store.d.ts
|
|
232
|
-
declare function getInternalRelationsFromStore(token: JoinToken<any, any, any, any, any, any>, store: Store): MutableAtomFamilyToken<SetRTX<string>,
|
|
232
|
+
declare function getInternalRelationsFromStore(token: JoinToken<any, any, any, any, any, any>, store: Store): MutableAtomFamilyToken<SetRTX<string>, string>;
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/internal/molecule.d.ts
|
|
235
235
|
type Molecule<K extends Canonical> = {
|
|
@@ -253,9 +253,9 @@ declare class Join<const ASide extends string, const AType extends string, const
|
|
|
253
253
|
relations: Junction<ASide, AType, BSide, BType, Content>;
|
|
254
254
|
states: JoinStateFamilies<ASide, AType, BSide, BType, Cardinality, Content>;
|
|
255
255
|
core: {
|
|
256
|
-
relatedKeysAtoms: MutableAtomFamilyToken<SetRTX<string>,
|
|
256
|
+
relatedKeysAtoms: MutableAtomFamilyToken<SetRTX<string>, string>;
|
|
257
257
|
};
|
|
258
|
-
transact(toolkit:
|
|
258
|
+
transact(toolkit: WriterToolkit, run: (join: Join<ASide, AType, BSide, BType, Cardinality, Content>) => void): void;
|
|
259
259
|
store: Store;
|
|
260
260
|
realm: Anarchy;
|
|
261
261
|
[Symbol.dispose](): void;
|
|
@@ -349,8 +349,8 @@ declare class Store implements Lineage {
|
|
|
349
349
|
selectorGraph: Junction<`upstreamSelectorKey`, string, `downstreamSelectorKey`, string, {
|
|
350
350
|
source: string;
|
|
351
351
|
}>;
|
|
352
|
-
trackers: Map<string, Tracker<Transceiver<any>>>;
|
|
353
|
-
families: Map<string, HeldSelectorFamily<any, any> | MutableAtomFamily<any, any
|
|
352
|
+
trackers: Map<string, Tracker<Transceiver<any, any>>>;
|
|
353
|
+
families: Map<string, HeldSelectorFamily<any, any> | MutableAtomFamily<any, any> | PureSelectorFamily<any, any> | RegularAtomFamily<any, any>>;
|
|
354
354
|
joins: Map<string, Join<any, any, any, any, any, any>>;
|
|
355
355
|
transactions: Map<string, Transaction<Func>>;
|
|
356
356
|
transactionMeta: TransactionEpoch | TransactionProgress<Func>;
|
|
@@ -401,7 +401,7 @@ declare const clearStore: (store: Store) => void;
|
|
|
401
401
|
//#endregion
|
|
402
402
|
//#region src/internal/store/withdraw.d.ts
|
|
403
403
|
declare function withdraw<T>(store: Store, token: RegularAtomToken<T>): RegularAtom<T>;
|
|
404
|
-
declare function withdraw<T extends Transceiver<any>>(store: Store, token: MutableAtomToken<T, any>): MutableAtom<T
|
|
404
|
+
declare function withdraw<T extends Transceiver<any, any>>(store: Store, token: MutableAtomToken<T, any>): MutableAtom<T>;
|
|
405
405
|
declare function withdraw<T>(store: Store, token: AtomToken<T>): Atom<T>;
|
|
406
406
|
declare function withdraw<T>(store: Store, token: WritableHeldSelectorToken<T>): WritableHeldSelector<T>;
|
|
407
407
|
declare function withdraw<T>(store: Store, token: ReadonlyHeldSelectorToken<T>): ReadonlyHeldSelector<T>;
|
|
@@ -415,7 +415,7 @@ declare function withdraw<T>(store: Store, token: SelectorToken<T>): Selector<T>
|
|
|
415
415
|
declare function withdraw<T>(store: Store, token: WritableToken<T>): WritableState<T>;
|
|
416
416
|
declare function withdraw<T>(store: Store, token: ReadableToken<T>): ReadableState<T>;
|
|
417
417
|
declare function withdraw<T, K extends Canonical>(store: Store, token: RegularAtomFamilyToken<T, K>): RegularAtomFamily<T, K>;
|
|
418
|
-
declare function withdraw<T extends Transceiver<any>,
|
|
418
|
+
declare function withdraw<T extends Transceiver<any, any>, K extends Canonical>(store: Store, token: MutableAtomFamilyToken<T, K>): MutableAtomFamily<T, K>;
|
|
419
419
|
declare function withdraw<T, K extends Canonical>(store: Store, token: AtomFamilyToken<T, K>): AtomFamily<T, K>;
|
|
420
420
|
declare function withdraw<T, K extends Canonical>(store: Store, token: ReadonlyHeldSelectorFamilyToken<T, K>): ReadonlyHeldSelectorFamily<T, K>;
|
|
421
421
|
declare function withdraw<T, K extends Canonical>(store: Store, token: WritableHeldSelectorFamilyToken<T, K>): WritableHeldSelectorFamily<T, K>;
|
|
@@ -435,34 +435,40 @@ declare function withdraw<T>(store: Store, token: ReadableToken<T>): ReadableSta
|
|
|
435
435
|
declare function withdraw(store: Store, token: AtomIOToken): AtomIOInternalResource;
|
|
436
436
|
//#endregion
|
|
437
437
|
//#region src/internal/mutable/transceiver.d.ts
|
|
438
|
-
interface Transceiver<S extends Json.Serializable> {
|
|
438
|
+
interface Transceiver<S extends Json.Serializable, J extends Json.Serializable> {
|
|
439
439
|
do: (update: S) => number | `OUT_OF_RANGE` | null;
|
|
440
440
|
undo: (update: S) => void;
|
|
441
441
|
subscribe: (key: string, fn: (update: S) => void) => () => void;
|
|
442
442
|
cacheUpdateNumber: number;
|
|
443
443
|
getUpdateNumber: (update: S) => number;
|
|
444
|
+
toJSON: () => J;
|
|
444
445
|
}
|
|
445
|
-
|
|
446
|
+
type TransceiverConstructor<J extends Json.Serializable, T extends Transceiver<any, J>> = (new () => T) & {
|
|
447
|
+
fromJSON: (json: J) => T;
|
|
448
|
+
};
|
|
449
|
+
declare function isTransceiver(value: unknown): value is Transceiver<Json.Serializable, Json.Serializable>;
|
|
446
450
|
type TransceiverMode = `playback` | `record` | `transaction`;
|
|
447
|
-
type
|
|
451
|
+
type SignalFrom<T extends Transceiver<any, any>> = T extends Transceiver<infer S, any> ? S : never;
|
|
452
|
+
type AsJSON<T extends Transceiver<any, any>> = T extends Transceiver<any, infer J> ? J : never;
|
|
453
|
+
type ConstructorOf<T extends Transceiver<any, any>> = TransceiverConstructor<AsJSON<T>, T>;
|
|
448
454
|
//#endregion
|
|
449
455
|
//#region src/internal/mutable/create-mutable-atom.d.ts
|
|
450
|
-
declare function createMutableAtom<T extends Transceiver<any
|
|
456
|
+
declare function createMutableAtom<T extends Transceiver<any, any>>(store: Store, options: MutableAtomOptions<T>, family: FamilyMetadata | undefined): MutableAtomToken<T>;
|
|
451
457
|
//#endregion
|
|
452
458
|
//#region src/internal/mutable/create-mutable-atom-family.d.ts
|
|
453
|
-
declare function createMutableAtomFamily<T extends Transceiver<any>,
|
|
459
|
+
declare function createMutableAtomFamily<T extends Transceiver<any, any>, K extends Canonical>(store: Store, options: MutableAtomFamilyOptions<T, K>, internalRoles?: string[]): MutableAtomFamilyToken<T, K>;
|
|
454
460
|
//#endregion
|
|
455
461
|
//#region src/internal/mutable/get-json-family.d.ts
|
|
456
|
-
declare const getJsonFamily: <Core extends Transceiver<Json.Serializable
|
|
462
|
+
declare const getJsonFamily: <Core extends Transceiver<Json.Serializable, Json.Serializable>, Key extends Canonical>(mutableAtomFamily: MutableAtomFamilyToken<Core, Key>, store: Store) => WritablePureSelectorFamily<ReturnType<Core[`toJSON`]>, Key>;
|
|
457
463
|
//#endregion
|
|
458
464
|
//#region src/internal/mutable/get-json-token.d.ts
|
|
459
|
-
declare const getJsonToken: <
|
|
465
|
+
declare const getJsonToken: <T extends Transceiver<any, any>>(store: Store, mutableAtomToken: MutableAtomToken<T>) => WritablePureSelectorToken<AsJSON<T>>;
|
|
460
466
|
//#endregion
|
|
461
467
|
//#region src/internal/mutable/get-update-family.d.ts
|
|
462
|
-
declare const getUpdateFamily: <
|
|
468
|
+
declare const getUpdateFamily: <T extends Transceiver<Json.Serializable, Json.Serializable>, K extends string>(mutableAtomFamily: MutableAtomFamilyToken<T, K>, store: Store) => AtomFamily<SignalFrom<T>, K>;
|
|
463
469
|
//#endregion
|
|
464
470
|
//#region src/internal/mutable/get-update-token.d.ts
|
|
465
|
-
declare const getUpdateToken: <
|
|
471
|
+
declare const getUpdateToken: <T extends Transceiver<any, any>>(mutableAtomToken: MutableAtomToken<T>) => RegularAtomToken<SignalFrom<T>>;
|
|
466
472
|
//#endregion
|
|
467
473
|
//#region src/internal/mutable/tracker.d.ts
|
|
468
474
|
/**
|
|
@@ -470,24 +476,24 @@ declare const getUpdateToken: <Core extends Transceiver<any>, SerializableCore e
|
|
|
470
476
|
* subscribe to the transceiver's inner value. When the inner value changes,
|
|
471
477
|
* the tracker will update its own state to reflect the change.
|
|
472
478
|
*/
|
|
473
|
-
declare class Tracker<
|
|
479
|
+
declare class Tracker<T extends Transceiver<any, any>> {
|
|
474
480
|
private initializeState;
|
|
475
481
|
private unsubscribeFromInnerValue;
|
|
476
482
|
private unsubscribeFromState;
|
|
477
|
-
private
|
|
478
|
-
private
|
|
479
|
-
|
|
480
|
-
|
|
483
|
+
private captureSignalsFromCore;
|
|
484
|
+
private supplySignalsToCore;
|
|
485
|
+
mutableAtomToken: MutableAtomToken<T>;
|
|
486
|
+
latestSignalToken: RegularAtomToken<SignalFrom<T> | null>;
|
|
481
487
|
[Symbol.dispose]: () => void;
|
|
482
|
-
constructor(
|
|
488
|
+
constructor(mutableAtomToken: MutableAtomToken<T>, store: Store);
|
|
483
489
|
}
|
|
484
490
|
//#endregion
|
|
485
491
|
//#region src/internal/mutable/tracker-family.d.ts
|
|
486
|
-
declare class FamilyTracker<
|
|
492
|
+
declare class FamilyTracker<T extends Transceiver<any, any>, K extends Canonical> {
|
|
487
493
|
private trackers;
|
|
488
|
-
readonly latestUpdateAtoms: RegularAtomFamily<(
|
|
489
|
-
readonly mutableAtoms: MutableAtomFamily<
|
|
490
|
-
constructor(mutableAtoms: MutableAtomFamily<
|
|
494
|
+
readonly latestUpdateAtoms: RegularAtomFamily<(T extends Transceiver<infer Signal, any> ? Signal : never) | null, K>;
|
|
495
|
+
readonly mutableAtoms: MutableAtomFamily<T, K>;
|
|
496
|
+
constructor(mutableAtoms: MutableAtomFamily<T, K>, store: Store);
|
|
491
497
|
}
|
|
492
498
|
//#endregion
|
|
493
499
|
//#region src/internal/arbitrary.d.ts
|
|
@@ -496,10 +502,6 @@ declare function arbitrary(random?: () => number): string;
|
|
|
496
502
|
//#region src/internal/atom/create-regular-atom.d.ts
|
|
497
503
|
declare function createRegularAtom<T>(store: Store, options: RegularAtomOptions<T>, family: FamilyMetadata | undefined): RegularAtomToken<T>;
|
|
498
504
|
//#endregion
|
|
499
|
-
//#region src/internal/atom/create-standalone-atom.d.ts
|
|
500
|
-
declare function createStandaloneAtom<T>(store: Store, options: RegularAtomOptions<T>): RegularAtomToken<T>;
|
|
501
|
-
declare function createStandaloneAtom<T extends Transceiver<any>, J extends Json.Serializable>(store: Store, options: MutableAtomOptions<T, J>): MutableAtomToken<T, J>;
|
|
502
|
-
//#endregion
|
|
503
505
|
//#region src/internal/atom/dispose-atom.d.ts
|
|
504
506
|
declare function disposeAtom(store: Store, atomToken: AtomToken<unknown>): void;
|
|
505
507
|
//#endregion
|
|
@@ -533,10 +535,6 @@ declare const evictCachedValue: (target: Store, key: string) => void;
|
|
|
533
535
|
//#region src/internal/capitalize.d.ts
|
|
534
536
|
declare function capitalize<S extends string>(string: S): Capitalize<S>;
|
|
535
537
|
//#endregion
|
|
536
|
-
//#region src/internal/families/create-atom-family.d.ts
|
|
537
|
-
declare function createAtomFamily<T extends Transceiver<any>, J extends Json.Serializable, K extends Canonical>(store: Store, options: MutableAtomFamilyOptions<T, J, K>): MutableAtomFamilyToken<T, J, K>;
|
|
538
|
-
declare function createAtomFamily<T, K extends Canonical>(store: Store, options: RegularAtomFamilyOptions<T, K>): RegularAtomFamilyToken<T, K>;
|
|
539
|
-
//#endregion
|
|
540
538
|
//#region src/internal/families/create-readonly-pure-selector-family.d.ts
|
|
541
539
|
declare function createReadonlyPureSelectorFamily<T, K extends Canonical>(store: Store, options: ReadonlyPureSelectorFamilyOptions<T, K>, internalRoles?: string[]): ReadonlyPureSelectorFamilyToken<T, K>;
|
|
542
540
|
//#endregion
|
|
@@ -557,7 +555,7 @@ declare function disposeFromStore(store: Store, token: ReadableToken<any>): void
|
|
|
557
555
|
declare function disposeFromStore<K extends Canonical>(store: Store, token: ReadableFamilyToken<any, K>, key: K): void;
|
|
558
556
|
//#endregion
|
|
559
557
|
//#region src/internal/families/find-in-store.d.ts
|
|
560
|
-
declare function findInStore<T extends Transceiver<any>,
|
|
558
|
+
declare function findInStore<T extends Transceiver<any, any>, K extends Canonical, Key extends K>(store: Store, token: MutableAtomFamilyToken<T, K>, key: Key): MutableAtomToken<T, K>;
|
|
561
559
|
declare function findInStore<T, K extends Canonical, Key extends K>(store: Store, token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K>;
|
|
562
560
|
declare function findInStore<T, K extends Canonical, Key extends K>(store: Store, token: AtomFamilyToken<T, K>, key: Key): AtomToken<T, K>;
|
|
563
561
|
declare function findInStore<T, K extends Canonical, Key extends K>(store: Store, token: WritablePureSelectorFamilyToken<T, K>, key: Key): WritablePureSelectorToken<T, K>;
|
|
@@ -567,7 +565,7 @@ declare function findInStore<T, K extends Canonical, Key extends K>(store: Store
|
|
|
567
565
|
declare function findInStore<T, K extends Canonical, Key extends K>(store: Store, token: ReadableFamilyToken<T, K>, key: Key): ReadableToken<T, K>;
|
|
568
566
|
//#endregion
|
|
569
567
|
//#region src/internal/families/init-family-member.d.ts
|
|
570
|
-
declare function initFamilyMemberInStore<T extends Transceiver<any>,
|
|
568
|
+
declare function initFamilyMemberInStore<T extends Transceiver<any, any>, K extends Canonical, Key extends K>(store: Store, token: MutableAtomFamilyToken<T, K>, key: Key): MutableAtomToken<T, K>;
|
|
571
569
|
declare function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(store: Store, token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K>;
|
|
572
570
|
declare function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(store: Store, token: AtomFamilyToken<T, K>, key: Key): AtomToken<T, K>;
|
|
573
571
|
declare function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(store: Store, token: WritablePureSelectorFamilyToken<T, K>, key: Key): WritablePureSelectorToken<T, K>;
|
|
@@ -577,7 +575,7 @@ declare function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(
|
|
|
577
575
|
declare function initFamilyMemberInStore<T, K extends Canonical, Key extends K>(store: Store, token: ReadableFamilyToken<T, K>, key: Key): ReadableToken<T, K>;
|
|
578
576
|
//#endregion
|
|
579
577
|
//#region src/internal/families/seek-in-store.d.ts
|
|
580
|
-
declare function seekInStore<T extends Transceiver<any>,
|
|
578
|
+
declare function seekInStore<T extends Transceiver<any, any>, K extends Canonical, Key extends K>(store: Store, token: MutableAtomFamilyToken<T, K>, key: Key): MutableAtomToken<T, K> | undefined;
|
|
581
579
|
declare function seekInStore<T, K extends Canonical, Key extends K>(store: Store, token: RegularAtomFamilyToken<T, K>, key: Key): RegularAtomToken<T, K> | undefined;
|
|
582
580
|
declare function seekInStore<T, K extends Canonical, Key extends K>(store: Store, token: AtomFamilyToken<T, K>, key: Key): AtomToken<T, K> | undefined;
|
|
583
581
|
declare function seekInStore<T, K extends Canonical, Key extends K>(store: Store, token: WritablePureSelectorFamilyToken<T, K>, key: Key): WritablePureSelectorToken<T, K> | undefined;
|
|
@@ -697,7 +695,7 @@ declare function disposeSelector(store: Store, selectorToken: SelectorToken<unkn
|
|
|
697
695
|
declare const getSelectorDependencyKeys: (store: Store, key: string) => (AtomKey<unknown> | ReadonlySelectorKey<unknown> | SelectorKey<unknown>)[];
|
|
698
696
|
//#endregion
|
|
699
697
|
//#region src/internal/selector/register-selector.d.ts
|
|
700
|
-
declare const registerSelector: (store: Store, selectorType: `readonly_held_selector` | `readonly_pure_selector` | `writable_held_selector` | `writable_pure_selector`, selectorKey: string, covered: Set<string>) =>
|
|
698
|
+
declare const registerSelector: (store: Store, selectorType: `readonly_held_selector` | `readonly_pure_selector` | `writable_held_selector` | `writable_pure_selector`, selectorKey: string, covered: Set<string>) => WriterToolkit;
|
|
701
699
|
//#endregion
|
|
702
700
|
//#region src/internal/selector/trace-selector-atoms.d.ts
|
|
703
701
|
declare const traceRootSelectorAtoms: (store: Store, selectorKey: string, covered?: Set<string>) => Map<string, Atom<unknown>>;
|
|
@@ -754,37 +752,37 @@ type AtomIOState = {
|
|
|
754
752
|
oldValue: any;
|
|
755
753
|
}>;
|
|
756
754
|
};
|
|
757
|
-
type RegularAtom<T> = AtomIOState & {
|
|
755
|
+
type RegularAtom<T> = Flat<AtomIOState & {
|
|
758
756
|
type: `atom`;
|
|
759
757
|
default: T | (() => T);
|
|
760
758
|
cleanup?: () => void;
|
|
761
|
-
}
|
|
762
|
-
type MutableAtom<T extends Transceiver<any
|
|
759
|
+
}>;
|
|
760
|
+
type MutableAtom<T extends Transceiver<any, any>> = Flat<AtomIOState & {
|
|
763
761
|
type: `mutable_atom`;
|
|
764
|
-
|
|
762
|
+
class: ConstructorOf<T>;
|
|
765
763
|
cleanup?: () => void;
|
|
766
|
-
}
|
|
767
|
-
type Atom<T> = RegularAtom<T> | (T extends Transceiver<any> ? MutableAtom<T
|
|
768
|
-
type WritableHeldSelector<T> = AtomIOState & {
|
|
764
|
+
}>;
|
|
765
|
+
type Atom<T> = RegularAtom<T> | (T extends Transceiver<any, any> ? MutableAtom<T> : never);
|
|
766
|
+
type WritableHeldSelector<T> = Flat<AtomIOState & {
|
|
769
767
|
type: `writable_held_selector`;
|
|
770
768
|
const: T;
|
|
771
769
|
get: () => T;
|
|
772
770
|
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
773
|
-
}
|
|
774
|
-
type ReadonlyHeldSelector<T> = AtomIOState & {
|
|
771
|
+
}>;
|
|
772
|
+
type ReadonlyHeldSelector<T> = Flat<AtomIOState & {
|
|
775
773
|
type: `readonly_held_selector`;
|
|
776
774
|
const: T;
|
|
777
775
|
get: () => T;
|
|
778
|
-
}
|
|
779
|
-
type WritablePureSelector<T> = AtomIOState & {
|
|
776
|
+
}>;
|
|
777
|
+
type WritablePureSelector<T> = Flat<AtomIOState & {
|
|
780
778
|
type: `writable_pure_selector`;
|
|
781
779
|
get: () => T;
|
|
782
780
|
set: (newValue: T | ((oldValue: T) => T)) => void;
|
|
783
|
-
}
|
|
784
|
-
type ReadonlyPureSelector<T> = AtomIOState & {
|
|
781
|
+
}>;
|
|
782
|
+
type ReadonlyPureSelector<T> = Flat<AtomIOState & {
|
|
785
783
|
type: `readonly_pure_selector`;
|
|
786
784
|
get: () => T;
|
|
787
|
-
}
|
|
785
|
+
}>;
|
|
788
786
|
type ReadonlySelector<T> = ReadonlyHeldSelector<T> | ReadonlyPureSelector<T>;
|
|
789
787
|
type WritableSelector<T> = WritableHeldSelector<T> | WritablePureSelector<T>;
|
|
790
788
|
type HeldSelector<T> = ReadonlyHeldSelector<T> | WritableHeldSelector<T>;
|
|
@@ -794,41 +792,40 @@ type WritableState<T> = Atom<T> | WritableSelector<T>;
|
|
|
794
792
|
type ReadableState<T> = Atom<T> | Selector<T>;
|
|
795
793
|
type RegularAtomFamily<T, K extends Canonical> = RegularAtomFamilyToken<T, K> & {
|
|
796
794
|
(key: K): RegularAtomToken<T>;
|
|
797
|
-
subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>;
|
|
798
795
|
install: (store: Store) => void;
|
|
799
796
|
internalRoles: string[] | undefined;
|
|
797
|
+
subject: Subject<StateCreation<AtomToken<T>> | StateDisposal<AtomToken<T>>>;
|
|
800
798
|
};
|
|
801
|
-
type MutableAtomFamily<T extends Transceiver<any>,
|
|
802
|
-
(key: K): MutableAtomToken<T, J>;
|
|
803
|
-
subject: Subject<StateCreation<MutableAtomToken<T, J>> | StateDisposal<MutableAtomToken<T, J>>>;
|
|
799
|
+
type MutableAtomFamily<T extends Transceiver<any, any>, K extends Canonical> = Flat<MutableAtomFamilyToken<T, K> & {
|
|
804
800
|
install: (store: Store) => void;
|
|
805
801
|
internalRoles: string[] | undefined;
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
type
|
|
802
|
+
subject: Subject<StateCreation<MutableAtomToken<T>> | StateDisposal<MutableAtomToken<T>>>;
|
|
803
|
+
}> & ((key: K) => MutableAtomToken<T>);
|
|
804
|
+
type AtomFamily<T, K extends Canonical = Canonical> = MutableAtomFamily<T extends Transceiver<any, any> ? T : never, K> | RegularAtomFamily<T, K>;
|
|
805
|
+
type WritablePureSelectorFamily<T, K extends Canonical> = Flat<WritablePureSelectorFamilyToken<T, K> & {
|
|
809
806
|
default: (key: K) => T;
|
|
810
|
-
subject: Subject<StateCreation<WritablePureSelectorToken<T>> | StateDisposal<WritablePureSelectorToken<T>>>;
|
|
811
807
|
install: (store: Store) => void;
|
|
812
808
|
internalRoles: string[] | undefined;
|
|
813
|
-
|
|
814
|
-
|
|
809
|
+
subject: Subject<StateCreation<WritablePureSelectorToken<T>> | StateDisposal<WritablePureSelectorToken<T>>>;
|
|
810
|
+
}> & ((key: K) => WritablePureSelectorToken<T>);
|
|
811
|
+
type WritableHeldSelectorFamily<T, K extends Canonical> = Flat<WritableHeldSelectorFamilyToken<T, K> & {
|
|
815
812
|
default: (key: K) => T;
|
|
816
|
-
subject: Subject<StateCreation<WritableHeldSelectorToken<T>> | StateDisposal<WritableHeldSelectorToken<T>>>;
|
|
817
813
|
install: (store: Store) => void;
|
|
818
814
|
internalRoles: string[] | undefined;
|
|
819
|
-
|
|
820
|
-
|
|
815
|
+
subject: Subject<StateCreation<WritableHeldSelectorToken<T>> | StateDisposal<WritableHeldSelectorToken<T>>>;
|
|
816
|
+
}> & ((key: K) => WritableHeldSelectorToken<T>);
|
|
817
|
+
type ReadonlyPureSelectorFamily<T, K extends Canonical> = Flat<ReadonlyPureSelectorFamilyToken<T, K> & {
|
|
821
818
|
default: (key: K) => T;
|
|
822
|
-
subject: Subject<StateCreation<ReadonlyPureSelectorToken<T>> | StateDisposal<ReadonlyPureSelectorToken<T>>>;
|
|
823
819
|
install: (store: Store) => void;
|
|
824
820
|
internalRoles: string[] | undefined;
|
|
825
|
-
|
|
826
|
-
|
|
821
|
+
subject: Subject<StateCreation<ReadonlyPureSelectorToken<T>> | StateDisposal<ReadonlyPureSelectorToken<T>>>;
|
|
822
|
+
}> & ((key: K) => ReadonlyPureSelectorToken<T>);
|
|
823
|
+
type ReadonlyHeldSelectorFamily<T, K extends Canonical> = Flat<ReadonlyHeldSelectorFamilyToken<T, K> & {
|
|
827
824
|
default: (key: K) => T;
|
|
828
|
-
subject: Subject<StateCreation<ReadonlyHeldSelectorToken<T>> | StateDisposal<ReadonlyHeldSelectorToken<T>>>;
|
|
829
825
|
install: (store: Store) => void;
|
|
830
826
|
internalRoles: string[] | undefined;
|
|
831
|
-
|
|
827
|
+
subject: Subject<StateCreation<ReadonlyHeldSelectorToken<T>> | StateDisposal<ReadonlyHeldSelectorToken<T>>>;
|
|
828
|
+
}> & ((key: K) => ReadonlyHeldSelectorToken<T>);
|
|
832
829
|
type PureSelectorFamily<T, K extends Canonical> = ReadonlyPureSelectorFamily<T, K> | WritablePureSelectorFamily<T, K>;
|
|
833
830
|
type HeldSelectorFamily<T, K extends Canonical> = ReadonlyHeldSelectorFamily<T, K> | WritableHeldSelectorFamily<T, K>;
|
|
834
831
|
type ReadonlySelectorFamily<T, K extends Canonical> = ReadonlyHeldSelectorFamily<T, K> | ReadonlyPureSelectorFamily<T, K>;
|
|
@@ -838,5 +835,5 @@ type WritableFamily<T, K extends Canonical> = AtomFamily<T, K> | WritablePureSel
|
|
|
838
835
|
type ReadableFamily<T, K extends Canonical> = AtomFamily<T, K> | SelectorFamily<T, K>;
|
|
839
836
|
type AtomIOInternalResource = ReadableFamily<any, any> | ReadableState<any> | Timeline<any> | Transaction<any>;
|
|
840
837
|
//#endregion
|
|
841
|
-
export { Atom, AtomFamily, AtomIOInternalResource, AtomIOState, AtomKey, BaseExternalStoreConfiguration, ChildStore, CircularBuffer, Count, Each, Empty, EnvironmentData, ExternalStoreConfiguration, ExternalStoreWithContentConfiguration, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Flat, Func, Future, HeldSelector, HeldSelectorFamily, IMPLICIT, Join, JoinStateFamilies, Junction, JunctionAdvancedConfiguration, JunctionEntries, JunctionEntriesBase, JunctionJSON, JunctionSchema, JunctionSchemaBase, LazyMap, Lineage, Modify, Molecule, MutableAtom, MutableAtomFamily, NotFoundError, OperationProgress, PureSelector, PureSelectorFamily, ReadableFamily, ReadableState, ReadonlyHeldSelector, ReadonlyHeldSelectorFamily, ReadonlyPureSelector, ReadonlyPureSelectorFamily, ReadonlySelector, ReadonlySelectorFamily, ReadonlySelectorKey, Refinement, RegularAtom, RegularAtomFamily, ReservedIntrospectionKey, RootStore, Selector, SelectorFamily, SelectorKey,
|
|
838
|
+
export { AsJSON, Atom, AtomFamily, AtomIOInternalResource, AtomIOState, AtomKey, BaseExternalStoreConfiguration, ChildStore, CircularBuffer, ConstructorOf, Count, Each, Empty, EnvironmentData, ExternalStoreConfiguration, ExternalStoreWithContentConfiguration, FAMILY_MEMBER_TOKEN_TYPES, FamilyTracker, Flat, Func, Future, HeldSelector, HeldSelectorFamily, IMPLICIT, Join, JoinStateFamilies, Junction, JunctionAdvancedConfiguration, JunctionEntries, JunctionEntriesBase, JunctionJSON, JunctionSchema, JunctionSchemaBase, LazyMap, Lineage, Modify, Molecule, MutableAtom, MutableAtomFamily, NotFoundError, OperationProgress, PureSelector, PureSelectorFamily, ReadableFamily, ReadableState, ReadonlyHeldSelector, ReadonlyHeldSelectorFamily, ReadonlyPureSelector, ReadonlyPureSelectorFamily, ReadonlySelector, ReadonlySelectorFamily, ReadonlySelectorKey, Refinement, RegularAtom, RegularAtomFamily, ReservedIntrospectionKey, RootStore, Selector, SelectorFamily, SelectorKey, SignalFrom, StateKey, StatefulSubject, Store, StoreEventCarrier, Subject, TRANSACTION_PHASES, Timeline, TimelineAtomUpdate, TimelineMoleculeCreation, TimelineMoleculeDisposal, TimelineSelectorUpdate, TimelineStateCreation, TimelineStateDisposal, TimelineTransactionUpdate, Tracker, Transaction, TransactionEpoch, TransactionPhase, TransactionProgress, Transceiver, TransceiverConstructor, TransceiverMode, WritableFamily, WritableHeldSelector, WritableHeldSelectorFamily, WritablePureSelector, WritablePureSelectorFamily, WritableSelector, WritableSelectorFamily, WritableState, abortTransaction, actUponStore, allocateIntoStore, applyTransaction, arbitrary, assignTransactionToContinuity, become, buildTransaction, cacheValue, capitalize, claimWithinStore, clearStore, closeOperation, counterfeit, createJoin, createMutableAtom, createMutableAtomFamily, createReadonlyHeldSelector, createReadonlyPureSelector, createReadonlyPureSelectorFamily, createRegularAtom, createRegularAtomFamily, createSelectorFamily, createStandaloneSelector, createTimeline, createTransaction, createWritableHeldSelector, createWritablePureSelector, createWritablePureSelectorFamily, deallocateFromStore, deposit, disposeAtom, disposeFromStore, disposeSelector, editRelationsInStore, evictCachedValue, findInStore, findRelationsInStore, fuseWithinStore, getContinuityKey, getEnvironmentData, getEpochNumberOfAction, getEpochNumberOfContinuity, getFromStore, getInternalRelationsFromStore, getJoin, getJsonFamily, getJsonToken, getSelectorDependencyKeys, getTrace, getUpdateFamily, getUpdateToken, ingestAtomUpdate, ingestCreationEvent, ingestDisposalEvent, ingestMoleculeCreationEvent, ingestMoleculeDisposalEvent, ingestMoleculeTransferEvent, ingestSelectorUpdate, ingestTransactionUpdate, initFamilyMemberInStore, installIntoStore, isAtomKey, isChildStore, isDone, isReadonlySelectorKey, isReservedIntrospectionKey, isRootStore, isSelectorKey, isStateKey, isTransceiver, makeRootMoleculeInStore, markDone, newest, openOperation, prettyPrintTokenType, readCachedValue, readOrComputeValue, recallState, registerSelector, resetAtomOrSelector, resetInStore, seekInStore, setAtomOrSelector, setEpochNumberOfAction, setEpochNumberOfContinuity, setIntoStore, subscribeInStore, subscribeToRootDependency, subscribeToState, subscribeToTimeline, subscribeToTransaction, timeTravel, traceRootSelectorAtoms, updateSelectorAtoms, withdraw };
|
|
842
839
|
//# sourceMappingURL=index.d.ts.map
|