atom.io 0.44.10 → 0.44.12
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.js +10 -6
- package/dist/eslint-plugin/index.js.map +1 -1
- package/dist/internal/index.d.ts +125 -118
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/introspection/index.d.ts.map +1 -1
- package/dist/realtime/index.d.ts +42 -3
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime/index.js +8 -1
- package/dist/realtime/index.js.map +1 -1
- package/dist/realtime-react/index.d.ts +1 -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 +13 -9
- package/dist/realtime-server/index.d.ts.map +1 -1
- package/dist/realtime-server/index.js +82 -68
- package/dist/realtime-server/index.js.map +1 -1
- package/dist/struct/index.d.ts +1 -1
- package/dist/struct/index.d.ts.map +1 -1
- package/dist/struct/index.js.map +1 -1
- package/package.json +4 -4
- package/src/eslint-plugin/rules/exact-catch-types.ts +14 -11
- package/src/realtime/shared-room-store.ts +14 -4
- package/src/realtime/socket-interface.ts +38 -0
- package/src/realtime-react/realtime-context.tsx +1 -1
- package/src/realtime-server/realtime-server-stores/server-room-external-store.ts +104 -84
- package/src/struct/micro.ts +1 -2
- package/dist/shared-room-store-ZPGD_PIR.d.ts +0 -28
- package/dist/shared-room-store-ZPGD_PIR.d.ts.map +0 -1
- package/dist/utility-types-BRPuC_bI.d.ts +0 -10
- package/dist/utility-types-BRPuC_bI.d.ts.map +0 -1
|
@@ -9,7 +9,7 @@ const STATE_FUNCTIONS_WITH_CATCH = [
|
|
|
9
9
|
`selector`,
|
|
10
10
|
`selectorFamily`
|
|
11
11
|
];
|
|
12
|
-
const
|
|
12
|
+
const FAMILY_FUNCTIONS = [`atomFamily`, `selectorFamily`];
|
|
13
13
|
const exactCatchTypes = createRule$1({
|
|
14
14
|
name: `catch-constructor-type`,
|
|
15
15
|
meta: {
|
|
@@ -18,7 +18,7 @@ const exactCatchTypes = createRule$1({
|
|
|
18
18
|
messages: {
|
|
19
19
|
missingCatchProperty: "This {{functionName}} was provided the error type `{{errorTypeName}}` but the required 'catch' property is missing from its options. Either remove `{{errorTypeName}}`, or add `catch: [{{errorTypeName}}]` to the options object.",
|
|
20
20
|
invalidCatchProperty: "This {{functionName}} was provided a catch array containing the class `{{constructorName}}`. However, that class is not represented in the {{functionName}}'s error type, `{{errorTypeName}}`. As a result, it might catch errors that the {{functionName}} is not designed to handle. Either include `{{constructorName}}` in the {{functionName}}'s error type, or remove it from the 'catch' array.",
|
|
21
|
-
extraneousErrorTypes: "This {{functionName}} was provided an error type including the class {{errorTypeName}}
|
|
21
|
+
extraneousErrorTypes: "This {{functionName}} was provided an error type including the class `{{errorTypeName}}`, but its 'catch' property doesn't include a constructor for that class. Either include a constructor for `{{errorTypeName}}` in the 'catch' array, or remove `{{errorTypeName}}` as a possible error type."
|
|
22
22
|
},
|
|
23
23
|
schema: []
|
|
24
24
|
},
|
|
@@ -28,6 +28,7 @@ const exactCatchTypes = createRule$1({
|
|
|
28
28
|
const checker = parserServices.program.getTypeChecker();
|
|
29
29
|
return { CallExpression(node) {
|
|
30
30
|
const { callee, typeArguments: directTypeArguments, arguments: callArguments } = node;
|
|
31
|
+
let errorParamIndex = 1;
|
|
31
32
|
let functionName = null;
|
|
32
33
|
if (callee.type === AST_NODE_TYPES.Identifier) {
|
|
33
34
|
if (STATE_FUNCTIONS_WITH_CATCH.includes(callee.name)) functionName = callee.name;
|
|
@@ -43,21 +44,24 @@ const exactCatchTypes = createRule$1({
|
|
|
43
44
|
const declaratorId = parent.id;
|
|
44
45
|
if (declaratorId.type === AST_NODE_TYPES.Identifier) {
|
|
45
46
|
const typeAnnotation = declaratorId.typeAnnotation?.typeAnnotation;
|
|
46
|
-
if (typeAnnotation && `typeArguments` in typeAnnotation && typeAnnotation.typeArguments)
|
|
47
|
+
if (typeAnnotation && `typeArguments` in typeAnnotation && typeAnnotation.typeArguments) {
|
|
48
|
+
typeArguments = typeAnnotation.typeArguments;
|
|
49
|
+
errorParamIndex = 2;
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
const optionsObject = callArguments[0];
|
|
51
55
|
if (optionsObject?.type !== AST_NODE_TYPES.ObjectExpression) return;
|
|
52
|
-
|
|
53
|
-
const errorTypeNode = typeArguments ?
|
|
56
|
+
if (FAMILY_FUNCTIONS.includes(functionName)) errorParamIndex = 2;
|
|
57
|
+
const errorTypeNode = typeArguments ? typeArguments.params[errorParamIndex] : void 0;
|
|
58
|
+
if (!errorTypeNode) return;
|
|
54
59
|
let catchProperty;
|
|
55
60
|
optionsObject.properties.forEach((property) => {
|
|
56
61
|
if (property.type === AST_NODE_TYPES.Property) {
|
|
57
62
|
if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === `catch` || property.key.type === AST_NODE_TYPES.Literal && property.key.value === `catch`) catchProperty = property;
|
|
58
63
|
}
|
|
59
64
|
});
|
|
60
|
-
if (!errorTypeNode) return;
|
|
61
65
|
const typeNode = parserServices.esTreeNodeToTSNodeMap.get(errorTypeNode);
|
|
62
66
|
const errorTypeTs = checker.getTypeFromTypeNode(typeNode);
|
|
63
67
|
const errorTypeName = checker.typeToString(errorTypeTs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createRule","exactCatchTypes: ESLintUtils.RuleModule<\n\t`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","functionName: string | null","typeArguments: TSESTree.TSTypeParameterInstantiation | undefined","catchProperty: TSESTree.Property | undefined","acceptableErrorSymbols: TsSymbol[]","instanceType: Type | undefined","explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin","Rules.exactCatchTypes","Rules.explicitStateTypes"],"sources":["../../src/eslint-plugin/rules/exact-catch-types.ts","../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":["import type { TSESTree } from \"@typescript-eslint/utils\"\nimport { AST_NODE_TYPES, ESLintUtils } from \"@typescript-eslint/utils\"\nimport type {\n\tInterfaceType,\n\tSymbol as TsSymbol,\n\tType,\n\tTypeNode,\n} from \"typescript\"\n\nconst createRule = ESLintUtils.RuleCreator(\n\t(name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`,\n)\n\nconst STATE_FUNCTIONS_WITH_CATCH = [\n\t`atom`,\n\t`atomFamily`,\n\t`selector`,\n\t`selectorFamily`,\n]\nconst STANDALONE_FUNCTIONS = [`atom`, `selector`]\n\nexport const exactCatchTypes: ESLintUtils.RuleModule<\n\t`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n> = createRule({\n\tname: `catch-constructor-type`,\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `Ensures that when an error type (E) is provided to an atom, the 'catch' property is set and all constructors in it are assignable to E.`,\n\t\t},\n\t\tmessages: {\n\t\t\tmissingCatchProperty:\n\t\t\t\t`This {{functionName}} was provided the error type \\`{{errorTypeName}}\\` ` +\n\t\t\t\t`but the required 'catch' property is missing from its options. ` +\n\t\t\t\t`Either remove \\`{{errorTypeName}}\\`, or add \\`catch: [{{errorTypeName}}]\\` to the options object.`,\n\t\t\tinvalidCatchProperty:\n\t\t\t\t`This {{functionName}} was provided a catch array containing the class \\`{{constructorName}}\\`. ` +\n\t\t\t\t`However, that class is not represented in the {{functionName}}'s error type, \\`{{errorTypeName}}\\`. ` +\n\t\t\t\t`As a result, it might catch errors that the {{functionName}} is not designed to handle. ` +\n\t\t\t\t`Either include \\`{{constructorName}}\\` in the {{functionName}}'s error type, or remove it from the 'catch' array.`,\n\t\t\textraneousErrorTypes:\n\t\t\t\t`This {{functionName}} was provided an error type including the class {{errorTypeName}}, ` +\n\t\t\t\t`but its 'catch' property doesn't include a constructor for that class. ` +\n\t\t\t\t`Either include a constructor for {{errorTypeName}} in the 'catch' array, or remove {{errorTypeName}} from the error type.`,\n\t\t},\n\t\tschema: [],\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\tconst parserServices = ESLintUtils.getParserServices(context)\n\t\tconst checker = parserServices.program.getTypeChecker()\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst {\n\t\t\t\t\tcallee,\n\t\t\t\t\ttypeArguments: directTypeArguments,\n\t\t\t\t\targuments: callArguments,\n\t\t\t\t} = node\n\n\t\t\t\t// Check if the function call is one of the targeted state functions\n\t\t\t\tlet functionName: string | null = null\n\t\t\t\tif (callee.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\tif (STATE_FUNCTIONS_WITH_CATCH.includes(callee.name)) {\n\t\t\t\t\t\tfunctionName = callee.name\n\t\t\t\t\t}\n\t\t\t\t} else if (callee.type === AST_NODE_TYPES.MemberExpression) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcallee.property.type === AST_NODE_TYPES.Identifier &&\n\t\t\t\t\t\tSTATE_FUNCTIONS_WITH_CATCH.includes(callee.property.name)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfunctionName = callee.property.name\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!functionName) return\n\n\t\t\t\t// Where do the type arguments come from?\n\t\t\t\tlet typeArguments: TSESTree.TSTypeParameterInstantiation | undefined\n\t\t\t\tif (directTypeArguments) {\n\t\t\t\t\ttypeArguments = directTypeArguments\n\t\t\t\t} else {\n\t\t\t\t\tconst parent = node.parent\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent?.type === AST_NODE_TYPES.VariableDeclarator &&\n\t\t\t\t\t\tparent.init === node\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Check if the VariableDeclarator has an id with a TypeAnnotation\n\t\t\t\t\t\tconst declaratorId = parent.id\n\t\t\t\t\t\tif (declaratorId.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t\t// Check for 'const myAtom: AtomToken<string> = ...'\n\t\t\t\t\t\t\tconst typeAnnotation = declaratorId.typeAnnotation?.typeAnnotation\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\ttypeAnnotation &&\n\t\t\t\t\t\t\t\t`typeArguments` in typeAnnotation &&\n\t\t\t\t\t\t\t\ttypeAnnotation.typeArguments\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\ttypeArguments = typeAnnotation.typeArguments\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\n\t\t\t\tconst optionsObject = callArguments[0]\n\n\t\t\t\tif (optionsObject?.type !== AST_NODE_TYPES.ObjectExpression) return\n\n\t\t\t\tconst isStandalone = STANDALONE_FUNCTIONS.includes(functionName)\n\n\t\t\t\tconst errorTypeNode = typeArguments\n\t\t\t\t\t? isStandalone\n\t\t\t\t\t\t? typeArguments.params[1]\n\t\t\t\t\t\t: typeArguments.params[2]\n\t\t\t\t\t: undefined\n\n\t\t\t\tlet catchProperty: TSESTree.Property | undefined\n\t\t\t\toptionsObject.properties.forEach((property) => {\n\t\t\t\t\tif (property.type === AST_NODE_TYPES.Property) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(property.key.type === AST_NODE_TYPES.Identifier &&\n\t\t\t\t\t\t\t\tproperty.key.name === `catch`) ||\n\t\t\t\t\t\t\t(property.key.type === AST_NODE_TYPES.Literal &&\n\t\t\t\t\t\t\t\tproperty.key.value === `catch`)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcatchProperty = property\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\tif (!errorTypeNode) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst typeNode = parserServices.esTreeNodeToTSNodeMap.get(\n\t\t\t\t\terrorTypeNode,\n\t\t\t\t) as TypeNode\n\t\t\t\t// Get the TypeScript Type object for E\n\t\t\t\tconst errorTypeTs = checker.getTypeFromTypeNode(typeNode)\n\t\t\t\tconst errorTypeName = checker.typeToString(errorTypeTs)\n\n\t\t\t\tif (!catchProperty) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: optionsObject,\n\t\t\t\t\t\tmessageId: `missingCatchProperty`,\n\t\t\t\t\t\tdata: { functionName, errorTypeName },\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// --- New Validation: Check Constructor Types ---\n\t\t\t\tconst catchArray = catchProperty.value\n\t\t\t\tif (catchArray.type !== AST_NODE_TYPES.ArrayExpression) {\n\t\t\t\t\t// We only check array literals (e.g., [Ctor1, Ctor2])\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// 3. Collect all acceptable nominal symbols from E\n\t\t\t\tconst acceptableErrorSymbols: TsSymbol[] = []\n\n\t\t\t\t// Check if E is a Union Type\n\t\t\t\tif (errorTypeTs.isUnion()) {\n\t\t\t\t\t// Add the symbol of every member of the union (e.g., Symbol(SpecialError), Symbol(FancyError))\n\t\t\t\t\tfor (const memberType of errorTypeTs.types) {\n\t\t\t\t\t\tconst symbol = memberType.getSymbol()\n\t\t\t\t\t\tif (symbol) {\n\t\t\t\t\t\t\tacceptableErrorSymbols.push(symbol)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// E is a single type, add its symbol\n\t\t\t\t\tconst symbol = errorTypeTs.getSymbol()\n\t\t\t\t\tif (symbol) {\n\t\t\t\t\t\tacceptableErrorSymbols.push(symbol)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (catchArray.elements.length === 0) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: catchProperty,\n\t\t\t\t\t\tmessageId: `missingCatchProperty`,\n\t\t\t\t\t\tdata: { functionName, errorTypeName },\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst errorSymbolsToRepresent = new Set(acceptableErrorSymbols)\n\n\t\t\t\t// Iterate over each constructor reference in the 'catch' array\n\t\t\t\tfor (const element of catchArray.elements) {\n\t\t\t\t\tif (!element || element.type !== AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t// Only check simple identifier references (e.g., [ClientError])\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// Get the type of the constructor identifier (e.g., the Type of 'Error')\n\t\t\t\t\tconst constructorTsNode =\n\t\t\t\t\t\tparserServices.esTreeNodeToTSNodeMap.get(element)\n\t\t\t\t\tconst constructorType = checker.getTypeAtLocation(constructorTsNode)\n\t\t\t\t\tconst constructorName = element.name\n\n\t\t\t\t\t// console.log(`constructorName`, constructorName)\n\n\t\t\t\t\t// Extract the instance type from the constructor type.\n\t\t\t\t\t// e.g., turn 'typeof ClientError' into 'ClientError'\n\t\t\t\t\tlet instanceType: Type | undefined\n\t\t\t\t\tif (\n\t\t\t\t\t\t(constructorType as InterfaceType).getConstructSignatures().length >\n\t\t\t\t\t\t0\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Get the return type of the constructor signature\n\t\t\t\t\t\tconst signature = (\n\t\t\t\t\t\t\tconstructorType as InterfaceType\n\t\t\t\t\t\t).getConstructSignatures()[0]\n\t\t\t\t\t\tinstanceType = signature.getReturnType()\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we couldn't get the instance type, skip the check\n\n\t\t\t\t\tconst constructorInstanceSymbol = instanceType?.getSymbol()\n\t\t\t\t\tif (!constructorInstanceSymbol) continue\n\n\t\t\t\t\t// Check for symbol identity\n\t\t\t\t\tif (acceptableErrorSymbols.includes(constructorInstanceSymbol)) {\n\t\t\t\t\t\terrorSymbolsToRepresent.delete(constructorInstanceSymbol)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode: element,\n\t\t\t\t\t\t\tmessageId: `invalidCatchProperty`,\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tfunctionName,\n\t\t\t\t\t\t\t\tconstructorName: constructorName,\n\t\t\t\t\t\t\t\terrorTypeName: errorTypeName,\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\n\t\t\t\tfor (const errorSymbol of errorSymbolsToRepresent) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: catchProperty,\n\t\t\t\t\t\tmessageId: `extraneousErrorTypes`,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\terrorTypeName: checker.symbolToString(errorSymbol),\n\t\t\t\t\t\t\tfunctionName,\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 { AST_NODE_TYPES, 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\ntype Options = [\n\t{\n\t\tpermitAnnotation?: boolean\n\t},\n]\n\nexport const explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\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\tnoTypeArgumentOrAnnotation: `State declarations must have generic type arguments directly passed to them, or a top-level type annotation.`,\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: `object`,\n\t\t\t\tproperties: {\n\t\t\t\t\tpermitAnnotation: {\n\t\t\t\t\t\ttype: `boolean`,\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tdefaultOptions: [\n\t\t{\n\t\t\tpermitAnnotation: false,\n\t\t},\n\t],\n\tcreate(context) {\n\t\tconst options = context.options[0]\n\t\tconst permitAnnotation = options?.permitAnnotation ?? false\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst callee = node.callee\n\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) === false) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase `MemberExpression`:\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(callee.property.type === `Identifier` &&\n\t\t\t\t\t\t\t\tSTATE_FUNCTIONS.includes(callee.property.name)) === false\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check for the *required* generic type argument first\n\t\t\t\tif (node.typeArguments) {\n\t\t\t\t\treturn // Generic type argument is present, no error\n\t\t\t\t}\n\n\t\t\t\t// If generic arguments are missing, check if the top-level annotation exception is enabled AND present\n\t\t\t\tif (permitAnnotation) {\n\t\t\t\t\tlet hasAnnotation = false\n\t\t\t\t\t// Check if the CallExpression is the initializer of a variable declarator\n\t\t\t\t\tconst parent = node.parent\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent?.type === AST_NODE_TYPES.VariableDeclarator &&\n\t\t\t\t\t\tparent.init === node\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Check if the VariableDeclarator has an id with a TypeAnnotation\n\t\t\t\t\t\tconst declaratorId = parent.id\n\t\t\t\t\t\tif (declaratorId.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t\t// Check for 'const myAtom: AtomToken<string> = ...'\n\t\t\t\t\t\t\thasAnnotation = Boolean(declaratorId.typeAnnotation)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (hasAnnotation) {\n\t\t\t\t\t\treturn // Exception met: type annotation is on the variable declaration\n\t\t\t\t\t}\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: `noTypeArgumentOrAnnotation`,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t})\n\t\t\t},\n\t\t}\n\t},\n})\n","export * from \"./exact-catch-types\"\nexport * 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\"exact-catch-types\": Rules.exactCatchTypes as any,\n\t\t\"explicit-state-types\": Rules.explicitStateTypes as any,\n\t},\n} satisfies ESLint.Plugin\n\nexport default plugin\n"],"mappings":";;;;AASA,MAAMA,eAAa,YAAY,aAC7B,SAAS,0CAA0C,OACpD;AAED,MAAM,6BAA6B;CAClC;CACA;CACA;CACA;CACA;AACD,MAAM,uBAAuB,CAAC,QAAQ,WAAW;AAEjD,MAAaC,kBAKTD,aAAW;CACd,MAAM;CACN,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,2IACb;EACD,UAAU;GACT,sBACC;GAGD,sBACC;GAID,sBACC;GAGD;EACD,QAAQ,EAAE;EACV;CACD,gBAAgB,EAAE;CAClB,OAAO,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createRule","exactCatchTypes: ESLintUtils.RuleModule<\n\t`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","functionName: string | null","typeArguments: TSESTree.TSTypeParameterInstantiation | undefined","catchProperty: TSESTree.Property | undefined","acceptableErrorSymbols: TsSymbol[]","instanceType: Type | undefined","explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin","Rules.exactCatchTypes","Rules.explicitStateTypes"],"sources":["../../src/eslint-plugin/rules/exact-catch-types.ts","../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":["import type { TSESTree } from \"@typescript-eslint/utils\"\nimport { AST_NODE_TYPES, ESLintUtils } from \"@typescript-eslint/utils\"\nimport type {\n\tInterfaceType,\n\tSymbol as TsSymbol,\n\tType,\n\tTypeNode,\n} from \"typescript\"\n\nconst createRule = ESLintUtils.RuleCreator(\n\t(name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`,\n)\n\nconst STATE_FUNCTIONS_WITH_CATCH = [\n\t`atom`,\n\t`atomFamily`,\n\t`selector`,\n\t`selectorFamily`,\n]\nconst FAMILY_FUNCTIONS = [`atomFamily`, `selectorFamily`]\n\nexport const exactCatchTypes: ESLintUtils.RuleModule<\n\t`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n> = createRule({\n\tname: `catch-constructor-type`,\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `Ensures that when an error type (E) is provided to an atom, the 'catch' property is set and all constructors in it are assignable to E.`,\n\t\t},\n\t\tmessages: {\n\t\t\tmissingCatchProperty:\n\t\t\t\t`This {{functionName}} was provided the error type \\`{{errorTypeName}}\\` ` +\n\t\t\t\t`but the required 'catch' property is missing from its options. ` +\n\t\t\t\t`Either remove \\`{{errorTypeName}}\\`, or add \\`catch: [{{errorTypeName}}]\\` to the options object.`,\n\t\t\tinvalidCatchProperty:\n\t\t\t\t`This {{functionName}} was provided a catch array containing the class \\`{{constructorName}}\\`. ` +\n\t\t\t\t`However, that class is not represented in the {{functionName}}'s error type, \\`{{errorTypeName}}\\`. ` +\n\t\t\t\t`As a result, it might catch errors that the {{functionName}} is not designed to handle. ` +\n\t\t\t\t`Either include \\`{{constructorName}}\\` in the {{functionName}}'s error type, or remove it from the 'catch' array.`,\n\t\t\textraneousErrorTypes:\n\t\t\t\t`This {{functionName}} was provided an error type including the class \\`{{errorTypeName}}\\`, ` +\n\t\t\t\t`but its 'catch' property doesn't include a constructor for that class. ` +\n\t\t\t\t`Either include a constructor for \\`{{errorTypeName}}\\` in the 'catch' array, or remove \\`{{errorTypeName}}\\` as a possible error type.`,\n\t\t},\n\t\tschema: [],\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\tconst parserServices = ESLintUtils.getParserServices(context)\n\t\tconst checker = parserServices.program.getTypeChecker()\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst {\n\t\t\t\t\tcallee,\n\t\t\t\t\ttypeArguments: directTypeArguments,\n\t\t\t\t\targuments: callArguments,\n\t\t\t\t} = node\n\n\t\t\t\tlet errorParamIndex = 1\n\n\t\t\t\t// Check if the function call is one of the targeted state functions\n\t\t\t\tlet functionName: string | null = null\n\t\t\t\tif (callee.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\tif (STATE_FUNCTIONS_WITH_CATCH.includes(callee.name)) {\n\t\t\t\t\t\tfunctionName = callee.name\n\t\t\t\t\t}\n\t\t\t\t} else if (callee.type === AST_NODE_TYPES.MemberExpression) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcallee.property.type === AST_NODE_TYPES.Identifier &&\n\t\t\t\t\t\tSTATE_FUNCTIONS_WITH_CATCH.includes(callee.property.name)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfunctionName = callee.property.name\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!functionName) return\n\n\t\t\t\t// Where do the type arguments come from?\n\t\t\t\tlet typeArguments: TSESTree.TSTypeParameterInstantiation | undefined\n\t\t\t\tif (directTypeArguments) {\n\t\t\t\t\ttypeArguments = directTypeArguments\n\t\t\t\t} else {\n\t\t\t\t\tconst parent = node.parent\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent?.type === AST_NODE_TYPES.VariableDeclarator &&\n\t\t\t\t\t\tparent.init === node\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Check if the VariableDeclarator has an id with a TypeAnnotation\n\t\t\t\t\t\tconst declaratorId = parent.id\n\t\t\t\t\t\tif (declaratorId.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t\t// Check for 'const myAtom: AtomToken<string> = ...'\n\t\t\t\t\t\t\tconst typeAnnotation = declaratorId.typeAnnotation?.typeAnnotation\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\ttypeAnnotation &&\n\t\t\t\t\t\t\t\t`typeArguments` in typeAnnotation &&\n\t\t\t\t\t\t\t\ttypeAnnotation.typeArguments\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\ttypeArguments = typeAnnotation.typeArguments\n\t\t\t\t\t\t\t\terrorParamIndex = 2 // AtomToken<T, K, E>\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\n\t\t\t\tconst optionsObject = callArguments[0]\n\n\t\t\t\tif (optionsObject?.type !== AST_NODE_TYPES.ObjectExpression) return\n\n\t\t\t\tconst isFamilyDeclaration = FAMILY_FUNCTIONS.includes(functionName)\n\t\t\t\tif (isFamilyDeclaration) {\n\t\t\t\t\terrorParamIndex = 2 // atomFamily<T, K, E>\n\t\t\t\t}\n\n\t\t\t\tconst errorTypeNode = typeArguments\n\t\t\t\t\t? typeArguments.params[errorParamIndex]\n\t\t\t\t\t: undefined\n\t\t\t\tif (!errorTypeNode) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tlet catchProperty: TSESTree.Property | undefined\n\t\t\t\toptionsObject.properties.forEach((property) => {\n\t\t\t\t\tif (property.type === AST_NODE_TYPES.Property) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(property.key.type === AST_NODE_TYPES.Identifier &&\n\t\t\t\t\t\t\t\tproperty.key.name === `catch`) ||\n\t\t\t\t\t\t\t(property.key.type === AST_NODE_TYPES.Literal &&\n\t\t\t\t\t\t\t\tproperty.key.value === `catch`)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcatchProperty = property\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\tconst typeNode = parserServices.esTreeNodeToTSNodeMap.get(\n\t\t\t\t\terrorTypeNode,\n\t\t\t\t) as TypeNode\n\t\t\t\t// Get the TypeScript Type object for E\n\t\t\t\tconst errorTypeTs = checker.getTypeFromTypeNode(typeNode)\n\t\t\t\tconst errorTypeName = checker.typeToString(errorTypeTs)\n\n\t\t\t\tif (!catchProperty) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: optionsObject,\n\t\t\t\t\t\tmessageId: `missingCatchProperty`,\n\t\t\t\t\t\tdata: { functionName, errorTypeName },\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// --- New Validation: Check Constructor Types ---\n\t\t\t\tconst catchArray = catchProperty.value\n\t\t\t\tif (catchArray.type !== AST_NODE_TYPES.ArrayExpression) {\n\t\t\t\t\t// We only check array literals (e.g., [Ctor1, Ctor2])\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// 3. Collect all acceptable nominal symbols from E\n\t\t\t\tconst acceptableErrorSymbols: TsSymbol[] = []\n\n\t\t\t\t// Check if E is a Union Type\n\t\t\t\tif (errorTypeTs.isUnion()) {\n\t\t\t\t\t// Add the symbol of every member of the union (e.g., Symbol(SpecialError), Symbol(FancyError))\n\t\t\t\t\tfor (const memberType of errorTypeTs.types) {\n\t\t\t\t\t\tconst symbol = memberType.getSymbol()\n\t\t\t\t\t\tif (symbol) {\n\t\t\t\t\t\t\tacceptableErrorSymbols.push(symbol)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// E is a single type, add its symbol\n\t\t\t\t\tconst symbol = errorTypeTs.getSymbol()\n\t\t\t\t\tif (symbol) {\n\t\t\t\t\t\tacceptableErrorSymbols.push(symbol)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (catchArray.elements.length === 0) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: catchProperty,\n\t\t\t\t\t\tmessageId: `missingCatchProperty`,\n\t\t\t\t\t\tdata: { functionName, errorTypeName },\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst errorSymbolsToRepresent = new Set(acceptableErrorSymbols)\n\n\t\t\t\t// Iterate over each constructor reference in the 'catch' array\n\t\t\t\tfor (const element of catchArray.elements) {\n\t\t\t\t\tif (!element || element.type !== AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t// Only check simple identifier references (e.g., [ClientError])\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// Get the type of the constructor identifier (e.g., the Type of 'Error')\n\t\t\t\t\tconst constructorTsNode =\n\t\t\t\t\t\tparserServices.esTreeNodeToTSNodeMap.get(element)\n\t\t\t\t\tconst constructorType = checker.getTypeAtLocation(constructorTsNode)\n\t\t\t\t\tconst constructorName = element.name\n\n\t\t\t\t\t// console.log(`constructorName`, constructorName)\n\n\t\t\t\t\t// Extract the instance type from the constructor type.\n\t\t\t\t\t// e.g., turn 'typeof ClientError' into 'ClientError'\n\t\t\t\t\tlet instanceType: Type | undefined\n\t\t\t\t\tif (\n\t\t\t\t\t\t(constructorType as InterfaceType).getConstructSignatures().length >\n\t\t\t\t\t\t0\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Get the return type of the constructor signature\n\t\t\t\t\t\tconst signature = (\n\t\t\t\t\t\t\tconstructorType as InterfaceType\n\t\t\t\t\t\t).getConstructSignatures()[0]\n\t\t\t\t\t\tinstanceType = signature.getReturnType()\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we couldn't get the instance type, skip the check\n\n\t\t\t\t\tconst constructorInstanceSymbol = instanceType?.getSymbol()\n\t\t\t\t\tif (!constructorInstanceSymbol) continue\n\n\t\t\t\t\t// Check for symbol identity\n\t\t\t\t\tif (acceptableErrorSymbols.includes(constructorInstanceSymbol)) {\n\t\t\t\t\t\terrorSymbolsToRepresent.delete(constructorInstanceSymbol)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode: element,\n\t\t\t\t\t\t\tmessageId: `invalidCatchProperty`,\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tfunctionName,\n\t\t\t\t\t\t\t\tconstructorName: constructorName,\n\t\t\t\t\t\t\t\terrorTypeName: errorTypeName,\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\n\t\t\t\tfor (const errorSymbol of errorSymbolsToRepresent) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: catchProperty,\n\t\t\t\t\t\tmessageId: `extraneousErrorTypes`,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\terrorTypeName: checker.symbolToString(errorSymbol),\n\t\t\t\t\t\t\tfunctionName,\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 { AST_NODE_TYPES, 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\ntype Options = [\n\t{\n\t\tpermitAnnotation?: boolean\n\t},\n]\n\nexport const explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\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\tnoTypeArgumentOrAnnotation: `State declarations must have generic type arguments directly passed to them, or a top-level type annotation.`,\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: `object`,\n\t\t\t\tproperties: {\n\t\t\t\t\tpermitAnnotation: {\n\t\t\t\t\t\ttype: `boolean`,\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tdefaultOptions: [\n\t\t{\n\t\t\tpermitAnnotation: false,\n\t\t},\n\t],\n\tcreate(context) {\n\t\tconst options = context.options[0]\n\t\tconst permitAnnotation = options?.permitAnnotation ?? false\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst callee = node.callee\n\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) === false) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase `MemberExpression`:\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(callee.property.type === `Identifier` &&\n\t\t\t\t\t\t\t\tSTATE_FUNCTIONS.includes(callee.property.name)) === false\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check for the *required* generic type argument first\n\t\t\t\tif (node.typeArguments) {\n\t\t\t\t\treturn // Generic type argument is present, no error\n\t\t\t\t}\n\n\t\t\t\t// If generic arguments are missing, check if the top-level annotation exception is enabled AND present\n\t\t\t\tif (permitAnnotation) {\n\t\t\t\t\tlet hasAnnotation = false\n\t\t\t\t\t// Check if the CallExpression is the initializer of a variable declarator\n\t\t\t\t\tconst parent = node.parent\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent?.type === AST_NODE_TYPES.VariableDeclarator &&\n\t\t\t\t\t\tparent.init === node\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Check if the VariableDeclarator has an id with a TypeAnnotation\n\t\t\t\t\t\tconst declaratorId = parent.id\n\t\t\t\t\t\tif (declaratorId.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t\t// Check for 'const myAtom: AtomToken<string> = ...'\n\t\t\t\t\t\t\thasAnnotation = Boolean(declaratorId.typeAnnotation)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (hasAnnotation) {\n\t\t\t\t\t\treturn // Exception met: type annotation is on the variable declaration\n\t\t\t\t\t}\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: `noTypeArgumentOrAnnotation`,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t})\n\t\t\t},\n\t\t}\n\t},\n})\n","export * from \"./exact-catch-types\"\nexport * 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\"exact-catch-types\": Rules.exactCatchTypes as any,\n\t\t\"explicit-state-types\": Rules.explicitStateTypes as any,\n\t},\n} satisfies ESLint.Plugin\n\nexport default plugin\n"],"mappings":";;;;AASA,MAAMA,eAAa,YAAY,aAC7B,SAAS,0CAA0C,OACpD;AAED,MAAM,6BAA6B;CAClC;CACA;CACA;CACA;CACA;AACD,MAAM,mBAAmB,CAAC,cAAc,iBAAiB;AAEzD,MAAaC,kBAKTD,aAAW;CACd,MAAM;CACN,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,2IACb;EACD,UAAU;GACT,sBACC;GAGD,sBACC;GAID,sBACC;GAGD;EACD,QAAQ,EAAE;EACV;CACD,gBAAgB,EAAE;CAClB,OAAO,SAAS;EACf,MAAM,iBAAiB,YAAY,kBAAkB,QAAQ;EAC7D,MAAM,UAAU,eAAe,QAAQ,gBAAgB;AAEvD,SAAO,EACN,eAAe,MAAM;GACpB,MAAM,EACL,QACA,eAAe,qBACf,WAAW,kBACR;GAEJ,IAAI,kBAAkB;GAGtB,IAAIE,eAA8B;AAClC,OAAI,OAAO,SAAS,eAAe,YAClC;QAAI,2BAA2B,SAAS,OAAO,KAAK,CACnD,gBAAe,OAAO;cAEb,OAAO,SAAS,eAAe,kBACzC;QACC,OAAO,SAAS,SAAS,eAAe,cACxC,2BAA2B,SAAS,OAAO,SAAS,KAAK,CAEzD,gBAAe,OAAO,SAAS;;AAIjC,OAAI,CAAC,aAAc;GAGnB,IAAIC;AACJ,OAAI,oBACH,iBAAgB;QACV;IACN,MAAM,SAAS,KAAK;AACpB,QACC,QAAQ,SAAS,eAAe,sBAChC,OAAO,SAAS,MACf;KAED,MAAM,eAAe,OAAO;AAC5B,SAAI,aAAa,SAAS,eAAe,YAAY;MAEpD,MAAM,iBAAiB,aAAa,gBAAgB;AACpD,UACC,kBACA,mBAAmB,kBACnB,eAAe,eACd;AACD,uBAAgB,eAAe;AAC/B,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MAAM,MAErD;AAED;IACD,QACC;;AAIF,OAAI,KAAK,cACR;AAID,OAAI,kBAAkB;IACrB,IAAI,gBAAgB;IAEpB,MAAM,SAAS,KAAK;AACpB,QACC,QAAQ,SAAS,eAAe,sBAChC,OAAO,SAAS,MACf;KAED,MAAM,eAAe,OAAO;AAC5B,SAAI,aAAa,SAAS,eAAe,WAExC,iBAAgB,QAAQ,aAAa,eAAe;;AAGtD,QAAI,cACH;AAED,YAAQ,OAAO;KACd;KACA,WAAW;KACX,CAAC;AACF;;AAGD,WAAQ,OAAO;IACd;IACA,WAAW;IACX,CAAC;KAEH;;CAEF,CAAC;;;;;;;;;;;AElHF,MAAMC,SAAwB,EAC7B,OAAO;CACN,qBAAqBC;CACrB,wBAAwBC;CACxB,EACD;AAED,4BAAe"}
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as Fn, i as Flat, n as Ctor, o as Refinement, r as Each, t as Count } from "../utility-types-BRPuC_bI.js";
|
|
2
1
|
import { Above, ActorToolkit, AtomFamilyToken, AtomIOLogger, AtomIOToken, AtomToken, AtomUpdateEvent, CompoundFrom, CompoundTypedKey, FamilyMetadata, HeldSelectorFamilyToken, HeldSelectorToken, Hierarchy, JoinOptions, JoinStates, JoinToken, Logger, MoleculeCreationEvent, MoleculeDisposalEvent, MoleculeTransferEvent, MutableAtomFamilyOptions, MutableAtomFamilyToken, MutableAtomOptions, MutableAtomToken, PureSelectorFamilyToken, PureSelectorToken, ReadableFamilyToken, ReadableToken, ReadonlyHeldSelectorFamilyOptions, ReadonlyHeldSelectorFamilyToken, ReadonlyHeldSelectorOptions, ReadonlyHeldSelectorToken, ReadonlyPureSelectorFamilyOptions, ReadonlyPureSelectorFamilyToken, ReadonlyPureSelectorOptions, ReadonlyPureSelectorToken, ReadonlySelectorFamilyToken, ReadonlySelectorToken, RegularAtomFamilyOptions, RegularAtomFamilyToken, RegularAtomOptions, RegularAtomToken, SelectorFamilyToken, SelectorToken, Setter, SingularTypedKey, StateCreationEvent, StateDisposalEvent, StateLifecycleEvent, StateUpdate, TimelineEvent, TimelineManageable, TimelineOptions, TimelineSelectorUpdateEvent, TimelineToken, TransactionOptions, TransactionOutcomeEvent, TransactionToken, TransactionUpdateHandler, UpdateHandler, ValidKey, Vassal, ViewOf, WritableFamilyToken, WritableHeldSelectorFamilyOptions, WritableHeldSelectorFamilyToken, WritableHeldSelectorOptions, WritableHeldSelectorToken, WritablePureSelectorFamilyOptions, WritablePureSelectorFamilyToken, WritablePureSelectorOptions, WritablePureSelectorToken, WritableSelectorFamilyToken, WritableSelectorToken, WritableToken, WriterToolkit } from "atom.io";
|
|
3
2
|
import { Canonical, Json, stringified } from "atom.io/json";
|
|
4
3
|
import { UList } from "atom.io/transceivers/u-list";
|
|
@@ -41,34 +40,42 @@ type ConstructorOf<T extends Transceiver<any, any, any>> = TransceiverConstructo
|
|
|
41
40
|
declare function createMutableAtom<T extends Transceiver<any, any, any>>(store: Store, options: MutableAtomOptions<T>, family: FamilyMetadata | undefined): MutableAtomToken<T>;
|
|
42
41
|
//#endregion
|
|
43
42
|
//#region src/internal/overlays/map-overlay.d.ts
|
|
44
|
-
declare class MapOverlay<K, V> extends Map<K, V> {
|
|
45
|
-
deleted: Set<K>;
|
|
46
|
-
changed: Set<K>;
|
|
47
|
-
protected readonly source: Map<K, V>;
|
|
48
|
-
constructor(source: Map<K, V>);
|
|
49
|
-
get(key: K): V | undefined;
|
|
50
|
-
set(key: K, value: V): this;
|
|
51
|
-
hasOwn(key: K): boolean;
|
|
52
|
-
has(key: K): boolean;
|
|
53
|
-
delete(key: K): boolean;
|
|
43
|
+
declare class MapOverlay<K$1, V> extends Map<K$1, V> {
|
|
44
|
+
deleted: Set<K$1>;
|
|
45
|
+
changed: Set<K$1>;
|
|
46
|
+
protected readonly source: Map<K$1, V>;
|
|
47
|
+
constructor(source: Map<K$1, V>);
|
|
48
|
+
get(key: K$1): V | undefined;
|
|
49
|
+
set(key: K$1, value: V): this;
|
|
50
|
+
hasOwn(key: K$1): boolean;
|
|
51
|
+
has(key: K$1): boolean;
|
|
52
|
+
delete(key: K$1): boolean;
|
|
54
53
|
clear(): void;
|
|
55
|
-
[Symbol.iterator](): MapIterator<[K, V]>;
|
|
56
|
-
entries(): MapIterator<[K, V]>;
|
|
57
|
-
keys(): MapIterator<K>;
|
|
54
|
+
[Symbol.iterator](): MapIterator<[K$1, V]>;
|
|
55
|
+
entries(): MapIterator<[K$1, V]>;
|
|
56
|
+
keys(): MapIterator<K$1>;
|
|
58
57
|
values(): MapIterator<V>;
|
|
59
|
-
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void): void;
|
|
58
|
+
forEach(callbackfn: (value: V, key: K$1, map: Map<K$1, V>) => void): void;
|
|
60
59
|
get size(): number;
|
|
61
60
|
}
|
|
62
61
|
//#endregion
|
|
62
|
+
//#region src/internal/utility-types.d.ts
|
|
63
|
+
type Fn = (...parameters: any[]) => any;
|
|
64
|
+
type Ctor<T> = new (...args: any[]) => T;
|
|
65
|
+
type Flat<R extends { [K in PropertyKey]: any }> = { [K in keyof R]: R[K] };
|
|
66
|
+
type Count<N$1 extends number, A extends any[] = []> = [...A, any][`length`] extends N$1 ? A[`length`] : A[`length`] | Count<N$1, [...A, any]>;
|
|
67
|
+
type Each<E extends any[]> = { [P in Count<E[`length`]>]: E[P] };
|
|
68
|
+
type Refinement<A, B extends A> = (a: A) => a is B;
|
|
69
|
+
//#endregion
|
|
63
70
|
//#region src/internal/overlays/relations-overlay.d.ts
|
|
64
|
-
declare class RelationsOverlay<K, V extends Set<any>> extends Map<K, V> {
|
|
65
|
-
deleted: Set<K>;
|
|
66
|
-
protected readonly source: Map<K, V>;
|
|
67
|
-
constructor(source: Map<K, V>);
|
|
68
|
-
get(key: K): V | undefined;
|
|
69
|
-
set(key: K, value: V): this;
|
|
70
|
-
has(key: K): boolean;
|
|
71
|
-
delete(key: K): boolean;
|
|
71
|
+
declare class RelationsOverlay<K$1, V extends Set<any>> extends Map<K$1, V> {
|
|
72
|
+
deleted: Set<K$1>;
|
|
73
|
+
protected readonly source: Map<K$1, V>;
|
|
74
|
+
constructor(source: Map<K$1, V>);
|
|
75
|
+
get(key: K$1): V | undefined;
|
|
76
|
+
set(key: K$1, value: V): this;
|
|
77
|
+
has(key: K$1): boolean;
|
|
78
|
+
delete(key: K$1): boolean;
|
|
72
79
|
}
|
|
73
80
|
//#endregion
|
|
74
81
|
//#region src/internal/overlays/set-overlay.d.ts
|
|
@@ -252,7 +259,7 @@ declare function setEpochNumberOfContinuity(store: RootStore, continuityKey: str
|
|
|
252
259
|
declare function setEpochNumberOfAction(store: RootStore, transactionKey: string, newEpoch: number): void;
|
|
253
260
|
//#endregion
|
|
254
261
|
//#region src/internal/mutable/create-mutable-atom-family.d.ts
|
|
255
|
-
declare function createMutableAtomFamily<T extends Transceiver<any, any, any>, K extends Canonical>(store: RootStore, options: MutableAtomFamilyOptions<T, K>, internalRoles?: string[]): MutableAtomFamilyToken<T, K>;
|
|
262
|
+
declare function createMutableAtomFamily<T extends Transceiver<any, any, any>, K$1 extends Canonical>(store: RootStore, options: MutableAtomFamilyOptions<T, K$1>, internalRoles?: string[]): MutableAtomFamilyToken<T, K$1>;
|
|
256
263
|
//#endregion
|
|
257
264
|
//#region src/internal/timeline/create-timeline.d.ts
|
|
258
265
|
type Timeline<ManagedAtom extends TimelineManageable> = {
|
|
@@ -330,56 +337,56 @@ type PureSelector<T, E> = ReadonlyPureSelector<T, E> | WritablePureSelector<T, E
|
|
|
330
337
|
type Selector<T, E> = ReadonlyHeldSelector<T> | ReadonlyPureSelector<T, E> | WritableHeldSelector<T> | WritablePureSelector<T, E>;
|
|
331
338
|
type WritableState<T, E> = Atom<T, E> | WritableSelector<T, E>;
|
|
332
339
|
type ReadableState<T, E> = Atom<T, E> | Selector<T, E>;
|
|
333
|
-
type RegularAtomFamily<T, K extends Canonical, E = never> = Flat<RegularAtomFamilyToken<T, K, E> & {
|
|
334
|
-
create: <Key extends K>(key: Key) => RegularAtomToken<T, Key, E>;
|
|
335
|
-
default: T | ((key: K) => T);
|
|
340
|
+
type RegularAtomFamily<T, K$1 extends Canonical, E = never> = Flat<RegularAtomFamilyToken<T, K$1, E> & {
|
|
341
|
+
create: <Key extends K$1>(key: Key) => RegularAtomToken<T, Key, E>;
|
|
342
|
+
default: T | ((key: K$1) => T);
|
|
336
343
|
install: (store: RootStore) => void;
|
|
337
344
|
internalRoles: string[] | undefined;
|
|
338
|
-
subject: Subject<StateLifecycleEvent<RegularAtomToken<T, K, E>>>;
|
|
345
|
+
subject: Subject<StateLifecycleEvent<RegularAtomToken<T, K$1, E>>>;
|
|
339
346
|
}>;
|
|
340
|
-
type MutableAtomFamily<T extends Transceiver<any, any, any>, K extends Canonical> = Flat<MutableAtomFamilyToken<T, K> & {
|
|
341
|
-
create: <Key extends K>(key: Key) => MutableAtomToken<T, Key>;
|
|
347
|
+
type MutableAtomFamily<T extends Transceiver<any, any, any>, K$1 extends Canonical> = Flat<MutableAtomFamilyToken<T, K$1> & {
|
|
348
|
+
create: <Key extends K$1>(key: Key) => MutableAtomToken<T, Key>;
|
|
342
349
|
class: ConstructorOf<T>;
|
|
343
350
|
install: (store: RootStore) => void;
|
|
344
351
|
internalRoles: string[] | undefined;
|
|
345
352
|
subject: Subject<StateLifecycleEvent<MutableAtomToken<T>>>;
|
|
346
353
|
}>;
|
|
347
|
-
type AtomFamily<T, K extends Canonical, E> = MutableAtomFamily<T extends Transceiver<any, any, any> ? T : never, K> | RegularAtomFamily<T, K, E>;
|
|
348
|
-
type WritablePureSelectorFamily<T, K extends Canonical, E> = Flat<WritablePureSelectorFamilyToken<T, K, E> & {
|
|
349
|
-
create: <Key extends K>(key: Key) => WritablePureSelectorToken<T, Key, E>;
|
|
350
|
-
default: (key: K) => T;
|
|
354
|
+
type AtomFamily<T, K$1 extends Canonical, E> = MutableAtomFamily<T extends Transceiver<any, any, any> ? T : never, K$1> | RegularAtomFamily<T, K$1, E>;
|
|
355
|
+
type WritablePureSelectorFamily<T, K$1 extends Canonical, E> = Flat<WritablePureSelectorFamilyToken<T, K$1, E> & {
|
|
356
|
+
create: <Key extends K$1>(key: Key) => WritablePureSelectorToken<T, Key, E>;
|
|
357
|
+
default: (key: K$1) => T;
|
|
351
358
|
install: (store: RootStore) => void;
|
|
352
359
|
internalRoles: string[] | undefined;
|
|
353
|
-
subject: Subject<StateLifecycleEvent<WritablePureSelectorToken<T, K, E>>>;
|
|
360
|
+
subject: Subject<StateLifecycleEvent<WritablePureSelectorToken<T, K$1, E>>>;
|
|
354
361
|
}>;
|
|
355
|
-
type WritableHeldSelectorFamily<T, K extends Canonical> = Flat<WritableHeldSelectorFamilyToken<T, K> & {
|
|
356
|
-
create: <Key extends K>(key: Key) => WritableHeldSelectorToken<T, Key>;
|
|
357
|
-
default: (key: K) => T;
|
|
362
|
+
type WritableHeldSelectorFamily<T, K$1 extends Canonical> = Flat<WritableHeldSelectorFamilyToken<T, K$1> & {
|
|
363
|
+
create: <Key extends K$1>(key: Key) => WritableHeldSelectorToken<T, Key>;
|
|
364
|
+
default: (key: K$1) => T;
|
|
358
365
|
install: (store: RootStore) => void;
|
|
359
366
|
internalRoles: string[] | undefined;
|
|
360
|
-
subject: Subject<StateLifecycleEvent<WritableHeldSelectorToken<T, K>>>;
|
|
367
|
+
subject: Subject<StateLifecycleEvent<WritableHeldSelectorToken<T, K$1>>>;
|
|
361
368
|
}>;
|
|
362
|
-
type ReadonlyPureSelectorFamily<T, K extends Canonical, E> = Flat<ReadonlyPureSelectorFamilyToken<T, K, E> & {
|
|
363
|
-
create: <Key extends K>(key: Key) => ReadonlyPureSelectorToken<T, Key, E>;
|
|
364
|
-
default: (key: K) => T;
|
|
369
|
+
type ReadonlyPureSelectorFamily<T, K$1 extends Canonical, E> = Flat<ReadonlyPureSelectorFamilyToken<T, K$1, E> & {
|
|
370
|
+
create: <Key extends K$1>(key: Key) => ReadonlyPureSelectorToken<T, Key, E>;
|
|
371
|
+
default: (key: K$1) => T;
|
|
365
372
|
install: (store: RootStore) => void;
|
|
366
373
|
internalRoles: string[] | undefined;
|
|
367
|
-
subject: Subject<StateLifecycleEvent<ReadonlyPureSelectorToken<T, K, E>>>;
|
|
374
|
+
subject: Subject<StateLifecycleEvent<ReadonlyPureSelectorToken<T, K$1, E>>>;
|
|
368
375
|
}>;
|
|
369
|
-
type ReadonlyHeldSelectorFamily<T, K extends Canonical> = Flat<ReadonlyHeldSelectorFamilyToken<T, K> & {
|
|
370
|
-
create: <Key extends K>(key: Key) => ReadonlyHeldSelectorToken<T, Key>;
|
|
371
|
-
default: (key: K) => T;
|
|
376
|
+
type ReadonlyHeldSelectorFamily<T, K$1 extends Canonical> = Flat<ReadonlyHeldSelectorFamilyToken<T, K$1> & {
|
|
377
|
+
create: <Key extends K$1>(key: Key) => ReadonlyHeldSelectorToken<T, Key>;
|
|
378
|
+
default: (key: K$1) => T;
|
|
372
379
|
install: (store: RootStore) => void;
|
|
373
380
|
internalRoles: string[] | undefined;
|
|
374
381
|
subject: Subject<StateLifecycleEvent<ReadonlyHeldSelectorToken<T>>>;
|
|
375
382
|
}>;
|
|
376
|
-
type PureSelectorFamily<T, K extends Canonical, E> = ReadonlyPureSelectorFamily<T, K, E> | WritablePureSelectorFamily<T, K, E>;
|
|
377
|
-
type HeldSelectorFamily<T, K extends Canonical> = ReadonlyHeldSelectorFamily<T, K> | WritableHeldSelectorFamily<T, K>;
|
|
378
|
-
type ReadonlySelectorFamily<T, K extends Canonical, E> = ReadonlyHeldSelectorFamily<T, K> | ReadonlyPureSelectorFamily<T, K, E>;
|
|
379
|
-
type WritableSelectorFamily<T, K extends Canonical, E> = WritableHeldSelectorFamily<T, K> | WritablePureSelectorFamily<T, K, E>;
|
|
380
|
-
type SelectorFamily<T, K extends Canonical, E> = HeldSelectorFamily<T, K> | PureSelectorFamily<T, K, E>;
|
|
381
|
-
type WritableFamily<T, K extends Canonical, E> = AtomFamily<T, K, E> | WritableSelectorFamily<T, K, E>;
|
|
382
|
-
type ReadableFamily<T, K extends Canonical, E> = AtomFamily<T, K, E> | SelectorFamily<T, K, E>;
|
|
383
|
+
type PureSelectorFamily<T, K$1 extends Canonical, E> = ReadonlyPureSelectorFamily<T, K$1, E> | WritablePureSelectorFamily<T, K$1, E>;
|
|
384
|
+
type HeldSelectorFamily<T, K$1 extends Canonical> = ReadonlyHeldSelectorFamily<T, K$1> | WritableHeldSelectorFamily<T, K$1>;
|
|
385
|
+
type ReadonlySelectorFamily<T, K$1 extends Canonical, E> = ReadonlyHeldSelectorFamily<T, K$1> | ReadonlyPureSelectorFamily<T, K$1, E>;
|
|
386
|
+
type WritableSelectorFamily<T, K$1 extends Canonical, E> = WritableHeldSelectorFamily<T, K$1> | WritablePureSelectorFamily<T, K$1, E>;
|
|
387
|
+
type SelectorFamily<T, K$1 extends Canonical, E> = HeldSelectorFamily<T, K$1> | PureSelectorFamily<T, K$1, E>;
|
|
388
|
+
type WritableFamily<T, K$1 extends Canonical, E> = AtomFamily<T, K$1, E> | WritableSelectorFamily<T, K$1, E>;
|
|
389
|
+
type ReadableFamily<T, K$1 extends Canonical, E> = AtomFamily<T, K$1, E> | SelectorFamily<T, K$1, E>;
|
|
383
390
|
type AtomIOInternalResource = ReadableFamily<any, any, any> | ReadableState<any, any> | Timeline<any> | Transaction<any>;
|
|
384
391
|
//#endregion
|
|
385
392
|
//#region src/internal/mutable/get-json-family.d.ts
|
|
@@ -389,7 +396,7 @@ declare const getJsonFamily: <Core extends Transceiver<any, Json.Serializable, J
|
|
|
389
396
|
declare const getJsonToken: <T extends Transceiver<any, any, any>>(store: Store, mutableAtomToken: MutableAtomToken<T>) => WritablePureSelectorToken<AsJSON<T>>;
|
|
390
397
|
//#endregion
|
|
391
398
|
//#region src/internal/mutable/get-update-family.d.ts
|
|
392
|
-
declare const getUpdateFamily: <T extends Transceiver<any, Json.Serializable, Json.Serializable>, K extends string>(mutableAtomFamily: MutableAtomFamilyToken<T, K>, store: Store) => RegularAtomFamily<SignalFrom<T>, K, never>;
|
|
399
|
+
declare const getUpdateFamily: <T extends Transceiver<any, Json.Serializable, Json.Serializable>, K$1 extends string>(mutableAtomFamily: MutableAtomFamilyToken<T, K$1>, store: Store) => RegularAtomFamily<SignalFrom<T>, K$1, never>;
|
|
393
400
|
//#endregion
|
|
394
401
|
//#region src/internal/mutable/get-update-token.d.ts
|
|
395
402
|
declare const getUpdateToken: <T extends Transceiver<any, any, any>>(mutableAtomToken: MutableAtomToken<T>) => RegularAtomToken<SignalFrom<T>>;
|
|
@@ -413,11 +420,11 @@ declare class Tracker<T extends Transceiver<any, any, any>> {
|
|
|
413
420
|
}
|
|
414
421
|
//#endregion
|
|
415
422
|
//#region src/internal/mutable/tracker-family.d.ts
|
|
416
|
-
declare class FamilyTracker<T extends Transceiver<any, any, any>, K extends Canonical> {
|
|
423
|
+
declare class FamilyTracker<T extends Transceiver<any, any, any>, K$1 extends Canonical> {
|
|
417
424
|
private trackers;
|
|
418
|
-
readonly latestSignalAtoms: RegularAtomFamily<SignalFrom<T> | null, K>;
|
|
419
|
-
readonly mutableAtoms: MutableAtomFamily<T, K>;
|
|
420
|
-
constructor(mutableAtoms: MutableAtomFamily<T, K>, store: RootStore);
|
|
425
|
+
readonly latestSignalAtoms: RegularAtomFamily<SignalFrom<T> | null, K$1>;
|
|
426
|
+
readonly mutableAtoms: MutableAtomFamily<T, K$1>;
|
|
427
|
+
constructor(mutableAtoms: MutableAtomFamily<T, K$1>, store: RootStore);
|
|
421
428
|
}
|
|
422
429
|
//#endregion
|
|
423
430
|
//#region src/internal/store/deposit.d.ts
|
|
@@ -429,8 +436,8 @@ declare function deposit<T, E>(state: ReadonlyPureSelector<T, E>): ReadonlyPureS
|
|
|
429
436
|
declare function deposit<T, E>(state: Selector<T, E>): SelectorToken<T, any, E>;
|
|
430
437
|
declare function deposit<T, E>(state: WritableState<T, E>): WritableToken<T, any, E>;
|
|
431
438
|
declare function deposit<T, E>(state: ReadableState<T, E>): ReadableToken<T, any, E>;
|
|
432
|
-
declare function deposit<T, K extends Canonical, E>(state: RegularAtomFamily<T, K, E>): RegularAtomFamilyToken<T, K, E>;
|
|
433
|
-
declare function deposit<T extends Transceiver<any, any, any>, K extends Canonical>(state: MutableAtomFamily<T, K>): MutableAtomFamilyToken<T, K>;
|
|
439
|
+
declare function deposit<T, K$1 extends Canonical, E>(state: RegularAtomFamily<T, K$1, E>): RegularAtomFamilyToken<T, K$1, E>;
|
|
440
|
+
declare function deposit<T extends Transceiver<any, any, any>, K$1 extends Canonical>(state: MutableAtomFamily<T, K$1>): MutableAtomFamilyToken<T, K$1>;
|
|
434
441
|
declare function deposit<T, E>(state: AtomFamily<T, any, E>): AtomFamilyToken<T, any, E>;
|
|
435
442
|
declare function deposit<T, E>(state: WritablePureSelectorFamily<T, any, E>): WritablePureSelectorFamilyToken<T, any, E>;
|
|
436
443
|
declare function deposit<T, E>(state: ReadonlyPureSelectorFamily<T, any, E>): ReadonlyPureSelectorFamilyToken<T, any, E>;
|
|
@@ -480,9 +487,9 @@ declare function newest<T extends Lineage>(scion: T): Exclude<T[`child`], null>
|
|
|
480
487
|
declare function eldest<T extends Lineage>(scion: T): Exclude<T[`parent`], T[`child`] | null>;
|
|
481
488
|
//#endregion
|
|
482
489
|
//#region src/internal/molecule.d.ts
|
|
483
|
-
type Molecule<K extends Canonical> = {
|
|
484
|
-
readonly key: K;
|
|
485
|
-
readonly stringKey: stringified<K>;
|
|
490
|
+
type Molecule<K$1 extends Canonical> = {
|
|
491
|
+
readonly key: K$1;
|
|
492
|
+
readonly stringKey: stringified<K$1>;
|
|
486
493
|
readonly dependsOn: `all` | `any`;
|
|
487
494
|
readonly subject: Subject<void>;
|
|
488
495
|
};
|
|
@@ -593,20 +600,20 @@ declare function withdraw<T, E>(store: Store, token: PureSelectorToken<T, any, E
|
|
|
593
600
|
declare function withdraw<T, E>(store: Store, token: SelectorToken<T, any, E>): Selector<T, E>;
|
|
594
601
|
declare function withdraw<T, E>(store: Store, token: WritableToken<T, any, E>): WritableState<T, E>;
|
|
595
602
|
declare function withdraw<T, E>(store: Store, token: ReadableToken<T, any, E>): ReadableState<T, E>;
|
|
596
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: RegularAtomFamilyToken<T, K, E>): RegularAtomFamily<T, K, E>;
|
|
597
|
-
declare function withdraw<T extends Transceiver<any, any, any>, K extends Canonical>(store: Store, token: MutableAtomFamilyToken<T, K>): MutableAtomFamily<T, K>;
|
|
598
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: AtomFamilyToken<T, K, E>): AtomFamily<T, K, E>;
|
|
599
|
-
declare function withdraw<T, K extends Canonical>(store: Store, token: ReadonlyHeldSelectorFamilyToken<T, K>): ReadonlyHeldSelectorFamily<T, K>;
|
|
600
|
-
declare function withdraw<T, K extends Canonical>(store: Store, token: WritableHeldSelectorFamilyToken<T, K>): WritableHeldSelectorFamily<T, K>;
|
|
601
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: ReadonlyPureSelectorFamilyToken<T, K, E>): ReadonlyPureSelectorFamily<T, K, E>;
|
|
602
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: WritablePureSelectorFamilyToken<T, K, E>): WritablePureSelectorFamily<T, K, E>;
|
|
603
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: ReadonlySelectorFamilyToken<T, K, E>): ReadonlySelectorFamily<T, K, E>;
|
|
604
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: WritableSelectorFamilyToken<T, K, E>): WritableSelectorFamily<T, K, E>;
|
|
605
|
-
declare function withdraw<T, K extends Canonical>(store: Store, token: HeldSelectorFamilyToken<T, K>): HeldSelectorFamily<T, K>;
|
|
606
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: PureSelectorFamilyToken<T, K, E>): PureSelectorFamily<T, K, E>;
|
|
607
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: SelectorFamilyToken<T, K, E>): SelectorFamily<T, K, E>;
|
|
608
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: WritableFamilyToken<T, K, E>): WritableFamily<T, K, E>;
|
|
609
|
-
declare function withdraw<T, K extends Canonical, E>(store: Store, token: ReadableFamilyToken<T, K, E>): ReadableFamily<T, K, E>;
|
|
603
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: RegularAtomFamilyToken<T, K$1, E>): RegularAtomFamily<T, K$1, E>;
|
|
604
|
+
declare function withdraw<T extends Transceiver<any, any, any>, K$1 extends Canonical>(store: Store, token: MutableAtomFamilyToken<T, K$1>): MutableAtomFamily<T, K$1>;
|
|
605
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: AtomFamilyToken<T, K$1, E>): AtomFamily<T, K$1, E>;
|
|
606
|
+
declare function withdraw<T, K$1 extends Canonical>(store: Store, token: ReadonlyHeldSelectorFamilyToken<T, K$1>): ReadonlyHeldSelectorFamily<T, K$1>;
|
|
607
|
+
declare function withdraw<T, K$1 extends Canonical>(store: Store, token: WritableHeldSelectorFamilyToken<T, K$1>): WritableHeldSelectorFamily<T, K$1>;
|
|
608
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: ReadonlyPureSelectorFamilyToken<T, K$1, E>): ReadonlyPureSelectorFamily<T, K$1, E>;
|
|
609
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: WritablePureSelectorFamilyToken<T, K$1, E>): WritablePureSelectorFamily<T, K$1, E>;
|
|
610
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: ReadonlySelectorFamilyToken<T, K$1, E>): ReadonlySelectorFamily<T, K$1, E>;
|
|
611
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: WritableSelectorFamilyToken<T, K$1, E>): WritableSelectorFamily<T, K$1, E>;
|
|
612
|
+
declare function withdraw<T, K$1 extends Canonical>(store: Store, token: HeldSelectorFamilyToken<T, K$1>): HeldSelectorFamily<T, K$1>;
|
|
613
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: PureSelectorFamilyToken<T, K$1, E>): PureSelectorFamily<T, K$1, E>;
|
|
614
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: SelectorFamilyToken<T, K$1, E>): SelectorFamily<T, K$1, E>;
|
|
615
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: WritableFamilyToken<T, K$1, E>): WritableFamily<T, K$1, E>;
|
|
616
|
+
declare function withdraw<T, K$1 extends Canonical, E>(store: Store, token: ReadableFamilyToken<T, K$1, E>): ReadableFamily<T, K$1, E>;
|
|
610
617
|
declare function withdraw<T extends Fn>(store: Store, token: TransactionToken<T>): Transaction<T extends Fn ? T : never>;
|
|
611
618
|
declare function withdraw<T>(store: Store, token: TimelineToken<T>): Timeline<T extends TimelineManageable ? T : never>;
|
|
612
619
|
declare function withdraw<T, E>(store: Store, token: WritableToken<T, any, E>): WritableState<T, E>;
|
|
@@ -619,7 +626,7 @@ type InternalRole = (typeof INTERNAL_ROLES)[number];
|
|
|
619
626
|
declare function hasRole(atom: Atom<any, any>, role: InternalRole): boolean;
|
|
620
627
|
//#endregion
|
|
621
628
|
//#region src/internal/atom/create-regular-atom.d.ts
|
|
622
|
-
declare function createRegularAtom<T, K extends Canonical, E>(store: Store, options: RegularAtomOptions<T, E>, family: FamilyMetadata<K> | undefined, internalRoles?: InternalRole[]): RegularAtomToken<T, K, E>;
|
|
629
|
+
declare function createRegularAtom<T, K$1 extends Canonical, E>(store: Store, options: RegularAtomOptions<T, E>, family: FamilyMetadata<K$1> | undefined, internalRoles?: InternalRole[]): RegularAtomToken<T, K$1, E>;
|
|
623
630
|
//#endregion
|
|
624
631
|
//#region src/internal/atom/dispose-atom.d.ts
|
|
625
632
|
declare function disposeAtom(store: Store, atomToken: AtomToken<any, any, any>): void;
|
|
@@ -677,52 +684,52 @@ declare function ingestSelectorUpdateEvent(store: Store, selectorUpdate: Timelin
|
|
|
677
684
|
declare function ingestTransactionOutcomeEvent(store: Store, event: TransactionOutcomeEvent<any>, applying: `newValue` | `oldValue`): void;
|
|
678
685
|
//#endregion
|
|
679
686
|
//#region src/internal/families/create-readonly-pure-selector-family.d.ts
|
|
680
|
-
declare function createReadonlyPureSelectorFamily<T, K extends Canonical, E>(store: RootStore, options: ReadonlyPureSelectorFamilyOptions<T, K, E>, internalRoles?: string[]): ReadonlyPureSelectorFamilyToken<T, K, E>;
|
|
687
|
+
declare function createReadonlyPureSelectorFamily<T, K$1 extends Canonical, E>(store: RootStore, options: ReadonlyPureSelectorFamilyOptions<T, K$1, E>, internalRoles?: string[]): ReadonlyPureSelectorFamilyToken<T, K$1, E>;
|
|
681
688
|
//#endregion
|
|
682
689
|
//#region src/internal/families/create-regular-atom-family.d.ts
|
|
683
|
-
declare function createRegularAtomFamily<T, K extends Canonical, E>(store: RootStore, options: RegularAtomFamilyOptions<T, K, E>, internalRoles?: string[]): RegularAtomFamilyToken<T, K, E>;
|
|
690
|
+
declare function createRegularAtomFamily<T, K$1 extends Canonical, E>(store: RootStore, options: RegularAtomFamilyOptions<T, K$1, E>, internalRoles?: string[]): RegularAtomFamilyToken<T, K$1, E>;
|
|
684
691
|
//#endregion
|
|
685
692
|
//#region src/internal/families/create-selector-family.d.ts
|
|
686
|
-
declare function createSelectorFamily<T extends object, K extends Canonical>(store: RootStore, options: WritableHeldSelectorFamilyOptions<T, K>): WritableHeldSelectorFamilyToken<T, K>;
|
|
687
|
-
declare function createSelectorFamily<T extends object, K extends Canonical>(store: RootStore, options: ReadonlyHeldSelectorFamilyOptions<T, K>): ReadonlyHeldSelectorFamilyToken<T, K>;
|
|
688
|
-
declare function createSelectorFamily<T, K extends Canonical, E>(store: RootStore, options: WritablePureSelectorFamilyOptions<T, K, E>): WritablePureSelectorFamilyToken<T, K, E>;
|
|
689
|
-
declare function createSelectorFamily<T, K extends Canonical, E>(store: RootStore, options: ReadonlyPureSelectorFamilyOptions<T, K, E>): ReadonlyPureSelectorFamilyToken<T, K, E>;
|
|
693
|
+
declare function createSelectorFamily<T extends object, K$1 extends Canonical>(store: RootStore, options: WritableHeldSelectorFamilyOptions<T, K$1>): WritableHeldSelectorFamilyToken<T, K$1>;
|
|
694
|
+
declare function createSelectorFamily<T extends object, K$1 extends Canonical>(store: RootStore, options: ReadonlyHeldSelectorFamilyOptions<T, K$1>): ReadonlyHeldSelectorFamilyToken<T, K$1>;
|
|
695
|
+
declare function createSelectorFamily<T, K$1 extends Canonical, E>(store: RootStore, options: WritablePureSelectorFamilyOptions<T, K$1, E>): WritablePureSelectorFamilyToken<T, K$1, E>;
|
|
696
|
+
declare function createSelectorFamily<T, K$1 extends Canonical, E>(store: RootStore, options: ReadonlyPureSelectorFamilyOptions<T, K$1, E>): ReadonlyPureSelectorFamilyToken<T, K$1, E>;
|
|
690
697
|
//#endregion
|
|
691
698
|
//#region src/internal/families/create-writable-pure-selector-family.d.ts
|
|
692
|
-
declare function createWritablePureSelectorFamily<T, K extends Canonical, E>(store: Store, options: WritablePureSelectorFamilyOptions<T, K, E>, internalRoles?: string[]): WritablePureSelectorFamilyToken<T, K, E>;
|
|
699
|
+
declare function createWritablePureSelectorFamily<T, K$1 extends Canonical, E>(store: Store, options: WritablePureSelectorFamilyOptions<T, K$1, E>, internalRoles?: string[]): WritablePureSelectorFamilyToken<T, K$1, E>;
|
|
693
700
|
//#endregion
|
|
694
701
|
//#region src/internal/families/dispose-from-store.d.ts
|
|
695
702
|
declare function disposeFromStore(store: Store, token: ReadableToken<any, any, any>): void;
|
|
696
|
-
declare function disposeFromStore<K extends Canonical>(store: Store, token: ReadableFamilyToken<any, K, any>, key: NoInfer<K>): void;
|
|
697
|
-
declare function disposeFromStore<K extends Canonical>(store: Store, ...params: [token: ReadableFamilyToken<any, K, any>, key: NoInfer<K>] | [token: ReadableToken<any, any, any>]): void;
|
|
703
|
+
declare function disposeFromStore<K$1 extends Canonical>(store: Store, token: ReadableFamilyToken<any, K$1, any>, key: NoInfer<K$1>): void;
|
|
704
|
+
declare function disposeFromStore<K$1 extends Canonical>(store: Store, ...params: [token: ReadableFamilyToken<any, K$1, any>, key: NoInfer<K$1>] | [token: ReadableToken<any, any, any>]): void;
|
|
698
705
|
//#endregion
|
|
699
706
|
//#region src/internal/families/find-in-store.d.ts
|
|
700
|
-
declare function findInStore<T extends Transceiver<any, any, any>, K extends Canonical, Key extends K>(store: Store, familyToken: MutableAtomFamilyToken<T, K>, key: Key): MutableAtomToken<T, Key>;
|
|
701
|
-
declare function findInStore<T, K extends Canonical, Key extends K, E>(store: Store, familyToken: RegularAtomFamilyToken<T, K, E>, key: Key): RegularAtomToken<T, Key, E>;
|
|
702
|
-
declare function findInStore<T, K extends Canonical, Key extends K, E>(store: Store, familyToken: AtomFamilyToken<T, K, E>, key: Key): AtomToken<T, Key, E>;
|
|
703
|
-
declare function findInStore<T, K extends Canonical, Key extends K, E>(store: Store, familyToken: WritablePureSelectorFamilyToken<T, K, E>, key: Key): WritablePureSelectorToken<T, Key, E>;
|
|
704
|
-
declare function findInStore<T, K extends Canonical, Key extends K, E>(store: Store, familyToken: ReadonlyPureSelectorFamilyToken<T, K, E>, key: Key): ReadonlyPureSelectorToken<T, Key, E>;
|
|
705
|
-
declare function findInStore<T, K extends Canonical, Key extends K, E>(store: Store, familyToken: SelectorFamilyToken<T, K, E>, key: Key): SelectorToken<T, Key, E>;
|
|
706
|
-
declare function findInStore<T, K extends Canonical, Key extends K, E>(store: Store, familyToken: WritableFamilyToken<T, K, E>, key: Key): WritableToken<T, Key, E>;
|
|
707
|
-
declare function findInStore<T, K extends Canonical, Key extends K, E>(store: Store, familyToken: ReadableFamilyToken<T, K, E>, key: Key): ReadableToken<T, Key, E>;
|
|
707
|
+
declare function findInStore<T extends Transceiver<any, any, any>, K$1 extends Canonical, Key extends K$1>(store: Store, familyToken: MutableAtomFamilyToken<T, K$1>, key: Key): MutableAtomToken<T, Key>;
|
|
708
|
+
declare function findInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, familyToken: RegularAtomFamilyToken<T, K$1, E>, key: Key): RegularAtomToken<T, Key, E>;
|
|
709
|
+
declare function findInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, familyToken: AtomFamilyToken<T, K$1, E>, key: Key): AtomToken<T, Key, E>;
|
|
710
|
+
declare function findInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, familyToken: WritablePureSelectorFamilyToken<T, K$1, E>, key: Key): WritablePureSelectorToken<T, Key, E>;
|
|
711
|
+
declare function findInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, familyToken: ReadonlyPureSelectorFamilyToken<T, K$1, E>, key: Key): ReadonlyPureSelectorToken<T, Key, E>;
|
|
712
|
+
declare function findInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, familyToken: SelectorFamilyToken<T, K$1, E>, key: Key): SelectorToken<T, Key, E>;
|
|
713
|
+
declare function findInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, familyToken: WritableFamilyToken<T, K$1, E>, key: Key): WritableToken<T, Key, E>;
|
|
714
|
+
declare function findInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, familyToken: ReadableFamilyToken<T, K$1, E>, key: Key): ReadableToken<T, Key, E>;
|
|
708
715
|
//#endregion
|
|
709
716
|
//#region src/internal/families/get-family-of-token.d.ts
|
|
710
|
-
declare function getFamilyOfToken<T extends Transceiver<any, any, any>, K extends Canonical>(store: Store, token: MutableAtomToken<T, K>): MutableAtomFamily<T, K>;
|
|
711
|
-
declare function getFamilyOfToken<T, K extends Canonical, E>(store: Store, token: RegularAtomToken<T, K, E>): RegularAtomFamily<T, K, E>;
|
|
712
|
-
declare function getFamilyOfToken<T, K extends Canonical, E>(store: Store, token: WritablePureSelectorToken<T, K, E>): WritablePureSelectorFamily<T, K, E>;
|
|
713
|
-
declare function getFamilyOfToken<T, K extends Canonical, E>(store: Store, token: ReadonlyPureSelectorToken<T, K, E>): ReadonlyPureSelectorFamily<T, K, E>;
|
|
714
|
-
declare function getFamilyOfToken<T, K extends Canonical, E>(store: Store, token: WritableToken<T, K, E>): WritableFamily<T, K, E>;
|
|
715
|
-
declare function getFamilyOfToken<T, K extends Canonical, E>(store: Store, token: ReadableToken<T, K, E>): ReadableFamily<T, K, E>;
|
|
717
|
+
declare function getFamilyOfToken<T extends Transceiver<any, any, any>, K$1 extends Canonical>(store: Store, token: MutableAtomToken<T, K$1>): MutableAtomFamily<T, K$1>;
|
|
718
|
+
declare function getFamilyOfToken<T, K$1 extends Canonical, E>(store: Store, token: RegularAtomToken<T, K$1, E>): RegularAtomFamily<T, K$1, E>;
|
|
719
|
+
declare function getFamilyOfToken<T, K$1 extends Canonical, E>(store: Store, token: WritablePureSelectorToken<T, K$1, E>): WritablePureSelectorFamily<T, K$1, E>;
|
|
720
|
+
declare function getFamilyOfToken<T, K$1 extends Canonical, E>(store: Store, token: ReadonlyPureSelectorToken<T, K$1, E>): ReadonlyPureSelectorFamily<T, K$1, E>;
|
|
721
|
+
declare function getFamilyOfToken<T, K$1 extends Canonical, E>(store: Store, token: WritableToken<T, K$1, E>): WritableFamily<T, K$1, E>;
|
|
722
|
+
declare function getFamilyOfToken<T, K$1 extends Canonical, E>(store: Store, token: ReadableToken<T, K$1, E>): ReadableFamily<T, K$1, E>;
|
|
716
723
|
//#endregion
|
|
717
724
|
//#region src/internal/families/seek-in-store.d.ts
|
|
718
|
-
declare function seekInStore<T extends Transceiver<any, any, any>, K extends Canonical, Key extends K>(store: Store, token: MutableAtomFamilyToken<T, K>, key: Key): MutableAtomToken<T, Key> | undefined;
|
|
719
|
-
declare function seekInStore<T, K extends Canonical, Key extends K, E>(store: Store, token: RegularAtomFamilyToken<T, K, E>, key: Key): RegularAtomToken<T, Key, E> | undefined;
|
|
720
|
-
declare function seekInStore<T, K extends Canonical, Key extends K, E>(store: Store, token: AtomFamilyToken<T, K, E>, key: Key): AtomToken<T, Key, E> | undefined;
|
|
721
|
-
declare function seekInStore<T, K extends Canonical, Key extends K, E>(store: Store, token: WritablePureSelectorFamilyToken<T, K, E>, key: Key): WritablePureSelectorToken<T, Key, E> | undefined;
|
|
722
|
-
declare function seekInStore<T, K extends Canonical, Key extends K, E>(store: Store, token: ReadonlyPureSelectorFamilyToken<T, K, E>, key: Key): ReadonlyPureSelectorToken<T, Key, E> | undefined;
|
|
723
|
-
declare function seekInStore<T, K extends Canonical, Key extends K, E>(store: Store, token: SelectorFamilyToken<T, K, E>, key: Key): SelectorToken<T, Key, E> | undefined;
|
|
724
|
-
declare function seekInStore<T, K extends Canonical, Key extends K, E>(store: Store, token: WritableFamilyToken<T, K, E>, key: Key): WritableToken<T, Key, E> | undefined;
|
|
725
|
-
declare function seekInStore<T, K extends Canonical, Key extends K, E>(store: Store, token: ReadableFamilyToken<T, K, E>, key: Key): ReadableToken<T, Key, E> | undefined;
|
|
725
|
+
declare function seekInStore<T extends Transceiver<any, any, any>, K$1 extends Canonical, Key extends K$1>(store: Store, token: MutableAtomFamilyToken<T, K$1>, key: Key): MutableAtomToken<T, Key> | undefined;
|
|
726
|
+
declare function seekInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, token: RegularAtomFamilyToken<T, K$1, E>, key: Key): RegularAtomToken<T, Key, E> | undefined;
|
|
727
|
+
declare function seekInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, token: AtomFamilyToken<T, K$1, E>, key: Key): AtomToken<T, Key, E> | undefined;
|
|
728
|
+
declare function seekInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, token: WritablePureSelectorFamilyToken<T, K$1, E>, key: Key): WritablePureSelectorToken<T, Key, E> | undefined;
|
|
729
|
+
declare function seekInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, token: ReadonlyPureSelectorFamilyToken<T, K$1, E>, key: Key): ReadonlyPureSelectorToken<T, Key, E> | undefined;
|
|
730
|
+
declare function seekInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, token: SelectorFamilyToken<T, K$1, E>, key: Key): SelectorToken<T, Key, E> | undefined;
|
|
731
|
+
declare function seekInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, token: WritableFamilyToken<T, K$1, E>, key: Key): WritableToken<T, Key, E> | undefined;
|
|
732
|
+
declare function seekInStore<T, K$1 extends Canonical, Key extends K$1, E>(store: Store, token: ReadableFamilyToken<T, K$1, E>, key: Key): ReadableToken<T, Key, E> | undefined;
|
|
726
733
|
//#endregion
|
|
727
734
|
//#region src/internal/get-environment-data.d.ts
|
|
728
735
|
type EnvironmentData = {
|
|
@@ -732,8 +739,8 @@ declare function getEnvironmentData(store: Store): EnvironmentData;
|
|
|
732
739
|
//#endregion
|
|
733
740
|
//#region src/internal/get-state/get-from-store.d.ts
|
|
734
741
|
declare function getFromStore<T, E = never>(store: Store, token: ReadableToken<T, any, E>): E | T;
|
|
735
|
-
declare function getFromStore<T, K extends Canonical, E = never>(store: Store, token: ReadableFamilyToken<T, K, E>, key: NoInfer<K>): ViewOf<E | T>;
|
|
736
|
-
declare function getFromStore<T, K extends Canonical, E = never>(store: Store, ...params: [token: ReadableFamilyToken<T, K, E>, key: NoInfer<K>] | [token: ReadableToken<T, any, E>]): ViewOf<E | T>;
|
|
742
|
+
declare function getFromStore<T, K$1 extends Canonical, E = never>(store: Store, token: ReadableFamilyToken<T, K$1, E>, key: NoInfer<K$1>): ViewOf<E | T>;
|
|
743
|
+
declare function getFromStore<T, K$1 extends Canonical, E = never>(store: Store, ...params: [token: ReadableFamilyToken<T, K$1, E>, key: NoInfer<K$1>] | [token: ReadableToken<T, any, E>]): ViewOf<E | T>;
|
|
737
744
|
//#endregion
|
|
738
745
|
//#region src/internal/get-state/read-or-compute-value.d.ts
|
|
739
746
|
declare function readOrComputeValue<T, E>(target: Store, state: ReadableState<T, E>, mut?: undefined): ViewOf<E | T>;
|
|
@@ -788,7 +795,7 @@ declare function isReservedIntrospectionKey(value: string): value is ReservedInt
|
|
|
788
795
|
declare function createReadonlyHeldSelector<T extends object>(store: Store, options: ReadonlyHeldSelectorOptions<T>, family: FamilyMetadata | undefined): ReadonlyHeldSelectorToken<T>;
|
|
789
796
|
//#endregion
|
|
790
797
|
//#region src/internal/selector/create-readonly-pure-selector.d.ts
|
|
791
|
-
declare function createReadonlyPureSelector<T, K extends Canonical, E>(store: Store, options: ReadonlyPureSelectorOptions<T, E>, family: FamilyMetadata<K> | undefined): ReadonlyPureSelectorToken<T, K, E>;
|
|
798
|
+
declare function createReadonlyPureSelector<T, K$1 extends Canonical, E>(store: Store, options: ReadonlyPureSelectorOptions<T, E>, family: FamilyMetadata<K$1> | undefined): ReadonlyPureSelectorToken<T, K$1, E>;
|
|
792
799
|
//#endregion
|
|
793
800
|
//#region src/internal/selector/create-standalone-selector.d.ts
|
|
794
801
|
declare function createStandaloneSelector<T extends object>(store: Store, options: WritableHeldSelectorOptions<T>): WritableHeldSelectorToken<T>;
|
|
@@ -800,7 +807,7 @@ declare function createStandaloneSelector<T, E>(store: Store, options: ReadonlyP
|
|
|
800
807
|
declare function createWritableHeldSelector<T extends object>(store: Store, options: WritableHeldSelectorOptions<T>, family: FamilyMetadata | undefined): WritableHeldSelectorToken<T>;
|
|
801
808
|
//#endregion
|
|
802
809
|
//#region src/internal/selector/create-writable-pure-selector.d.ts
|
|
803
|
-
declare function createWritablePureSelector<T, K extends Canonical, E>(store: Store, options: WritablePureSelectorOptions<T, E>, family: FamilyMetadata<K> | undefined): WritablePureSelectorToken<T, K, E>;
|
|
810
|
+
declare function createWritablePureSelector<T, K$1 extends Canonical, E>(store: Store, options: WritablePureSelectorOptions<T, E>, family: FamilyMetadata<K$1> | undefined): WritablePureSelectorToken<T, K$1, E>;
|
|
804
811
|
//#endregion
|
|
805
812
|
//#region src/internal/selector/dispose-selector.d.ts
|
|
806
813
|
declare function disposeSelector(store: Store, selectorToken: SelectorToken<unknown, any, any>): void;
|
|
@@ -827,8 +834,8 @@ declare function evictDownstreamFromSelector(store: Store, selectorKey: string):
|
|
|
827
834
|
//#region src/internal/set-state/reset-in-store.d.ts
|
|
828
835
|
declare const RESET_STATE: unique symbol;
|
|
829
836
|
declare function resetInStore(store: Store, token: WritableToken<any, any, any>): void;
|
|
830
|
-
declare function resetInStore<K extends Canonical>(store: Store, token: WritableFamilyToken<any, K, any>, key: NoInfer<K>): void;
|
|
831
|
-
declare function resetInStore<T, K extends Canonical>(store: Store, ...params: [token: WritableFamilyToken<T, K, any>, key: NoInfer<K>] | [token: WritableToken<T, any, any>]): void;
|
|
837
|
+
declare function resetInStore<K$1 extends Canonical>(store: Store, token: WritableFamilyToken<any, K$1, any>, key: NoInfer<K$1>): void;
|
|
838
|
+
declare function resetInStore<T, K$1 extends Canonical>(store: Store, ...params: [token: WritableFamilyToken<T, K$1, any>, key: NoInfer<K$1>] | [token: WritableToken<T, any, any>]): void;
|
|
832
839
|
//#endregion
|
|
833
840
|
//#region src/internal/set-state/operate-on-store.d.ts
|
|
834
841
|
type ProtoUpdate<T> = {
|
|
@@ -837,7 +844,7 @@ type ProtoUpdate<T> = {
|
|
|
837
844
|
};
|
|
838
845
|
declare const OWN_OP: unique symbol;
|
|
839
846
|
declare const JOIN_OP: unique symbol;
|
|
840
|
-
declare function operateOnStore<T, TT extends T, K extends Canonical, E>(opMode: typeof JOIN_OP | typeof OWN_OP, store: Store, ...params: [token: WritableFamilyToken<T, K, E>, key: NoInfer<K>, value: Setter<TT> | TT | typeof RESET_STATE] | [token: WritableToken<T, any, E>, value: Setter<TT> | TT | typeof RESET_STATE]): void;
|
|
847
|
+
declare function operateOnStore<T, TT extends T, K$1 extends Canonical, E>(opMode: typeof JOIN_OP | typeof OWN_OP, store: Store, ...params: [token: WritableFamilyToken<T, K$1, E>, key: NoInfer<K$1>, value: Setter<TT> | TT | typeof RESET_STATE] | [token: WritableToken<T, any, E>, value: Setter<TT> | TT | typeof RESET_STATE]): void;
|
|
841
848
|
//#endregion
|
|
842
849
|
//#region src/internal/set-state/reset-atom-or-selector.d.ts
|
|
843
850
|
declare function resetAtomOrSelector<T, E>(target: Store & {
|
|
@@ -851,8 +858,8 @@ declare const setAtomOrSelector: <T>(target: Store & {
|
|
|
851
858
|
//#endregion
|
|
852
859
|
//#region src/internal/set-state/set-into-store.d.ts
|
|
853
860
|
declare function setIntoStore<T, TT extends T>(store: Store, token: WritableToken<T, any, any>, value: Setter<TT> | TT | typeof RESET_STATE): void;
|
|
854
|
-
declare function setIntoStore<T, TT extends T, K extends Canonical>(store: Store, token: WritableFamilyToken<T, K, any>, key: NoInfer<K>, value: Setter<TT> | TT | typeof RESET_STATE): void;
|
|
855
|
-
declare function setIntoStore<T, TT extends T, K extends Canonical>(store: Store, ...params: [token: WritableFamilyToken<T, K, any>, key: NoInfer<K>, value: Setter<TT> | TT | typeof RESET_STATE] | [token: WritableToken<T, any, any>, value: Setter<TT> | TT | typeof RESET_STATE]): void;
|
|
861
|
+
declare function setIntoStore<T, TT extends T, K$1 extends Canonical>(store: Store, token: WritableFamilyToken<T, K$1, any>, key: NoInfer<K$1>, value: Setter<TT> | TT | typeof RESET_STATE): void;
|
|
862
|
+
declare function setIntoStore<T, TT extends T, K$1 extends Canonical>(store: Store, ...params: [token: WritableFamilyToken<T, K$1, any>, key: NoInfer<K$1>, value: Setter<TT> | TT | typeof RESET_STATE] | [token: WritableToken<T, any, any>, value: Setter<TT> | TT | typeof RESET_STATE]): void;
|
|
856
863
|
//#endregion
|
|
857
864
|
//#region src/internal/subscribe/recall-state.d.ts
|
|
858
865
|
declare const recallState: <T, E>(store: Store, state: ReadableState<T, E>) => T;
|