atom.io 0.33.12 → 0.33.14
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/data/index.js.map +1 -1
- package/dist/eslint-plugin/index.js.map +1 -1
- package/dist/internal/index.js +25 -23
- package/dist/internal/index.js.map +1 -1
- package/dist/introspection/index.d.ts +7 -7
- package/dist/introspection/index.d.ts.map +1 -1
- package/dist/introspection/index.js +26 -38
- package/dist/introspection/index.js.map +1 -1
- package/dist/json/index.js.map +1 -1
- package/dist/main/index.js +11 -11
- package/dist/main/index.js.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-devtools/index.css +182 -96
- package/dist/react-devtools/index.css.map +1 -1
- package/dist/react-devtools/index.d.ts +1 -0
- package/dist/react-devtools/index.d.ts.map +1 -1
- package/dist/react-devtools/index.js +177 -81
- package/dist/react-devtools/index.js.map +1 -1
- package/dist/realtime/index.js.map +1 -1
- package/dist/realtime-client/index.js.map +1 -1
- package/dist/realtime-react/index.js.map +1 -1
- package/dist/realtime-server/index.js.map +1 -1
- package/dist/realtime-testing/index.js.map +1 -1
- package/dist/transceivers/set-rtx/index.js.map +1 -1
- package/dist/use-o-BrXc7Qro.js.map +1 -1
- package/dist/web/index.js.map +1 -1
- package/package.json +10 -10
- package/src/internal/transaction/create-transaction.ts +9 -5
- package/src/introspection/attach-atom-index.ts +6 -15
- package/src/introspection/attach-introspection-states.ts +5 -5
- package/src/introspection/attach-selector-index.ts +78 -85
- package/src/introspection/attach-timeline-index.ts +5 -12
- package/src/introspection/attach-transaction-index.ts +18 -16
- package/src/introspection/auditor.ts +2 -3
- package/src/react-devtools/Button.tsx +12 -4
- package/src/react-devtools/StateEditor.tsx +13 -1
- package/src/react-devtools/StateIndex.tsx +83 -39
- package/src/react-devtools/TimelineIndex.tsx +16 -12
- package/src/react-devtools/TransactionIndex.tsx +22 -18
- package/src/react-devtools/devtools.css +182 -96
- package/src/react-devtools/json-editor/developer-interface.tsx +2 -1
- package/src/react-devtools/json-editor/editors-by-type/array-editor.tsx +23 -20
- package/src/react-devtools/json-editor/editors-by-type/object-editor.tsx +7 -23
- package/src/react-devtools/json-editor/json-editor-internal.tsx +94 -77
- package/src/react-devtools/store.ts +97 -6
package/dist/data/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["family:\n\t\t| AtomIO.ReadonlyPureSelectorFamilyToken<State, Key>\n\t\t| AtomIO.RegularAtomFamilyToken<State, Key>\n\t\t| AtomIO.WritablePureSelectorFamilyToken<State, Key>","index:\n\t\t| AtomIO.ReadonlyPureSelectorToken<Key[]>\n\t\t| AtomIO.RegularAtomToken<Key[]>\n\t\t| AtomIO.WritablePureSelectorToken<Key[]>","store: Store","options: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t}","store: Store","atoms: {\n\t\t[K in keyof Struct as `${Key}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomToken<Struct[K]>\n\t}","topKey: string","subKey: string","options: {\n\tkey: Key\n\tdefault: Struct\n}","atoms: {\n\t\t[K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomFamilyToken<Struct[K], string>\n\t}","findStructState: AtomIO.ReadonlyPureSelectorFamilyToken<Struct, string>"],"sources":["../../src/data/dict.ts","../../src/data/struct.ts","../../src/data/struct-family.ts"],"sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport {\n\tcreateStandaloneSelector,\n\tfindInStore,\n\tIMPLICIT,\n} from \"atom.io/internal\"\nimport type { Canonical, stringified } from \"atom.io/json\"\n\nexport function dict<State, Key extends Canonical>(\n\tfamily:\n\t\t| AtomIO.ReadonlyPureSelectorFamilyToken<State, Key>\n\t\t| AtomIO.RegularAtomFamilyToken<State, Key>\n\t\t| AtomIO.WritablePureSelectorFamilyToken<State, Key>,\n\tindex:\n\t\t| AtomIO.ReadonlyPureSelectorToken<Key[]>\n\t\t| AtomIO.RegularAtomToken<Key[]>\n\t\t| AtomIO.WritablePureSelectorToken<Key[]>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomIO.ReadonlyPureSelectorToken<{ [K in stringified<Key>]: State }> {\n\treturn createStandaloneSelector(store, {\n\t\tkey: `${family.key}Dict`,\n\t\tget: ({ get }) => {\n\t\t\tconst keys = get(index)\n\t\t\treturn keys.reduce((acc, key) => {\n\t\t\t\tacc[key] = get(findInStore(store, family, key))\n\t\t\t\treturn acc\n\t\t\t}, {} as any)\n\t\t},\n\t})\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport {\n\tcapitalize,\n\tcreateRegularAtom,\n\tcreateStandaloneSelector,\n\tIMPLICIT,\n} from \"atom.io/internal\"\n\nexport function struct<\n\tStruct extends { [key: string]: unknown },\n\tKey extends string,\n>(\n\toptions: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t},\n\tstore: Store = IMPLICIT.STORE,\n): [\n\t{\n\t\t[K in keyof Struct as `${Key}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomToken<Struct[K]>\n\t},\n\tAtomIO.ReadonlyPureSelectorToken<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in keyof Struct as `${Key}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomToken<Struct[K]>\n\t} = Object.keys(options.default).reduce((acc, key) => {\n\t\tconst atomName = options.key + capitalize(key) + `State`\n\t\tacc[atomName] = createRegularAtom(\n\t\t\tstore,\n\t\t\t{\n\t\t\t\tkey: `${options.key}.${key}`,\n\t\t\t\tdefault: options.default[key],\n\t\t\t},\n\t\t\tundefined,\n\t\t)\n\t\treturn acc\n\t}, {} as any)\n\tconst structState = createStandaloneSelector(store, {\n\t\tkey: options.key,\n\t\tget: ({ get }) => {\n\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\t// @ts-expect-error finicky\n\t\t\t\tacc[key] = get(atoms[options.key + capitalize(key) + `State`])\n\t\t\t\treturn acc\n\t\t\t}, {} as any)\n\t\t},\n\t})\n\treturn [atoms, structState]\n}\n","import type * as AtomIO from \"atom.io\"\nimport {\n\tcapitalize,\n\tcreateRegularAtomFamily,\n\tcreateSelectorFamily,\n\tIMPLICIT,\n} from \"atom.io/internal\"\n\nconst nameFamily = (topKey: string, subKey: string) =>\n\t`find` + capitalize(topKey) + capitalize(subKey) + `State`\n\nexport function structFamily<\n\tStruct extends object,\n\tKey extends string,\n>(options: {\n\tkey: Key\n\tdefault: Struct\n}): [\n\t{\n\t\t[K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomFamilyToken<Struct[K], string>\n\t},\n\tAtomIO.ReadonlyPureSelectorFamilyToken<Struct, string>,\n] {\n\tconst atoms: {\n\t\t[K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomFamilyToken<Struct[K], string>\n\t} = Object.keys(options.default).reduce((acc, subKey) => {\n\t\tconst atomFamilyName = nameFamily(options.key, subKey)\n\t\tacc[atomFamilyName] = createRegularAtomFamily(IMPLICIT.STORE, {\n\t\t\tkey: `${options.key}.${subKey}`,\n\t\t\tdefault: (options.default as any)[subKey],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState: AtomIO.ReadonlyPureSelectorFamilyToken<Struct, string> =\n\t\tcreateSelectorFamily(IMPLICIT.STORE, {\n\t\t\tkey: options.key,\n\t\t\tget:\n\t\t\t\t(id) =>\n\t\t\t\t({ find, get }) => {\n\t\t\t\t\treturn Object.keys(options.default).reduce((acc, subKey) => {\n\t\t\t\t\t\tacc[subKey] = get(\n\t\t\t\t\t\t\tfind((atoms as any)[nameFamily(options.key, subKey)], id),\n\t\t\t\t\t\t)\n\t\t\t\t\t\treturn acc\n\t\t\t\t\t}, {} as any)\n\t\t\t\t},\n\t\t})\n\treturn [atoms, findStructState]\n}\n"],"mappings":";;;AASA,SAAgB,KACfA,QAIAC,OAIAC,QAAe,SAAS,OAC+C;AACvE,QAAO,yBAAyB,OAAO;EACtC,KAAK,GAAG,OAAO,IAAI,IAAI,CAAC;EACxB,KAAK,CAAC,EAAE,KAAK,KAAK;GACjB,MAAM,OAAO,IAAI,MAAM;AACvB,UAAO,KAAK,OAAO,CAAC,KAAK,QAAQ;
|
|
1
|
+
{"version":3,"file":"index.js","names":["family:\n\t\t| AtomIO.ReadonlyPureSelectorFamilyToken<State, Key>\n\t\t| AtomIO.RegularAtomFamilyToken<State, Key>\n\t\t| AtomIO.WritablePureSelectorFamilyToken<State, Key>","index:\n\t\t| AtomIO.ReadonlyPureSelectorToken<Key[]>\n\t\t| AtomIO.RegularAtomToken<Key[]>\n\t\t| AtomIO.WritablePureSelectorToken<Key[]>","store: Store","options: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t}","store: Store","atoms: {\n\t\t[K in keyof Struct as `${Key}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomToken<Struct[K]>\n\t}","topKey: string","subKey: string","options: {\n\tkey: Key\n\tdefault: Struct\n}","atoms: {\n\t\t[K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomFamilyToken<Struct[K], string>\n\t}","findStructState: AtomIO.ReadonlyPureSelectorFamilyToken<Struct, string>"],"sources":["../../src/data/dict.ts","../../src/data/struct.ts","../../src/data/struct-family.ts"],"sourcesContent":["import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport {\n\tcreateStandaloneSelector,\n\tfindInStore,\n\tIMPLICIT,\n} from \"atom.io/internal\"\nimport type { Canonical, stringified } from \"atom.io/json\"\n\nexport function dict<State, Key extends Canonical>(\n\tfamily:\n\t\t| AtomIO.ReadonlyPureSelectorFamilyToken<State, Key>\n\t\t| AtomIO.RegularAtomFamilyToken<State, Key>\n\t\t| AtomIO.WritablePureSelectorFamilyToken<State, Key>,\n\tindex:\n\t\t| AtomIO.ReadonlyPureSelectorToken<Key[]>\n\t\t| AtomIO.RegularAtomToken<Key[]>\n\t\t| AtomIO.WritablePureSelectorToken<Key[]>,\n\tstore: Store = IMPLICIT.STORE,\n): AtomIO.ReadonlyPureSelectorToken<{ [K in stringified<Key>]: State }> {\n\treturn createStandaloneSelector(store, {\n\t\tkey: `${family.key}Dict`,\n\t\tget: ({ get }) => {\n\t\t\tconst keys = get(index)\n\t\t\treturn keys.reduce((acc, key) => {\n\t\t\t\tacc[key] = get(findInStore(store, family, key))\n\t\t\t\treturn acc\n\t\t\t}, {} as any)\n\t\t},\n\t})\n}\n","import type * as AtomIO from \"atom.io\"\nimport type { Store } from \"atom.io/internal\"\nimport {\n\tcapitalize,\n\tcreateRegularAtom,\n\tcreateStandaloneSelector,\n\tIMPLICIT,\n} from \"atom.io/internal\"\n\nexport function struct<\n\tStruct extends { [key: string]: unknown },\n\tKey extends string,\n>(\n\toptions: {\n\t\tkey: Key\n\t\tdefault: Struct\n\t},\n\tstore: Store = IMPLICIT.STORE,\n): [\n\t{\n\t\t[K in keyof Struct as `${Key}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomToken<Struct[K]>\n\t},\n\tAtomIO.ReadonlyPureSelectorToken<Struct>,\n] {\n\tconst atoms: {\n\t\t[K in keyof Struct as `${Key}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomToken<Struct[K]>\n\t} = Object.keys(options.default).reduce((acc, key) => {\n\t\tconst atomName = options.key + capitalize(key) + `State`\n\t\tacc[atomName] = createRegularAtom(\n\t\t\tstore,\n\t\t\t{\n\t\t\t\tkey: `${options.key}.${key}`,\n\t\t\t\tdefault: options.default[key],\n\t\t\t},\n\t\t\tundefined,\n\t\t)\n\t\treturn acc\n\t}, {} as any)\n\tconst structState = createStandaloneSelector(store, {\n\t\tkey: options.key,\n\t\tget: ({ get }) => {\n\t\t\treturn Object.keys(options.default).reduce((acc, key) => {\n\t\t\t\t// @ts-expect-error finicky\n\t\t\t\tacc[key] = get(atoms[options.key + capitalize(key) + `State`])\n\t\t\t\treturn acc\n\t\t\t}, {} as any)\n\t\t},\n\t})\n\treturn [atoms, structState]\n}\n","import type * as AtomIO from \"atom.io\"\nimport {\n\tcapitalize,\n\tcreateRegularAtomFamily,\n\tcreateSelectorFamily,\n\tIMPLICIT,\n} from \"atom.io/internal\"\n\nconst nameFamily = (topKey: string, subKey: string) =>\n\t`find` + capitalize(topKey) + capitalize(subKey) + `State`\n\nexport function structFamily<\n\tStruct extends object,\n\tKey extends string,\n>(options: {\n\tkey: Key\n\tdefault: Struct\n}): [\n\t{\n\t\t[K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomFamilyToken<Struct[K], string>\n\t},\n\tAtomIO.ReadonlyPureSelectorFamilyToken<Struct, string>,\n] {\n\tconst atoms: {\n\t\t[K in keyof Struct as `find${Capitalize<Key & string>}${Capitalize<\n\t\t\tK & string\n\t\t>}State`]: AtomIO.RegularAtomFamilyToken<Struct[K], string>\n\t} = Object.keys(options.default).reduce((acc, subKey) => {\n\t\tconst atomFamilyName = nameFamily(options.key, subKey)\n\t\tacc[atomFamilyName] = createRegularAtomFamily(IMPLICIT.STORE, {\n\t\t\tkey: `${options.key}.${subKey}`,\n\t\t\tdefault: (options.default as any)[subKey],\n\t\t})\n\t\treturn acc\n\t}, {} as any)\n\tconst findStructState: AtomIO.ReadonlyPureSelectorFamilyToken<Struct, string> =\n\t\tcreateSelectorFamily(IMPLICIT.STORE, {\n\t\t\tkey: options.key,\n\t\t\tget:\n\t\t\t\t(id) =>\n\t\t\t\t({ find, get }) => {\n\t\t\t\t\treturn Object.keys(options.default).reduce((acc, subKey) => {\n\t\t\t\t\t\tacc[subKey] = get(\n\t\t\t\t\t\t\tfind((atoms as any)[nameF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W,OAAO,GAAG,WAAW,OAAO,GAAG,CAAC,KAAK,CAAC;AAE3D,SAAgB,aAGdC,SAUA;CACD,MAAMC,QAIF,OAAO,KAAK,QAAQ,QAAQ,CAAC,OAAO,CAAC,KAAK,WAAW;EACxD,MAAM,iBAAiB,WAAW,QAAQ,KAAK,OAAO;EACtD,IAAI,kBAAkB,wBAAwB,SAAS,OAAO;GAC7D,KAAK,GAAG,QAAQ,IAAI,CAAC,EAAE,QAAQ;GAC/B,SAAU,QAAQ,QAAgB;EAClC,EAAC;AACF,SAAO;CACP,GAAE,CAAE,EAAQ;CACb,MAAMC,kBACL,qBAAqB,SAAS,OAAO;EACpC,KAAK,QAAQ;EACb,KACC,CAAC,OACD,CAAC,EAAE,MAAM,KAAK,KAAK;AAClB,UAAO,OAAO,KAAK,QAAQ,QAAQ,CAAC,OAAO,CAAC,KAAK,WAAW;IAC3D,IAAI,UAAU,IACb,KAAM,MAAc,WAAW,QAAQ,KAAK,OAAO,GAAG,GAAG,CACzD;AACD,WAAO;GACP,GAAE,CAAE,EAAQ;EACb;CACF,EAAC;AACH,QAAO,CAAC,OAAO,eAAgB;AAC/B"}
|
|
@@ -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,k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MC,SAAwB,EAC7B,OAAO;CACN;CACA;AACA,EACD;AAED,4BAAe"}
|
|
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,CAAC;CAAE,CAAC,cAAc,CAAC;AAAC;AAE5E,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,EAAE;AAClB,SAAI,gBAAgB,SAAS,OAAO,KAAK,EACxC;UAAI,CAAC,KAAK,eACT,QAAQ,OAAO;OACd;OACA,WAAW,CAAC,cAAc,CAAC;MAC3B,EAAC;KACF;AAEF;IACA;IACD,KAAK,CAAC,gBAAgB,CAAC,CACtB,KACC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,YAAY;AACZ;MACD,KAAK,CAAC,cAAc,CAAC,CACpB,KAAI,WAAW;OACd,IAAI,aAAa;AACjB,eAAQ,EAAE,OAAO,MAAjB;QACC,KAAK,CAAC,gBAAgB,CAAC;AACtB,aACC,EAAE,OAAO,OAAO,SAAS,CAAC,UAAU,CAAC,IACrC,EAAE,OAAO,OAAO,SACf,kCACD,EAAE,OAAO,SAAS,SAAS,CAAC,UAAU,CAAC,IACvC,EAAE,OAAO,SAAS,SAAS,CAAC,GAAG,CAAC,EAEhC,aAAa;AAEd;QACD,KAAK,CAAC,UAAU,CAAC;AAChB,aAAI,EAAE,OAAO,SAAS,CAAC,GAAG,CAAC,EAC1B,aAAa;AAEd;OACD;AACD,WAAI,YACH,QAAQ,OAAO;QACd,MAAM;QACN,SAAS,CAAC,+DAA+D,CAAC;OAC1E,EAAC;MAEH;KACF;IACD,EAAC;GACF;EACD,EACD;CACD;AACD;;;;;;;;;;;;AErID,MAAMC,SAAwB,EAC7B,OAAO;CACN;CACA;AACA,EACD;AAED,4BAAe"}
|
package/dist/internal/index.js
CHANGED
|
@@ -245,7 +245,7 @@ var Junction = class {
|
|
|
245
245
|
this.replaceRelationsUnsafely = (a, bs) => {
|
|
246
246
|
externalStore.replaceRelationsUnsafely(a, bs);
|
|
247
247
|
};
|
|
248
|
-
this.getRelatedKeys = (key) => externalStore.getRelatedKeys(key);
|
|
248
|
+
this.getRelatedKeys = ((key) => externalStore.getRelatedKeys(key));
|
|
249
249
|
if (externalStore.getContent) {
|
|
250
250
|
this.getContentInternal = (contentKey) => {
|
|
251
251
|
return externalStore.getContent(contentKey);
|
|
@@ -781,7 +781,7 @@ const registerSelector = (store, selectorType, selectorKey, covered) => ({
|
|
|
781
781
|
updateSelectorAtoms(store, selectorType, selectorKey, dependency, covered);
|
|
782
782
|
return dependencyValue;
|
|
783
783
|
},
|
|
784
|
-
set: (...params) => {
|
|
784
|
+
set: ((...params) => {
|
|
785
785
|
let token;
|
|
786
786
|
let value;
|
|
787
787
|
if (params.length === 2) {
|
|
@@ -796,8 +796,8 @@ const registerSelector = (store, selectorType, selectorKey, covered) => ({
|
|
|
796
796
|
const target = newest(store);
|
|
797
797
|
const state = withdraw(target, token);
|
|
798
798
|
setAtomOrSelector(target, state, value);
|
|
799
|
-
},
|
|
800
|
-
find: (...args) => findInStore(store, ...args),
|
|
799
|
+
}),
|
|
800
|
+
find: ((...args) => findInStore(store, ...args)),
|
|
801
801
|
json: (token) => getJsonToken(store, token)
|
|
802
802
|
});
|
|
803
803
|
|
|
@@ -1132,8 +1132,8 @@ function createReadonlyPureSelectorFamily(store, options, internalRoles) {
|
|
|
1132
1132
|
default: (key) => {
|
|
1133
1133
|
const getFn = options.get(key);
|
|
1134
1134
|
return getFn({
|
|
1135
|
-
get: (...args) => getFromStore(store, ...args),
|
|
1136
|
-
find: (...args) => findInStore(store, ...args),
|
|
1135
|
+
get: ((...args) => getFromStore(store, ...args)),
|
|
1136
|
+
find: ((...args) => findInStore(store, ...args)),
|
|
1137
1137
|
json: (token) => getJsonToken(store, token)
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
@@ -1263,8 +1263,8 @@ function createWritablePureSelectorFamily(store, options, internalRoles) {
|
|
|
1263
1263
|
default: (key) => {
|
|
1264
1264
|
const getFn = options.get(key);
|
|
1265
1265
|
return getFn({
|
|
1266
|
-
get: (...args) => getFromStore(store, ...args),
|
|
1267
|
-
find: (...args) => findInStore(store, ...args),
|
|
1266
|
+
get: ((...args) => getFromStore(store, ...args)),
|
|
1267
|
+
find: ((...args) => findInStore(store, ...args)),
|
|
1268
1268
|
json: (token) => getJsonToken(store, token)
|
|
1269
1269
|
});
|
|
1270
1270
|
}
|
|
@@ -1905,16 +1905,16 @@ const buildTransaction = (store, key, params, id) => {
|
|
|
1905
1905
|
output: void 0
|
|
1906
1906
|
},
|
|
1907
1907
|
toolkit: {
|
|
1908
|
-
get: (...ps) => getFromStore(child, ...ps),
|
|
1909
|
-
set: (...ps) => {
|
|
1908
|
+
get: ((...ps) => getFromStore(child, ...ps)),
|
|
1909
|
+
set: ((...ps) => {
|
|
1910
1910
|
setIntoStore(child, ...ps);
|
|
1911
|
-
},
|
|
1911
|
+
}),
|
|
1912
1912
|
run: (token, identifier = arbitrary()) => actUponStore(child, token, identifier),
|
|
1913
|
-
find: (...ps) => findInStore(store, ...ps),
|
|
1913
|
+
find: ((...ps) => findInStore(store, ...ps)),
|
|
1914
1914
|
json: (token) => getJsonToken(child, token),
|
|
1915
|
-
dispose: (...ps) => {
|
|
1915
|
+
dispose: ((...ps) => {
|
|
1916
1916
|
disposeFromStore(child, ...ps);
|
|
1917
|
-
},
|
|
1917
|
+
}),
|
|
1918
1918
|
env: () => getEnvironmentData(child)
|
|
1919
1919
|
}
|
|
1920
1920
|
};
|
|
@@ -1927,11 +1927,13 @@ const buildTransaction = (store, key, params, id) => {
|
|
|
1927
1927
|
//#endregion
|
|
1928
1928
|
//#region src/internal/transaction/create-transaction.ts
|
|
1929
1929
|
function createTransaction(store, options) {
|
|
1930
|
+
const { key } = options;
|
|
1931
|
+
const transactionAlreadyExists = store.transactions.has(key);
|
|
1930
1932
|
const newTransaction = {
|
|
1931
|
-
key
|
|
1933
|
+
key,
|
|
1932
1934
|
type: `transaction`,
|
|
1933
1935
|
run: (params, id) => {
|
|
1934
|
-
const childStore = buildTransaction(store,
|
|
1936
|
+
const childStore = buildTransaction(store, key, params, id);
|
|
1935
1937
|
try {
|
|
1936
1938
|
const target$1 = newest(store);
|
|
1937
1939
|
const { toolkit } = childStore.transactionMeta;
|
|
@@ -1940,7 +1942,7 @@ function createTransaction(store, options) {
|
|
|
1940
1942
|
return output;
|
|
1941
1943
|
} catch (thrown) {
|
|
1942
1944
|
abortTransaction(target);
|
|
1943
|
-
store.logger.warn(`💥`, `transaction`,
|
|
1945
|
+
store.logger.warn(`💥`, `transaction`, key, `caught:`, thrown);
|
|
1944
1946
|
throw thrown;
|
|
1945
1947
|
}
|
|
1946
1948
|
},
|
|
@@ -1948,9 +1950,9 @@ function createTransaction(store, options) {
|
|
|
1948
1950
|
subject: new Subject()
|
|
1949
1951
|
};
|
|
1950
1952
|
const target = newest(store);
|
|
1951
|
-
target.transactions.set(
|
|
1953
|
+
target.transactions.set(key, newTransaction);
|
|
1952
1954
|
const token = deposit(newTransaction);
|
|
1953
|
-
store.on.transactionCreation.next(token);
|
|
1955
|
+
if (!transactionAlreadyExists) store.on.transactionCreation.next(token);
|
|
1954
1956
|
return token;
|
|
1955
1957
|
}
|
|
1956
1958
|
|
|
@@ -2775,11 +2777,11 @@ var Join = class {
|
|
|
2775
2777
|
this.store.miscResources.set(`join:${options.key}`, this);
|
|
2776
2778
|
this.realm.allocate(`root`, options.key);
|
|
2777
2779
|
this.toolkit = {
|
|
2778
|
-
get: (...ps) => getFromStore(store, ...ps),
|
|
2779
|
-
set: (...ps) => {
|
|
2780
|
+
get: ((...ps) => getFromStore(store, ...ps)),
|
|
2781
|
+
set: ((...ps) => {
|
|
2780
2782
|
setIntoStore(store, ...ps);
|
|
2781
|
-
},
|
|
2782
|
-
find: (...ps) => findInStore(store, ...ps),
|
|
2783
|
+
}),
|
|
2784
|
+
find: ((...ps) => findInStore(store, ...ps)),
|
|
2783
2785
|
json: (token) => getJsonToken(store, token)
|
|
2784
2786
|
};
|
|
2785
2787
|
const aSide = options.between[0];
|