From eef3a75530e92e7edfcec4e207738798964cf734 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 18:01:49 +0100 Subject: [PATCH] chore(deps): update all devdependencies (#11321) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lenz Weber-Tronic Co-authored-by: phryneas --- .api-reports/api-report-core.md | 2 +- .api-reports/api-report-react.md | 14 +- .api-reports/api-report-react_components.md | 12 +- .api-reports/api-report-react_context.md | 12 +- .api-reports/api-report-react_hoc.md | 12 +- .api-reports/api-report-react_hooks.md | 14 +- .api-reports/api-report-react_ssr.md | 12 +- .api-reports/api-report-testing.md | 12 +- .api-reports/api-report-testing_core.md | 12 +- .api-reports/api-report-utilities.md | 12 +- .api-reports/api-report.md | 4 +- .prettierrc | 3 +- .size-limit.cjs | 34 +- .size-limits.json | 4 +- config/prepareChangesetsRelease.ts | 6 +- .../require-using-disposable.ts | 10 +- integration-tests/cra4/src/App.tsx | 10 +- integration-tests/cra5/src/App.tsx | 10 +- integration-tests/vite-swc/src/App.tsx | 10 +- integration-tests/vite/src/App.tsx | 10 +- package-lock.json | 557 ++++++++++++------ package.json | 26 +- scripts/codemods/ac2-to-ac3/imports.js | 4 +- src/cache/core/cache.ts | 8 +- src/cache/core/types/common.ts | 20 +- src/cache/inmemory/__tests__/readFromStore.ts | 12 +- src/cache/inmemory/entityStore.ts | 64 +- src/cache/inmemory/helpers.ts | 21 +- src/cache/inmemory/inMemoryCache.ts | 14 +- src/cache/inmemory/key-extractor.ts | 4 +- src/cache/inmemory/object-canon.ts | 4 +- src/cache/inmemory/policies.ts | 73 +-- src/cache/inmemory/readFromStore.ts | 15 +- src/cache/inmemory/writeToStore.ts | 75 +-- src/core/ApolloClient.ts | 10 +- src/core/LocalState.ts | 5 +- src/core/ObservableQuery.ts | 55 +- src/core/QueryInfo.ts | 10 +- src/core/QueryManager.ts | 47 +- src/core/__tests__/QueryManager/index.ts | 5 +- src/core/__tests__/fetchPolicies.ts | 11 +- src/core/types.ts | 44 +- src/link/core/ApolloLink.ts | 8 +- src/link/http/parseAndCheckHttpResponse.ts | 11 +- src/link/persisted-queries/index.ts | 5 +- .../removeTypenameFromVariables.ts | 15 +- src/link/schema/index.ts | 6 +- src/link/utils/transformOperation.ts | 6 +- .../__tests__/client/Query.test.tsx | 20 +- src/react/context/ApolloContext.ts | 5 +- .../__tests__/queries/recomposeWithState.ts | 6 +- .../__tests__/ssr/getDataFromTree.test.tsx | 72 +-- src/react/hoc/mutation-hoc.tsx | 5 +- src/react/hoc/query-hoc.tsx | 5 +- src/react/hoc/subscription-hoc.tsx | 5 +- src/react/hoc/withApollo.tsx | 5 +- .../__tests__/useBackgroundQuery.test.tsx | 56 +- .../hooks/__tests__/useFragment.test.tsx | 46 +- .../hooks/__tests__/useMutation.test.tsx | 5 +- src/react/hooks/__tests__/useQuery.test.tsx | 9 +- .../hooks/__tests__/useSuspenseQuery.test.tsx | 96 ++- .../internal/useIsomorphicLayoutEffect.ts | 5 +- src/react/hooks/useBackgroundQuery.ts | 13 +- src/react/hooks/useFragment.ts | 8 +- src/react/hooks/useLazyQuery.ts | 5 +- src/react/hooks/useMutation.ts | 6 +- src/react/hooks/useQuery.ts | 4 +- src/react/hooks/useSubscription.ts | 12 +- src/react/hooks/useSuspenseQuery.ts | 25 +- src/react/parser/index.ts | 7 +- src/react/ssr/getDataFromTree.ts | 4 +- src/testing/core/mocking/mockFetch.ts | 9 +- src/testing/core/mocking/mockLink.ts | 21 +- src/testing/internal/profile/Render.tsx | 12 +- src/testing/internal/profile/profile.tsx | 38 +- src/testing/internal/profile/traces.ts | 8 +- src/testing/matchers/ProfiledComponent.ts | 6 +- src/testing/matchers/index.d.ts | 34 +- src/testing/react/MockedProvider.tsx | 10 +- src/utilities/common/errorHandling.ts | 5 +- src/utilities/common/mergeDeep.ts | 19 +- src/utilities/globals/invariantWrappers.ts | 6 +- src/utilities/graphql/DocumentTransform.ts | 5 +- .../graphql/__tests__/DocumentTransform.ts | 4 +- src/utilities/graphql/storeUtils.ts | 5 +- src/utilities/graphql/transform.ts | 17 +- .../observables/__tests__/asyncMap.ts | 22 +- src/utilities/observables/asyncMap.ts | 6 +- src/utilities/policies/pagination.ts | 5 +- src/utilities/types/DeepOmit.ts | 16 +- src/utilities/types/DeepPartial.ts | 34 +- src/utilities/types/IsStrictlyAny.ts | 11 +- 92 files changed, 1126 insertions(+), 941 deletions(-) diff --git a/.api-reports/api-report-core.md b/.api-reports/api-report-core.md index 2204a1a7244..7dd6cb37a62 100644 --- a/.api-reports/api-report-core.md +++ b/.api-reports/api-report-core.md @@ -2103,7 +2103,7 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/ObservableQuery.ts:114:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:117:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:150:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:379:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:380:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts // src/core/watchQueryOptions.ts:253:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-react.md b/.api-reports/api-report-react.md index e14e278cc70..851130e8f65 100644 --- a/.api-reports/api-report-react.md +++ b/.api-reports/api-report-react.md @@ -629,7 +629,7 @@ interface DataProxy { // Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends ReadonlyArray ? TItem[] extends T ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; // Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts // @@ -2140,15 +2140,15 @@ interface WatchQueryOptions = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends ReadonlyArray ? TItem[] extends T ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; // Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts // @@ -2031,15 +2031,15 @@ interface WatchQueryOptions(it: (...args: TArgs // src/core/ObservableQuery.ts:114:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:117:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:150:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:379:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts -// src/core/types.ts:158:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts -// src/core/types.ts:160:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts -// src/core/types.ts:178:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts -// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:380:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:154:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts +// src/core/types.ts:156:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts +// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:201:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts // src/core/watchQueryOptions.ts:253:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts -// src/utilities/graphql/DocumentTransform.ts:122:7 - (ae-forgotten-export) The symbol "DocumentTransformCacheKey" needs to be exported by the entry point index.d.ts +// src/utilities/graphql/DocumentTransform.ts:121:7 - (ae-forgotten-export) The symbol "DocumentTransformCacheKey" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-testing_core.md b/.api-reports/api-report-testing_core.md index 01cd92a9a0e..71f9db61e0c 100644 --- a/.api-reports/api-report-testing_core.md +++ b/.api-reports/api-report-testing_core.md @@ -1564,13 +1564,13 @@ export function withWarningSpy(it: (...args: TArgs // src/core/ObservableQuery.ts:114:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:117:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:150:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:379:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts -// src/core/types.ts:158:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts -// src/core/types.ts:160:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts -// src/core/types.ts:178:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts -// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:380:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:154:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts +// src/core/types.ts:156:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts +// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:201:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts // src/core/watchQueryOptions.ts:253:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts -// src/utilities/graphql/DocumentTransform.ts:122:7 - (ae-forgotten-export) The symbol "DocumentTransformCacheKey" needs to be exported by the entry point index.d.ts +// src/utilities/graphql/DocumentTransform.ts:121:7 - (ae-forgotten-export) The symbol "DocumentTransformCacheKey" needs to be exported by the entry point index.d.ts // (No @packageDocumentation comment for this package) diff --git a/.api-reports/api-report-utilities.md b/.api-reports/api-report-utilities.md index 51443cf5eda..46a9d71f9dd 100644 --- a/.api-reports/api-report-utilities.md +++ b/.api-reports/api-report-utilities.md @@ -637,7 +637,7 @@ type DeepOmitPrimitive = Primitive | Function; // Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts // // @public (undocumented) -export type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends ReadonlyArray ? TItem[] extends T ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; +export type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; // @public (undocumented) type DeepPartialMap = {} & Map, DeepPartial>; @@ -2445,11 +2445,11 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/ObservableQuery.ts:114:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:117:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:150:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:379:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts -// src/core/types.ts:158:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts -// src/core/types.ts:160:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts -// src/core/types.ts:178:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts -// src/core/types.ts:205:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:380:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/types.ts:154:3 - (ae-forgotten-export) The symbol "ApolloError" needs to be exported by the entry point index.d.ts +// src/core/types.ts:156:3 - (ae-forgotten-export) The symbol "NetworkStatus" needs to be exported by the entry point index.d.ts +// src/core/types.ts:174:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts +// src/core/types.ts:201:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts // src/core/watchQueryOptions.ts:253:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/utilities/graphql/storeUtils.ts:220:12 - (ae-forgotten-export) The symbol "stringify" needs to be exported by the entry point index.d.ts // src/utilities/policies/pagination.ts:76:3 - (ae-forgotten-export) The symbol "TRelayEdge" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report.md b/.api-reports/api-report.md index 914be34a71e..77f78c50806 100644 --- a/.api-reports/api-report.md +++ b/.api-reports/api-report.md @@ -628,7 +628,7 @@ export interface DataProxy { // Warning: (ae-forgotten-export) The symbol "DeepPartialObject" needs to be exported by the entry point index.d.ts // // @public (undocumented) -type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends ReadonlyArray ? TItem[] extends T ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; +type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map ? DeepPartialMap : T extends ReadonlyMap ? DeepPartialReadonlyMap : T extends Set ? DeepPartialSet : T extends ReadonlySet ? DeepPartialReadonlySet : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray> : Array> : DeepPartialObject : DeepPartialObject : unknown; // Warning: (ae-forgotten-export) The symbol "DeepPartial" needs to be exported by the entry point index.d.ts // @@ -2787,7 +2787,7 @@ interface WriteContext extends ReadMergeModifyContext { // src/core/ObservableQuery.ts:114:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:117:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts // src/core/QueryManager.ts:150:5 - (ae-forgotten-export) The symbol "LocalState" needs to be exported by the entry point index.d.ts -// src/core/QueryManager.ts:379:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts +// src/core/QueryManager.ts:380:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts // src/core/watchQueryOptions.ts:253:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts // src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts // src/react/hooks/useBackgroundQuery.ts:26:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts diff --git a/.prettierrc b/.prettierrc index c21d016783a..e2511027712 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,5 +4,6 @@ "semi": true, "singleQuote": false, "tabWidth": 2, - "trailingComma": "es5" + "trailingComma": "es5", + "experimentalTernaries": true } diff --git a/.size-limit.cjs b/.size-limit.cjs index a519fd10994..5d8c63f865d 100644 --- a/.size-limit.cjs +++ b/.size-limit.cjs @@ -27,9 +27,9 @@ const checks = [ .map((config) => ({ ...config, name: - config.name || config.import - ? `import ${config.import} from "${config.path}"` - : config.path, + config.name || config.import ? + `import ${config.import} from "${config.path}"` + : config.path, // newer versions of size-limit changed to brotli as a default // we'll stay on gzip for now, so results are easier to compare gzip: true, @@ -54,21 +54,21 @@ const checks = [ ], })) .flatMap((value) => - value.path == "dist/apollo-client.min.cjs" - ? value - : [ - value, - { - ...value, - name: `${value.name} (production)`, - modifyEsbuildConfig(config) { - config.define = { - "globalThis.__DEV__": `false`, - }; - return config; - }, + value.path == "dist/apollo-client.min.cjs" ? + value + : [ + value, + { + ...value, + name: `${value.name} (production)`, + modifyEsbuildConfig(config) { + config.define = { + "globalThis.__DEV__": `false`, + }; + return config; }, - ] + }, + ] ) .map((value) => { value.limit = limits[value.name]; diff --git a/.size-limits.json b/.size-limits.json index f71b98fe37c..2b7fa71c6e3 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 37975, - "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32019 + "dist/apollo-client.min.cjs": 37973, + "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32022 } diff --git a/config/prepareChangesetsRelease.ts b/config/prepareChangesetsRelease.ts index d24a28a4c06..171503939b0 100644 --- a/config/prepareChangesetsRelease.ts +++ b/config/prepareChangesetsRelease.ts @@ -30,9 +30,9 @@ function copyDir(src: string, dest: string) { let srcPath = path.join(src, entry.name); let destPath = path.join(dest, entry.name); - entry.isDirectory() - ? copyDir(srcPath, destPath) - : fs.copyFileSync(srcPath, destPath); + entry.isDirectory() ? + copyDir(srcPath, destPath) + : fs.copyFileSync(srcPath, destPath); } } diff --git a/eslint-local-rules/require-using-disposable.ts b/eslint-local-rules/require-using-disposable.ts index 35489c166a3..efeb5cce7b6 100644 --- a/eslint-local-rules/require-using-disposable.ts +++ b/eslint-local-rules/require-using-disposable.ts @@ -55,9 +55,9 @@ export const rule = ESLintUtils.RuleCreator.withoutDocs({ }); function parts(type: ts.Type): ts.Type[] { - return type.isUnion() - ? utils.unionTypeParts(type).flatMap(parts) - : type.isIntersection() - ? utils.intersectionTypeParts(type).flatMap(parts) - : [type]; + return ( + type.isUnion() ? utils.unionTypeParts(type).flatMap(parts) + : type.isIntersection() ? utils.intersectionTypeParts(type).flatMap(parts) + : [type] + ); } diff --git a/integration-tests/cra4/src/App.tsx b/integration-tests/cra4/src/App.tsx index cf87849afbd..189ee26af73 100644 --- a/integration-tests/cra4/src/App.tsx +++ b/integration-tests/cra4/src/App.tsx @@ -55,9 +55,9 @@ export default function App() { function Main() { const { data } = useQuery(QUERY); - return data ? ( -
    {data?.products.map(({ id, title }) =>
  • {title}
  • )}
- ) : ( - <>loading - ); + return data ? +
    + {data?.products.map(({ id, title }) =>
  • {title}
  • )} +
+ : <>loading; } diff --git a/integration-tests/cra5/src/App.tsx b/integration-tests/cra5/src/App.tsx index cf87849afbd..189ee26af73 100644 --- a/integration-tests/cra5/src/App.tsx +++ b/integration-tests/cra5/src/App.tsx @@ -55,9 +55,9 @@ export default function App() { function Main() { const { data } = useQuery(QUERY); - return data ? ( -
    {data?.products.map(({ id, title }) =>
  • {title}
  • )}
- ) : ( - <>loading - ); + return data ? +
    + {data?.products.map(({ id, title }) =>
  • {title}
  • )} +
+ : <>loading; } diff --git a/integration-tests/vite-swc/src/App.tsx b/integration-tests/vite-swc/src/App.tsx index cf87849afbd..189ee26af73 100644 --- a/integration-tests/vite-swc/src/App.tsx +++ b/integration-tests/vite-swc/src/App.tsx @@ -55,9 +55,9 @@ export default function App() { function Main() { const { data } = useQuery(QUERY); - return data ? ( -
    {data?.products.map(({ id, title }) =>
  • {title}
  • )}
- ) : ( - <>loading - ); + return data ? +
    + {data?.products.map(({ id, title }) =>
  • {title}
  • )} +
+ : <>loading; } diff --git a/integration-tests/vite/src/App.tsx b/integration-tests/vite/src/App.tsx index cf87849afbd..189ee26af73 100644 --- a/integration-tests/vite/src/App.tsx +++ b/integration-tests/vite/src/App.tsx @@ -55,9 +55,9 @@ export default function App() { function Main() { const { data } = useQuery(QUERY); - return data ? ( -
    {data?.products.map(({ id, title }) =>
  • {title}
  • )}
- ) : ( - <>loading - ); + return data ? +
    + {data?.products.map(({ id, title }) =>
  • {title}
  • )} +
+ : <>loading; } diff --git a/package-lock.json b/package-lock.json index 72fcd868a38..7100340c794 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "zen-observable-ts": "^1.2.5" }, "devDependencies": { - "@arethetypeswrong/cli": "0.12.2", + "@arethetypeswrong/cli": "0.13.2", "@babel/parser": "7.23.4", "@changesets/changelog-github": "0.4.8", "@changesets/cli": "2.26.2", @@ -35,7 +35,7 @@ "@size-limit/esbuild-why": "11.0.0", "@size-limit/preset-small-lib": "11.0.0", "@testing-library/jest-dom": "6.1.4", - "@testing-library/react": "14.0.0", + "@testing-library/react": "14.1.2", "@testing-library/react-12": "npm:@testing-library/react@^12", "@testing-library/user-event": "14.5.1", "@tsconfig/node20": "20.1.2", @@ -45,21 +45,21 @@ "@types/hoist-non-react-statics": "3.3.5", "@types/jest": "29.5.10", "@types/lodash": "4.14.202", - "@types/node": "20.8.10", + "@types/node": "20.10.0", "@types/node-fetch": "2.6.9", "@types/react": "18.2.38", "@types/react-dom": "18.2.17", "@types/use-sync-external-store": "0.0.6", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", - "@typescript-eslint/rule-tester": "6.7.5", - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/utils": "6.7.5", - "acorn": "8.10.0", + "@typescript-eslint/eslint-plugin": "6.12.0", + "@typescript-eslint/parser": "6.12.0", + "@typescript-eslint/rule-tester": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/utils": "6.12.0", + "acorn": "8.11.2", "blob-polyfill": "7.0.20220408", "bytes": "3.1.2", "cross-fetch": "4.0.0", - "eslint": "8.51.0", + "eslint": "8.54.0", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-import": "npm:@phryneas/eslint-plugin-import@2.27.5-pr.2813.2817.199971c", "eslint-plugin-local-rules": "2.0.1", @@ -74,7 +74,7 @@ "jest-junit": "16.0.0", "lodash": "4.17.21", "patch-package": "8.0.0", - "prettier": "3.0.3", + "prettier": "3.1.0", "react": "18.2.0", "react-17": "npm:react@^17", "react-dom": "18.2.0", @@ -89,14 +89,14 @@ "rxjs": "7.8.1", "size-limit": "11.0.0", "subscriptions-transport-ws": "0.11.0", - "terser": "5.21.0", + "terser": "5.24.0", "ts-api-utils": "1.0.3", "ts-jest": "29.1.1", "ts-jest-resolver": "2.0.1", "ts-morph": "20.0.0", "ts-node": "10.9.1", "typedoc": "0.25.0", - "typescript": "5.2.2", + "typescript": "5.3.2", "wait-for-observables": "1.0.3", "web-streams-polyfill": "3.2.1", "whatwg-fetch": "3.6.19" @@ -148,22 +148,24 @@ "dev": true }, "node_modules/@arethetypeswrong/cli": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@arethetypeswrong/cli/-/cli-0.12.2.tgz", - "integrity": "sha512-SE4Rqy8LM8zgRLeVXZqFIOg4w4TCDG2AMguuZDDRcrUmVQj7phW0tWJnKwsZtyJ6SdqXTIzWvGYiUJiHg2hb9w==", + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@arethetypeswrong/cli/-/cli-0.13.2.tgz", + "integrity": "sha512-eqRWeFFiI58xwsiUfZSdZsmNCaqqtxmSPP9554ajiCDrB/aNzq5VktVK7dNiT9PamunNeoej4KbDBnkNwVacvg==", "dev": true, "dependencies": { - "@arethetypeswrong/core": "0.12.2", + "@arethetypeswrong/core": "0.13.2", "chalk": "^4.1.2", "cli-table3": "^0.6.3", "commander": "^10.0.1", - "marked": "^5.1.0", - "marked-terminal": "^5.2.0", - "node-fetch": "^2.6.4", + "marked": "^9.1.2", + "marked-terminal": "^6.0.0", "semver": "^7.5.4" }, "bin": { "attw": "dist/index.js" + }, + "engines": { + "node": ">=18" } }, "node_modules/@arethetypeswrong/cli/node_modules/commander": { @@ -176,9 +178,9 @@ } }, "node_modules/@arethetypeswrong/cli/node_modules/marked": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-5.1.2.tgz", - "integrity": "sha512-ahRPGXJpjMjwSOlBoTMZAK7ATXkli5qCPxZ21TG44rx1KEo44bii4ekgTDQPNRQ4Kh7JMb9Ub1PVk1NxRSsorg==", + "version": "9.1.6", + "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz", + "integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==", "dev": true, "bin": { "marked": "bin/marked.js" @@ -203,17 +205,19 @@ } }, "node_modules/@arethetypeswrong/core": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@arethetypeswrong/core/-/core-0.12.2.tgz", - "integrity": "sha512-ez/quGfC6RVg7VrwCgMVreJ01jbkfJQRNxOG7Bpl4YGcPRs45ZE1AzpHiIdzqfwFg9EBVSaewaffrsK5MVbALw==", + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@arethetypeswrong/core/-/core-0.13.2.tgz", + "integrity": "sha512-1l6ygar+6TH4o1JipWWGCEZlOhAwEShm1yKx+CgIByNjCzufbu6k9DNbDmBjdouusNRhBIOYQe1UHnJig+GtAw==", "dev": true, "dependencies": { "@andrewbranch/untar.js": "^1.0.3", - "fetch-ponyfill": "^7.1.0", "fflate": "^0.7.4", "semver": "^7.5.4", - "typescript": "^5.2.2", + "typescript": "5.3.2", "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": ">=18" } }, "node_modules/@arethetypeswrong/core/node_modules/semver": { @@ -1670,9 +1674,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -1738,9 +1742,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.51.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz", - "integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", + "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1807,12 +1811,12 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.11", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", - "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", + "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", "minimatch": "^3.0.5" }, @@ -1834,9 +1838,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, "node_modules/@isaacs/cliui": { @@ -2697,6 +2701,18 @@ "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, "node_modules/@sindresorhus/merge-streams": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-1.0.0.tgz", @@ -2910,9 +2926,9 @@ "dev": true }, "node_modules/@testing-library/react": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.0.0.tgz", - "integrity": "sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==", + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-14.1.2.tgz", + "integrity": "sha512-z4p7DVBTPjKM5qDZ0t5ZjzkpSNb+fZy1u6bzO7kk8oeGagpPCAtgh4cx1syrfp7a+QWkM021jGqjJaxJJnXAZg==", "dev": true, "dependencies": { "@babel/runtime": "^7.12.5", @@ -2967,18 +2983,18 @@ } }, "node_modules/@testing-library/react/node_modules/@testing-library/dom": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.0.0.tgz", - "integrity": "sha512-+/TLgKNFsYUshOY/zXsQOk+PlFQK+eyJ9T13IDVNJEi+M+Un7xlJK+FZKkbGSnf0+7E1G6PlDhkSYQ/GFiruBQ==", + "version": "9.3.3", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.3.tgz", + "integrity": "sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^5.0.1", - "aria-query": "^5.0.0", + "aria-query": "5.1.3", "chalk": "^4.1.0", "dom-accessibility-api": "^0.5.9", - "lz-string": "^1.4.4", + "lz-string": "^1.5.0", "pretty-format": "^27.0.2" }, "engines": { @@ -2986,9 +3002,9 @@ } }, "node_modules/@testing-library/react/node_modules/@types/aria-query": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", - "integrity": "sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "dev": true }, "node_modules/@testing-library/user-event": { @@ -3305,9 +3321,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.8.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz", - "integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==", + "version": "20.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz", + "integrity": "sha512-D0WfRmU9TQ8I9PFx9Yc+EBHw+vSpIub4IDvQivcp26PtPrdMGAq5SDcpXEo/epqa/DXotVpekHiLNTg3iaKXBQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3410,16 +3426,16 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.5.tgz", - "integrity": "sha512-JhtAwTRhOUcP96D0Y6KYnwig/MRQbOoLGXTON2+LlyB/N35SP9j1boai2zzwXb7ypKELXMx3DVk9UTaEq1vHEw==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.12.0.tgz", + "integrity": "sha512-XOpZ3IyJUIV1b15M7HVOpgQxPPF7lGXgsfcEIu3yDxFPaf/xZKt7s9QO/pbk7vpWQyVulpJbu4E5LwpZiQo4kA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.7.5", - "@typescript-eslint/type-utils": "6.7.5", - "@typescript-eslint/utils": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/type-utils": "6.12.0", + "@typescript-eslint/utils": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -3460,15 +3476,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.5.tgz", - "integrity": "sha512-bIZVSGx2UME/lmhLcjdVc7ePBwn7CLqKarUBL4me1C5feOd663liTGjMBGVcGr+BhnSLeP4SgwdvNnnkbIdkCw==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.12.0.tgz", + "integrity": "sha512-s8/jNFPKPNRmXEnNXfuo1gemBdVmpQsK1pcu+QIvuNJuhFzGrpD7WjOcvDc/+uEdfzSYpNu7U/+MmbScjoQ6vg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.7.5", - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/typescript-estree": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", "debug": "^4.3.4" }, "engines": { @@ -3488,13 +3504,13 @@ } }, "node_modules/@typescript-eslint/rule-tester": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/rule-tester/-/rule-tester-6.7.5.tgz", - "integrity": "sha512-rDUQDkMg577jA7U+2NFlgLv3S43epbjruLZ4MQaELhH+WZLmmGylFbcCWeonRmtFjF2Xd/lfYsjqQ+p61XZDkw==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/rule-tester/-/rule-tester-6.12.0.tgz", + "integrity": "sha512-O1kFPAuX9H63GNDTyd8GKO5RioxRX96mAVcevbUywVtkrp8eoVLEf2VmKIKCeYAM5oZst52DMVCQXjcQuyxq5w==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.7.5", - "@typescript-eslint/utils": "6.7.5", + "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/utils": "6.12.0", "ajv": "^6.10.0", "lodash.merge": "4.6.2", "semver": "^7.5.4" @@ -3527,13 +3543,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.5.tgz", - "integrity": "sha512-GAlk3eQIwWOJeb9F7MKQ6Jbah/vx1zETSDw8likab/eFcqkjSD7BI75SDAeC5N2L0MmConMoPvTsmkrg71+B1A==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz", + "integrity": "sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5" + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3544,13 +3560,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.5.tgz", - "integrity": "sha512-Gs0qos5wqxnQrvpYv+pf3XfcRXW6jiAn9zE/K+DlmYf6FcpxeNYN0AIETaPR7rHO4K2UY+D0CIbDP9Ut0U4m1g==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.12.0.tgz", + "integrity": "sha512-WWmRXxhm1X8Wlquj+MhsAG4dU/Blvf1xDgGaYCzfvStP2NwPQh6KBvCDbiOEvaE0filhranjIlK/2fSTVwtBng==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.7.5", - "@typescript-eslint/utils": "6.7.5", + "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/utils": "6.12.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -3571,9 +3587,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.5.tgz", - "integrity": "sha512-WboQBlOXtdj1tDFPyIthpKrUb+kZf2VroLZhxKa/VlwLlLyqv/PwUNgL30BlTVZV1Wu4Asu2mMYPqarSO4L5ZQ==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.12.0.tgz", + "integrity": "sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -3584,13 +3600,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.5.tgz", - "integrity": "sha512-NhJiJ4KdtwBIxrKl0BqG1Ur+uw7FiOnOThcYx9DpOGJ/Abc9z2xNzLeirCG02Ig3vkvrc2qFLmYSSsaITbKjlg==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz", + "integrity": "sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/visitor-keys": "6.7.5", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3626,17 +3642,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.5.tgz", - "integrity": "sha512-pfRRrH20thJbzPPlPc4j0UNGvH1PjPlhlCMq4Yx7EGjV7lvEeGX0U6MJYe8+SyFutWgSHsdbJ3BXzZccYggezA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.12.0.tgz", + "integrity": "sha512-LywPm8h3tGEbgfyjYnu3dauZ0U7R60m+miXgKcZS8c7QALO9uWJdvNoP+duKTk2XMWc7/Q3d/QiCuLN9X6SWyQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.7.5", - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/typescript-estree": "6.7.5", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/typescript-estree": "6.12.0", "semver": "^7.5.4" }, "engines": { @@ -3666,12 +3682,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.7.5", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.5.tgz", - "integrity": "sha512-3MaWdDZtLlsexZzDSdQWsFQ9l9nL8B80Z4fImSpyllFC/KLqWQRdEcB+gGGO+N3Q2uL40EsG66wZLsohPxNXvg==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz", + "integrity": "sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.7.5", + "@typescript-eslint/types": "6.12.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -3682,6 +3698,12 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@wry/context": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/@wry/context/-/context-0.7.3.tgz", @@ -3728,9 +3750,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -3893,12 +3915,25 @@ } }, "node_modules/aria-query": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.0.0.tgz", - "integrity": "sha512-V+SM7AbUwJ+EBnB8+DXs0hPZHO0W6pqBcc0dW90OwtVG02PswOu/teuARoLQjdDOH+t9pJgGnW5/Qmouf3gPJg==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", + "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", "dev": true, - "engines": { - "node": ">=6.0" + "dependencies": { + "deep-equal": "^2.0.5" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/array-includes": { @@ -4941,6 +4976,38 @@ } } }, + "node_modules/deep-equal": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.3.tgz", + "integrity": "sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.5", + "es-get-iterator": "^1.1.3", + "get-intrinsic": "^1.2.2", + "is-arguments": "^1.1.1", + "is-array-buffer": "^3.0.2", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -5139,11 +5206,12 @@ } }, "node_modules/define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "dev": true, "dependencies": { + "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" }, @@ -5298,6 +5366,12 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/emojilib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/emojilib/-/emojilib-2.4.0.tgz", + "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==", + "dev": true + }, "node_modules/enhanced-resolve": { "version": "5.15.0", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", @@ -5382,6 +5456,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/es-shim-unscopables": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", @@ -5534,18 +5628,19 @@ } }, "node_modules/eslint": { - "version": "8.51.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz", - "integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", + "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.51.0", - "@humanwhocodes/config-array": "^0.11.11", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.54.0", + "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -6337,15 +6432,6 @@ } } }, - "node_modules/fetch-ponyfill": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/fetch-ponyfill/-/fetch-ponyfill-7.1.0.tgz", - "integrity": "sha512-FhbbL55dj/qdVO3YNK7ZEkshvj3eQ7EuIGV2I6ic/2YiocvyWv+7jg2s4AyS0wdRU75s3tA8ZxI/xPigb0v5Aw==", - "dev": true, - "dependencies": { - "node-fetch": "~2.6.1" - } - }, "node_modules/fflate": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.7.4.tgz", @@ -7102,13 +7188,13 @@ "dev": true }, "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", + "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", + "get-intrinsic": "^1.2.2", + "hasown": "^2.0.0", "side-channel": "^1.0.4" }, "engines": { @@ -7131,6 +7217,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -7330,6 +7430,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -7428,6 +7537,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", @@ -7519,6 +7637,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -7531,6 +7658,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -9059,9 +9199,9 @@ "dev": true }, "node_modules/lz-string": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz", - "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, "bin": { "lz-string": "bin/bin.js" @@ -9146,23 +9286,23 @@ } }, "node_modules/marked-terminal": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-5.2.0.tgz", - "integrity": "sha512-Piv6yNwAQXGFjZSaiNljyNFw7jKDdGrw70FSbtxEyldLsyeuV5ZHm/1wW++kWbrOF1VPnUgYOhB2oLL0ZpnekA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-6.1.0.tgz", + "integrity": "sha512-QaCSF6NV82oo6K0szEnmc65ooDeW0T/Adcyf0fcW+Hto2GT1VADFg8dn1zaeHqzj65fqDH1hMNChGNRaC/lbkA==", "dev": true, "dependencies": { "ansi-escapes": "^6.2.0", "cardinal": "^2.1.1", - "chalk": "^5.2.0", + "chalk": "^5.3.0", "cli-table3": "^0.6.3", - "node-emoji": "^1.11.0", - "supports-hyperlinks": "^2.3.0" + "node-emoji": "^2.1.0", + "supports-hyperlinks": "^3.0.0" }, "engines": { - "node": ">=14.13.1 || >=16.0.0" + "node": ">=16.0.0" }, "peerDependencies": { - "marked": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0" + "marked": ">=1 <11" } }, "node_modules/marked-terminal/node_modules/ansi-escapes": { @@ -9181,9 +9321,9 @@ } }, "node_modules/marked-terminal/node_modules/chalk": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", - "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "dev": true, "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" @@ -9426,12 +9566,18 @@ "dev": true }, "node_modules/node-emoji": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", - "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.1.3.tgz", + "integrity": "sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==", "dev": true, "dependencies": { - "lodash": "^4.17.21" + "@sindresorhus/is": "^4.6.0", + "char-regex": "^1.0.2", + "emojilib": "^2.4.0", + "skin-tone": "^2.0.0" + }, + "engines": { + "node": ">=18" } }, "node_modules/node-fetch": { @@ -10166,9 +10312,9 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -10538,14 +10684,14 @@ "dev": true }, "node_modules/regexp.prototype.flags": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", - "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "functions-have-names": "^1.2.2" + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" }, "engines": { "node": ">= 0.4" @@ -10921,6 +11067,20 @@ "node": ">= 0.4" } }, + "node_modules/set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -11044,6 +11204,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/skin-tone": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz", + "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==", + "dev": true, + "dependencies": { + "unicode-emoji-modifier-base": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/skip-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/skip-regex/-/skip-regex-1.0.2.tgz", @@ -11336,6 +11508,18 @@ "node": ">=8" } }, + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "dev": true, + "dependencies": { + "internal-slot": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/stream-transform": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-2.1.3.tgz", @@ -11529,16 +11713,16 @@ } }, "node_modules/supports-hyperlinks": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", - "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.0.0.tgz", + "integrity": "sha512-QBDPHyPQDRTy9ku4URNGY5Lah8PAaXs6tAAwp55sL5WCsSW7GIfdf6W5ixfziW+t7wh3GVvHyHHyQ1ESsoRvaA==", "dev": true, "dependencies": { "has-flag": "^4.0.0", "supports-color": "^7.0.0" }, "engines": { - "node": ">=8" + "node": ">=14.18" } }, "node_modules/supports-preserve-symlinks-flag": { @@ -11589,9 +11773,9 @@ } }, "node_modules/terser": { - "version": "5.21.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.21.0.tgz", - "integrity": "sha512-WtnFKrxu9kaoXuiZFSGrcAvvBqAdmKx0SFNmVNYdJamMu9yyN3I/QF0FbH4QcqJQ+y1CJnzxGIKH0cSj+FGYRw==", + "version": "5.24.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.24.0.tgz", + "integrity": "sha512-ZpGR4Hy3+wBEzVEnHvstMvqpD/nABNelQn/z2r0fjVWGQsN3bpOLzQlqDxmb4CDZnXq5lpjnQ+mHQLAOpfM5iw==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -12059,9 +12243,9 @@ } }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -12092,6 +12276,15 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, + "node_modules/unicode-emoji-modifier-base": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz", + "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/unicorn-magic": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", @@ -12383,6 +12576,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", @@ -12403,17 +12611,16 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", + "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "call-bind": "^1.0.4", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" + "has-tostringtag": "^1.0.0" }, "engines": { "node": ">= 0.4" diff --git a/package.json b/package.json index e86e4ca7428..81418c11b42 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "zen-observable-ts": "^1.2.5" }, "devDependencies": { - "@arethetypeswrong/cli": "0.12.2", + "@arethetypeswrong/cli": "0.13.2", "@babel/parser": "7.23.4", "@changesets/changelog-github": "0.4.8", "@changesets/cli": "2.26.2", @@ -116,7 +116,7 @@ "@size-limit/esbuild-why": "11.0.0", "@size-limit/preset-small-lib": "11.0.0", "@testing-library/jest-dom": "6.1.4", - "@testing-library/react": "14.0.0", + "@testing-library/react": "14.1.2", "@testing-library/react-12": "npm:@testing-library/react@^12", "@testing-library/user-event": "14.5.1", "@tsconfig/node20": "20.1.2", @@ -126,21 +126,21 @@ "@types/hoist-non-react-statics": "3.3.5", "@types/jest": "29.5.10", "@types/lodash": "4.14.202", - "@types/node": "20.8.10", + "@types/node": "20.10.0", "@types/node-fetch": "2.6.9", "@types/react": "18.2.38", "@types/react-dom": "18.2.17", "@types/use-sync-external-store": "0.0.6", - "@typescript-eslint/eslint-plugin": "6.7.5", - "@typescript-eslint/parser": "6.7.5", - "@typescript-eslint/rule-tester": "6.7.5", - "@typescript-eslint/types": "6.7.5", - "@typescript-eslint/utils": "6.7.5", - "acorn": "8.10.0", + "@typescript-eslint/eslint-plugin": "6.12.0", + "@typescript-eslint/parser": "6.12.0", + "@typescript-eslint/rule-tester": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/utils": "6.12.0", + "acorn": "8.11.2", "blob-polyfill": "7.0.20220408", "bytes": "3.1.2", "cross-fetch": "4.0.0", - "eslint": "8.51.0", + "eslint": "8.54.0", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-import": "npm:@phryneas/eslint-plugin-import@2.27.5-pr.2813.2817.199971c", "eslint-plugin-local-rules": "2.0.1", @@ -155,7 +155,7 @@ "jest-junit": "16.0.0", "lodash": "4.17.21", "patch-package": "8.0.0", - "prettier": "3.0.3", + "prettier": "3.1.0", "react": "18.2.0", "react-17": "npm:react@^17", "react-dom": "18.2.0", @@ -170,14 +170,14 @@ "rxjs": "7.8.1", "size-limit": "11.0.0", "subscriptions-transport-ws": "0.11.0", - "terser": "5.21.0", + "terser": "5.24.0", "ts-api-utils": "1.0.3", "ts-jest": "29.1.1", "ts-jest-resolver": "2.0.1", "ts-morph": "20.0.0", "ts-node": "10.9.1", "typedoc": "0.25.0", - "typescript": "5.2.2", + "typescript": "5.3.2", "wait-for-observables": "1.0.3", "web-streams-polyfill": "3.2.1", "whatwg-fetch": "3.6.19" diff --git a/scripts/codemods/ac2-to-ac3/imports.js b/scripts/codemods/ac2-to-ac3/imports.js index e21dc594a6e..6ced8fff06f 100644 --- a/scripts/codemods/ac2-to-ac3/imports.js +++ b/scripts/codemods/ac2-to-ac3/imports.js @@ -103,8 +103,8 @@ export default function transformer(file, api) { function renameDefaultSpecifier(moduleImport, name) { function replacer(path) { - return path.value.local.name === name - ? j.importSpecifier(j.identifier(name)) + return path.value.local.name === name ? + j.importSpecifier(j.identifier(name)) : j.importSpecifier(j.identifier(name), path.value.local); } diff --git a/src/cache/core/cache.ts b/src/cache/core/cache.ts index b897419fb1a..44f283a2723 100644 --- a/src/cache/core/cache.ts +++ b/src/cache/core/cache.ts @@ -65,11 +65,9 @@ export abstract class ApolloCache implements DataProxy { // override the batch method to do more interesting things with its options. public batch(options: Cache.BatchOptions): U { const optimisticId = - typeof options.optimistic === "string" - ? options.optimistic - : options.optimistic === false - ? null - : void 0; + typeof options.optimistic === "string" ? options.optimistic + : options.optimistic === false ? null + : void 0; let updateResult: U; this.performTransaction( () => (updateResult = options.update(this)), diff --git a/src/cache/core/types/common.ts b/src/cache/core/types/common.ts index 9dc18d9197f..46c4fa8a155 100644 --- a/src/cache/core/types/common.ts +++ b/src/cache/core/types/common.ts @@ -105,22 +105,20 @@ export type Modifier = ( details: ModifierDetails ) => T | DeleteModifier | InvalidateModifier; -type StoreObjectValueMaybeReference = StoreVal extends Array< - Record -> - ? StoreVal extends Array - ? Item extends Record - ? ReadonlyArray | Reference> +type StoreObjectValueMaybeReference = + StoreVal extends Array> ? + StoreVal extends Array ? + Item extends Record ? + ReadonlyArray | Reference> : never : never - : StoreVal extends Record - ? AsStoreObject | Reference + : StoreVal extends Record ? AsStoreObject | Reference : StoreVal; export type AllFieldsModifier> = Modifier< - Entity[keyof Entity] extends infer Value - ? StoreObjectValueMaybeReference> - : never + Entity[keyof Entity] extends infer Value ? + StoreObjectValueMaybeReference> + : never >; export type Modifiers = Record> = diff --git a/src/cache/inmemory/__tests__/readFromStore.ts b/src/cache/inmemory/__tests__/readFromStore.ts index 328336ec3ed..972e252215c 100644 --- a/src/cache/inmemory/__tests__/readFromStore.ts +++ b/src/cache/inmemory/__tests__/readFromStore.ts @@ -1477,12 +1477,12 @@ describe("reading from the store", () => { fields: { ruler(ruler, { canRead, toReference }) { // If the throne is empty, promote Apollo! - return canRead(ruler) - ? ruler - : toReference({ + return canRead(ruler) ? ruler : ( + toReference({ __typename: "Deity", name: "Apollo", - }); + }) + ); }, }, }, @@ -1654,8 +1654,8 @@ describe("reading from the store", () => { ...diffWithoutDevouredSons.result.ruler, children: diffWithoutDevouredSons.result.ruler.children.map( (child) => { - return child.name === "Zeus" - ? { + return child.name === "Zeus" ? + { ...child, children: childrenOfZeus // Remove empty child.children arrays. diff --git a/src/cache/inmemory/entityStore.ts b/src/cache/inmemory/entityStore.ts index a31f96db63a..5c617ce67a6 100644 --- a/src/cache/inmemory/entityStore.ts +++ b/src/cache/inmemory/entityStore.ts @@ -221,12 +221,12 @@ export abstract class EntityStore implements NormalizedCache { from?: StoreObject | Reference ) => this.policies.readField( - typeof fieldNameOrOptions === "string" - ? { - fieldName: fieldNameOrOptions, - from: from || makeReference(dataId), - } - : fieldNameOrOptions, + typeof fieldNameOrOptions === "string" ? + { + fieldName: fieldNameOrOptions, + from: from || makeReference(dataId), + } + : fieldNameOrOptions, { store: this } ), } satisfies Partial; @@ -236,19 +236,19 @@ export abstract class EntityStore implements NormalizedCache { let fieldValue = storeObject[storeFieldName]; if (fieldValue === void 0) return; const modify: Modifier | undefined = - typeof fields === "function" - ? fields - : fields[storeFieldName] || fields[fieldName]; + typeof fields === "function" ? fields : ( + fields[storeFieldName] || fields[fieldName] + ); if (modify) { let newValue = - modify === delModifier - ? DELETE - : modify(maybeDeepFreeze(fieldValue), { - ...sharedDetails, - fieldName, - storeFieldName, - storage: this.getStorage(dataId, storeFieldName), - }); + modify === delModifier ? DELETE : ( + modify(maybeDeepFreeze(fieldValue), { + ...sharedDetails, + fieldName, + storeFieldName, + storage: this.getStorage(dataId, storeFieldName), + }) + ); if (newValue === INVALIDATE) { this.group.dirty(dataId, storeFieldName); } else { @@ -344,16 +344,16 @@ export abstract class EntityStore implements NormalizedCache { if (storeObject) { const typename = this.getFieldValue(storeObject, "__typename"); const storeFieldName = - fieldName && args - ? this.policies.getStoreFieldName({ typename, fieldName, args }) - : fieldName; + fieldName && args ? + this.policies.getStoreFieldName({ typename, fieldName, args }) + : fieldName; return this.modify( dataId, - storeFieldName - ? { - [storeFieldName]: delModifier, - } - : delModifier + storeFieldName ? + { + [storeFieldName]: delModifier, + } + : delModifier ); } return false; @@ -534,17 +534,17 @@ export abstract class EntityStore implements NormalizedCache { storeFieldName: string ) => maybeDeepFreeze( - isReference(objectOrReference) - ? this.get(objectOrReference.__ref, storeFieldName) - : objectOrReference && objectOrReference[storeFieldName] + isReference(objectOrReference) ? + this.get(objectOrReference.__ref, storeFieldName) + : objectOrReference && objectOrReference[storeFieldName] ) as SafeReadonly; // Returns true for non-normalized StoreObjects and non-dangling // References, indicating that readField(name, objOrRef) has a chance of // working. Useful for filtering out dangling references from lists. public canRead: CanReadFunction = (objOrRef) => { - return isReference(objOrRef) - ? this.has(objOrRef.__ref) + return isReference(objOrRef) ? + this.has(objOrRef.__ref) : typeof objOrRef === "object"; }; @@ -789,8 +789,8 @@ class Layer extends EntityStore { public findChildRefIds(dataId: string): Record { const fromParent = this.parent.findChildRefIds(dataId); - return hasOwn.call(this.data, dataId) - ? { + return hasOwn.call(this.data, dataId) ? + { ...fromParent, ...super.findChildRefIds(dataId), } diff --git a/src/cache/inmemory/helpers.ts b/src/cache/inmemory/helpers.ts index f18d34da3f2..f8991653aed 100644 --- a/src/cache/inmemory/helpers.ts +++ b/src/cache/inmemory/helpers.ts @@ -43,10 +43,9 @@ export function defaultDataIdFromObject( ): string | undefined { if (typeof __typename === "string") { if (context) { - context.keyObject = !isNullish(id) - ? { id } - : !isNullish(_id) - ? { _id } + context.keyObject = + !isNullish(id) ? { id } + : !isNullish(_id) ? { _id } : void 0; } @@ -57,9 +56,9 @@ export function defaultDataIdFromObject( if (!isNullish(id)) { return `${__typename}:${ - typeof id === "number" || typeof id === "string" - ? id - : JSON.stringify(id) + typeof id === "number" || typeof id === "string" ? + id + : JSON.stringify(id) }`; } } @@ -89,8 +88,8 @@ export function getTypenameFromStoreObject( store: NormalizedCache, objectOrReference: StoreObject | Reference ): string | undefined { - return isReference(objectOrReference) - ? (store.get(objectOrReference.__ref, "__typename") as string) + return isReference(objectOrReference) ? + (store.get(objectOrReference.__ref, "__typename") as string) : objectOrReference && objectOrReference.__typename; } @@ -107,8 +106,8 @@ export function selectionSetMatchesResult( variables?: Record ): boolean { if (isNonNullObject(result)) { - return isArray(result) - ? result.every((item) => + return isArray(result) ? + result.every((item) => selectionSetMatchesResult(selectionSet, item, variables) ) : selectionSet.selections.every((field) => { diff --git a/src/cache/inmemory/inMemoryCache.ts b/src/cache/inmemory/inMemoryCache.ts index ff7e9cd8b91..45820e9d258 100644 --- a/src/cache/inmemory/inMemoryCache.ts +++ b/src/cache/inmemory/inMemoryCache.ts @@ -109,9 +109,10 @@ export class InMemoryCache extends ApolloCache { addTypename: this.addTypename, resultCacheMaxSize: this.config.resultCacheMaxSize, canonizeResults: shouldCanonizeResults(this.config), - canon: resetResultIdentities - ? void 0 - : previousReader && previousReader.canon, + canon: + resetResultIdentities ? void 0 : ( + previousReader && previousReader.canon + ), fragments, })), fragments @@ -225,8 +226,11 @@ export class InMemoryCache extends ApolloCache { // that nothing was modified. return false; } - const store = options.optimistic // Defaults to false. - ? this.optimisticData + const store = + ( + options.optimistic // Defaults to false. + ) ? + this.optimisticData : this.data; try { ++this.txCount; diff --git a/src/cache/inmemory/key-extractor.ts b/src/cache/inmemory/key-extractor.ts index 314da216800..38c5d14698e 100644 --- a/src/cache/inmemory/key-extractor.ts +++ b/src/cache/inmemory/key-extractor.ts @@ -250,8 +250,8 @@ export function extractKeyPath( extract = extract || extractKey; return normalize( path.reduce(function reducer(obj, key): any { - return isArray(obj) - ? obj.map((child) => reducer(child, key)) + return isArray(obj) ? + obj.map((child) => reducer(child, key)) : obj && extract!(obj, key); }, object) ); diff --git a/src/cache/inmemory/object-canon.ts b/src/cache/inmemory/object-canon.ts index 376b474f282..36b196d1519 100644 --- a/src/cache/inmemory/object-canon.ts +++ b/src/cache/inmemory/object-canon.ts @@ -8,8 +8,8 @@ import { isArray } from "./helpers.js"; function shallowCopy(value: T): T { if (isObjectOrArray(value)) { - return isArray(value) - ? (value.slice(0) as any as T) + return isArray(value) ? + (value.slice(0) as any as T) : { __proto__: Object.getPrototypeOf(value), ...value }; } return value; diff --git a/src/cache/inmemory/policies.ts b/src/cache/inmemory/policies.ts index 2b2caec7e9c..41db9853bb8 100644 --- a/src/cache/inmemory/policies.ts +++ b/src/cache/inmemory/policies.ts @@ -172,11 +172,11 @@ export type FieldPolicy< export type StorageType = Record; function argsFromFieldSpecifier(spec: FieldSpecifier) { - return spec.args !== void 0 - ? spec.args - : spec.field - ? argumentsObjectFromField(spec.field, spec.variables) - : null; + return ( + spec.args !== void 0 ? spec.args + : spec.field ? argumentsObjectFromField(spec.field, spec.variables) + : null + ); } export interface FieldFunctionOptions< @@ -451,17 +451,14 @@ export class Policies { merge?: FieldMergeFunction | boolean ) { existing.merge = - typeof merge === "function" - ? merge - : // Pass merge:true as a shorthand for a merge implementation + typeof merge === "function" ? merge + // Pass merge:true as a shorthand for a merge implementation // that returns options.mergeObjects(existing, incoming). - merge === true - ? mergeTrueFn - : // Pass merge:false to make incoming always replace existing + : merge === true ? mergeTrueFn + // Pass merge:false to make incoming always replace existing // without any warnings about data clobbering. - merge === false - ? mergeFalseFn - : existing.merge; + : merge === false ? mergeFalseFn + : existing.merge; } // Type policies can define merge functions, as an alternative to @@ -470,17 +467,14 @@ export class Policies { existing.keyFn = // Pass false to disable normalization for this typename. - keyFields === false - ? nullKeyFieldsFn - : // Pass an array of strings to use those fields to compute a + keyFields === false ? nullKeyFieldsFn + // Pass an array of strings to use those fields to compute a // composite ID for objects of this typename. - isArray(keyFields) - ? keyFieldsFnFromSpecifier(keyFields) - : // Pass a function to take full control over identification. - typeof keyFields === "function" - ? keyFields - : // Leave existing.keyFn unchanged if above cases fail. - existing.keyFn; + : isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) + // Pass a function to take full control over identification. + : typeof keyFields === "function" ? keyFields + // Leave existing.keyFn unchanged if above cases fail. + : existing.keyFn; if (fields) { Object.keys(fields).forEach((fieldName) => { @@ -495,17 +489,14 @@ export class Policies { existing.keyFn = // Pass false to disable argument-based differentiation of // field identities. - keyArgs === false - ? simpleKeyArgsFn - : // Pass an array of strings to use named arguments to + keyArgs === false ? simpleKeyArgsFn + // Pass an array of strings to use named arguments to // compute a composite identity for the field. - isArray(keyArgs) - ? keyArgsFnFromSpecifier(keyArgs) - : // Pass a function to take full control over field identity. - typeof keyArgs === "function" - ? keyArgs - : // Leave existing.keyFn unchanged if above cases fail. - existing.keyFn; + : isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) + // Pass a function to take full control over field identity. + : typeof keyArgs === "function" ? keyArgs + // Leave existing.keyFn unchanged if above cases fail. + : existing.keyFn; if (typeof read === "function") { existing.read = read; @@ -803,8 +794,9 @@ export class Policies { } if (storeFieldName === void 0) { - storeFieldName = fieldSpec.field - ? storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) + storeFieldName = + fieldSpec.field ? + storeKeyNameFromField(fieldSpec.field, fieldSpec.variables) : getStoreKeyName(fieldName, argsFromFieldSpecifier(fieldSpec)); } @@ -817,8 +809,7 @@ export class Policies { // Make sure custom field names start with the actual field.name.value // of the field, so we can always figure out which properties of a // StoreObject correspond to which original field names. - return fieldName === fieldNameFromStoreName(storeFieldName) - ? storeFieldName + return fieldName === fieldNameFromStoreName(storeFieldName) ? storeFieldName : fieldName + ":" + storeFieldName; } @@ -856,9 +847,9 @@ export class Policies { options, context, context.store.getStorage( - isReference(objectOrReference) - ? objectOrReference.__ref - : objectOrReference, + isReference(objectOrReference) ? + objectOrReference.__ref + : objectOrReference, storeFieldName ) ); diff --git a/src/cache/inmemory/readFromStore.ts b/src/cache/inmemory/readFromStore.ts index 50980c77597..9ad5455b457 100644 --- a/src/cache/inmemory/readFromStore.ts +++ b/src/cache/inmemory/readFromStore.ts @@ -383,9 +383,9 @@ export class StoreReader { if (!addTypenameToDocument.added(selection)) { missing = missingMerger.merge(missing, { [resultName]: `Can't find field '${selection.name.value}' on ${ - isReference(objectOrReference) - ? objectOrReference.__ref + " object" - : "object " + JSON.stringify(objectOrReference, null, 2) + isReference(objectOrReference) ? + objectOrReference.__ref + " object" + : "object " + JSON.stringify(objectOrReference, null, 2) }`, }); } @@ -443,11 +443,12 @@ export class StoreReader { const result = mergeDeepArray(objectsToMerge); const finalResult: ExecResult = { result, missing }; - const frozen = context.canonizeResults - ? this.canon.admit(finalResult) - : // Since this.canon is normally responsible for freezing results (only in + const frozen = + context.canonizeResults ? + this.canon.admit(finalResult) + // Since this.canon is normally responsible for freezing results (only in // development), freeze them manually if canonization is disabled. - maybeDeepFreeze(finalResult); + : maybeDeepFreeze(finalResult); // Store this result with its selection set so that we can quickly // recognize it again in the StoreReader#isFresh method. diff --git a/src/cache/inmemory/writeToStore.ts b/src/cache/inmemory/writeToStore.ts index 1d3f3fb01d4..3afbe6b04fc 100644 --- a/src/cache/inmemory/writeToStore.ts +++ b/src/cache/inmemory/writeToStore.ts @@ -95,13 +95,13 @@ function getContextFlavor( context.flavors.set( key, (flavored = - context.clientOnly === clientOnly && context.deferred === deferred - ? context - : { - ...context, - clientOnly, - deferred, - }) + context.clientOnly === clientOnly && context.deferred === deferred ? + context + : { + ...context, + clientOnly, + deferred, + }) ); } return flavored as TContext; @@ -330,9 +330,9 @@ export class StoreWriter { field, // Reset context.clientOnly and context.deferred to their default // values before processing nested selection sets. - field.selectionSet - ? getContextFlavor(context, false, false) - : context, + field.selectionSet ? + getContextFlavor(context, false, false) + : context, childTree ); @@ -633,13 +633,15 @@ export class StoreWriter { // Items in the same position in different arrays are not // necessarily related to each other, so when incoming is an array // we process its elements as if there was no existing data. - !isArray(incoming) && - // Likewise, existing must be either a Reference or a StoreObject - // in order for its fields to be safe to merge with the fields of - // the incoming object. - (isReference(existing) || storeValueIsStoreObject(existing)) - ? existing - : void 0; + ( + !isArray(incoming) && + // Likewise, existing must be either a Reference or a StoreObject + // in order for its fields to be safe to merge with the fields of + // the incoming object. + (isReference(existing) || storeValueIsStoreObject(existing)) + ) ? + existing + : void 0; // This narrowing is implied by mergeTree.map.size > 0 and // !isReference(incoming), though TypeScript understandably cannot @@ -665,11 +667,13 @@ export class StoreWriter { from: typeof e | typeof i, name: string | number ): StoreValue => { - return isArray(from) - ? typeof name === "number" - ? from[name] + return ( + isArray(from) ? + typeof name === "number" ? + from[name] : void 0 - : context.store.getFieldValue(from, String(name)); + : context.store.getFieldValue(from, String(name)) + ); }; mergeTree.map.forEach((childTree, storeFieldName) => { @@ -739,18 +743,17 @@ function mergeMergeTrees( if (!left || mergeTreeIsEmpty(left)) return right; const info = - left.info && right.info - ? { - ...left.info, - ...right.info, - } - : left.info || right.info; + left.info && right.info ? + { + ...left.info, + ...right.info, + } + : left.info || right.info; const needToMergeMaps = left.map.size && right.map.size; - const map = needToMergeMaps - ? new Map() - : left.map.size - ? left.map + const map = + needToMergeMaps ? new Map() + : left.map.size ? left.map : right.map; const merged = { info, map }; @@ -864,11 +867,11 @@ For more information about these options, please refer to the documentation: `, fieldName, parentType, - childTypenames.length - ? "either ensure all objects of type " + - childTypenames.join(" and ") + - " have an ID or a custom merge function, or " - : "", + childTypenames.length ? + "either ensure all objects of type " + + childTypenames.join(" and ") + + " have an ID or a custom merge function, or " + : "", typeDotName, existing, incoming diff --git a/src/core/ApolloClient.ts b/src/core/ApolloClient.ts index 967d9952739..3443cfa08e8 100644 --- a/src/core/ApolloClient.ts +++ b/src/core/ApolloClient.ts @@ -206,9 +206,8 @@ export class ApolloClient implements DataProxy { let { link } = options; if (!link) { - link = uri - ? new HttpLink({ uri, credentials, headers }) - : ApolloLink.empty(); + link = + uri ? new HttpLink({ uri, credentials, headers }) : ApolloLink.empty(); } this.link = link; @@ -253,8 +252,9 @@ export class ApolloClient implements DataProxy { }, localState: this.localState, assumeImmutableResults, - onBroadcast: connectToDevTools - ? () => { + onBroadcast: + connectToDevTools ? + () => { if (this.devToolsHookCb) { this.devToolsHookCb({ action: {}, diff --git a/src/core/LocalState.ts b/src/core/LocalState.ts index 4b68b787c2a..4d354349099 100644 --- a/src/core/LocalState.ts +++ b/src/core/LocalState.ts @@ -274,8 +274,9 @@ export class LocalState { const definitionOperation = mainDefinition.operation; - const defaultOperationType = definitionOperation - ? definitionOperation.charAt(0).toUpperCase() + + const defaultOperationType = + definitionOperation ? + definitionOperation.charAt(0).toUpperCase() + definitionOperation.slice(1) : "Query"; diff --git a/src/core/ObservableQuery.ts b/src/core/ObservableQuery.ts index 9a306746d0d..8516678dfc8 100644 --- a/src/core/ObservableQuery.ts +++ b/src/core/ObservableQuery.ts @@ -167,9 +167,9 @@ export class ObservableQuery< const { fetchPolicy = defaultFetchPolicy, // Make sure we don't store "standby" as the initialFetchPolicy. - initialFetchPolicy = fetchPolicy === "standby" - ? defaultFetchPolicy - : fetchPolicy, + initialFetchPolicy = fetchPolicy === "standby" ? defaultFetchPolicy : ( + fetchPolicy + ), } = options; this.options = { @@ -317,9 +317,9 @@ export class ObservableQuery< return true; } - const resultIsDifferent = this.queryManager.getDocumentInfo(this.query) - .hasNonreactiveDirective - ? !equalByQuery(this.query, this.last.result, newResult, this.variables) + const resultIsDifferent = + this.queryManager.getDocumentInfo(this.query).hasNonreactiveDirective ? + !equalByQuery(this.query, this.last.result, newResult, this.variables) : !equal(this.last.result, newResult); return ( @@ -427,17 +427,17 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`, } ): Promise> { const combinedOptions = { - ...(fetchMoreOptions.query - ? fetchMoreOptions - : { - ...this.options, - query: this.options.query, - ...fetchMoreOptions, - variables: { - ...this.options.variables, - ...fetchMoreOptions.variables, - }, - }), + ...(fetchMoreOptions.query ? fetchMoreOptions : ( + { + ...this.options, + query: this.options.query, + ...fetchMoreOptions, + variables: { + ...this.options.variables, + ...fetchMoreOptions.variables, + }, + } + )), // The fetchMore request goes immediately to the network and does // not automatically write its result to the cache (hence no-cache // instead of network-only), because we allow the caller of @@ -455,8 +455,9 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`, // pagination. We will however run the transforms on the original document // as well as the document passed in `fetchMoreOptions` to ensure the cache // uses the most up-to-date document which may rely on runtime conditionals. - this.lastQuery = fetchMoreOptions.query - ? this.transformDocument(this.options.query) + this.lastQuery = + fetchMoreOptions.query ? + this.transformDocument(this.options.query) : combinedOptions.query; // Simulate a loading result for the original query with @@ -783,9 +784,9 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`, // no-cache are both useful for when the user wants to control whether or not the // polled results are written to the cache. fetchPolicy: - this.options.initialFetchPolicy === "no-cache" - ? "no-cache" - : "network-only", + this.options.initialFetchPolicy === "no-cache" ? + "no-cache" + : "network-only", }, NetworkStatus.poll ).then(poll, poll); @@ -816,8 +817,9 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`, error = void 0; } return (this.last = { - result: this.queryManager.assumeImmutableResults - ? newResult + result: + this.queryManager.assumeImmutableResults ? + newResult : cloneDeep(newResult), variables, ...(error ? { error } : null), @@ -847,8 +849,9 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`, const oldFetchPolicy = this.options.fetchPolicy; const mergedOptions = compact(this.options, newOptions || {}); - const options = useDisposableConcast - ? // Disposable Concast fetches receive a shallow copy of this.options + const options = + useDisposableConcast ? + // Disposable Concast fetches receive a shallow copy of this.options // (merged with newOptions), leaving this.options unmodified. mergedOptions : assign(this.options, mergedOptions); diff --git a/src/core/QueryInfo.ts b/src/core/QueryInfo.ts index cdf0d358ceb..bd416b8b5be 100644 --- a/src/core/QueryInfo.ts +++ b/src/core/QueryInfo.ts @@ -184,8 +184,9 @@ export class QueryInfo { diff: Cache.DiffResult | null, options?: Cache.DiffOptions ) { - this.lastDiff = diff - ? { + this.lastDiff = + diff ? + { diff, options: options || this.getDiffOptions(), } @@ -360,9 +361,8 @@ export class QueryInfo { cacheWriteBehavior: CacheWriteBehavior ) { const merger = new DeepMerger(); - const graphQLErrors = isNonEmptyArray(result.errors) - ? result.errors.slice(0) - : []; + const graphQLErrors = + isNonEmptyArray(result.errors) ? result.errors.slice(0) : []; // Cancel the pending notify timeout (if it exists) to prevent extraneous network // requests. To allow future notify timeouts, diff and dirty are reset as well. diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index 23ee9320400..62909a7f7b9 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -164,8 +164,9 @@ export class QueryManager { this.localState = localState || new LocalState({ cache }); this.ssrMode = ssrMode; this.assumeImmutableResults = assumeImmutableResults; - this.documentTransform = documentTransform - ? defaultDocumentTransform + this.documentTransform = + documentTransform ? + defaultDocumentTransform .concat(documentTransform) // The custom document transform may add new fragment spreads or new // field selections, so we want to give the cache a chance to run @@ -351,11 +352,11 @@ export class QueryManager { self.broadcastQueries(); reject( - err instanceof ApolloError - ? err - : new ApolloError({ - networkError: err, - }) + err instanceof ApolloError ? err : ( + new ApolloError({ + networkError: err, + }) + ) ); }, }); @@ -593,9 +594,9 @@ export class QueryManager { } ) { const data = - typeof optimisticResponse === "function" - ? optimisticResponse(mutation.variables) - : optimisticResponse; + typeof optimisticResponse === "function" ? + optimisticResponse(mutation.variables) + : optimisticResponse; return this.cache.recordOptimisticTransaction((cache) => { try { @@ -915,9 +916,9 @@ export class QueryManager { queryNamesAndDocs.forEach((included, nameOrDoc) => { if (!included) { invariant.warn( - typeof nameOrDoc === "string" - ? `Unknown query named "%s" requested in refetchQueries options.include array` - : `Unknown query %s requested in refetchQueries options.include array`, + typeof nameOrDoc === "string" ? + `Unknown query named "%s" requested in refetchQueries options.include array` + : `Unknown query %s requested in refetchQueries options.include array`, nameOrDoc ); } @@ -1201,9 +1202,10 @@ export class QueryManager { }, (networkError) => { - const error = isApolloError(networkError) - ? networkError - : new ApolloError({ networkError }); + const error = + isApolloError(networkError) ? networkError : ( + new ApolloError({ networkError }) + ); // Avoid storing errors from older interrupted queries. if (requestId >= queryInfo.lastRequestId) { @@ -1565,14 +1567,15 @@ export class QueryManager { }; const cacheWriteBehavior = - fetchPolicy === "no-cache" - ? CacheWriteBehavior.FORBID - : // Watched queries must opt into overwriting existing data on refetch, + fetchPolicy === "no-cache" ? CacheWriteBehavior.FORBID + // Watched queries must opt into overwriting existing data on refetch, // by passing refetchWritePolicy: "overwrite" in their WatchQueryOptions. + : ( networkStatus === NetworkStatus.refetch && - refetchWritePolicy !== "merge" - ? CacheWriteBehavior.OVERWRITE - : CacheWriteBehavior.MERGE; + refetchWritePolicy !== "merge" + ) ? + CacheWriteBehavior.OVERWRITE + : CacheWriteBehavior.MERGE; const resultsFromLink = () => this.getResultsFromLink(queryInfo, cacheWriteBehavior, { diff --git a/src/core/__tests__/QueryManager/index.ts b/src/core/__tests__/QueryManager/index.ts index 11f92046721..083985c6e7c 100644 --- a/src/core/__tests__/QueryManager/index.ts +++ b/src/core/__tests__/QueryManager/index.ts @@ -5848,9 +5848,8 @@ describe("QueryManager", () => { const variables = { id: "1234" }; - const refetchError = testQueryError - ? new Error("Refetch failed") - : undefined; + const refetchError = + testQueryError ? new Error("Refetch failed") : undefined; const queryManager = mockQueryManager( { diff --git a/src/core/__tests__/fetchPolicies.ts b/src/core/__tests__/fetchPolicies.ts index 27c691aab06..6f1f1cac5e9 100644 --- a/src/core/__tests__/fetchPolicies.ts +++ b/src/core/__tests__/fetchPolicies.ts @@ -871,9 +871,9 @@ describe("nextFetchPolicy", () => { }) => itAsync( `transitions ${args.fetchPolicy} to ${ - typeof args.nextFetchPolicy === "function" - ? args.nextFetchPolicy.name - : args.nextFetchPolicy + typeof args.nextFetchPolicy === "function" ? + args.nextFetchPolicy.name + : args.nextFetchPolicy } (${args.useDefaultOptions ? "" : "not "}using defaults)`, (resolve, reject) => { const client = new ApolloClient({ @@ -882,8 +882,9 @@ describe("nextFetchPolicy", () => { addTypename: true, }), defaultOptions: { - watchQuery: args.useDefaultOptions - ? { + watchQuery: + args.useDefaultOptions ? + { nextFetchPolicy: args.nextFetchPolicy, } : {}, diff --git a/src/core/types.ts b/src/core/types.ts index 832f2533f57..eeda05fa41c 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -74,24 +74,21 @@ export type RefetchQueriesPromiseResults = // we get if we don't check for any. I hoped `any extends TResult` would do // the trick here, instead of IsStrictlyAny, but you can see for yourself what // fails in the refetchQueries tests if you try making that simplification. - IsStrictlyAny extends true - ? any[] - : // If the onQueryUpdated function passed to client.refetchQueries returns true - // or false, that means either to refetch the query (true) or to skip the - // query (false). Since refetching produces an ApolloQueryResult, and - // skipping produces nothing, the fully-resolved array of all results produced - // will be an ApolloQueryResult[], when TResult extends boolean. - TResult extends boolean - ? ApolloQueryResult[] - : // If onQueryUpdated returns a PromiseLike, that thenable will be passed as - // an array element to Promise.all, so we infer/unwrap the array type U here. - TResult extends PromiseLike - ? U[] - : // All other onQueryUpdated results end up in the final Promise.all array as - // themselves, with their original TResult type. Note that TResult will - // default to ApolloQueryResult if no onQueryUpdated function is passed - // to client.refetchQueries. - TResult[]; + IsStrictlyAny extends true ? any[] + : // If the onQueryUpdated function passed to client.refetchQueries returns true + // or false, that means either to refetch the query (true) or to skip the + // query (false). Since refetching produces an ApolloQueryResult, and + // skipping produces nothing, the fully-resolved array of all results produced + // will be an ApolloQueryResult[], when TResult extends boolean. + TResult extends boolean ? ApolloQueryResult[] + : // If onQueryUpdated returns a PromiseLike, that thenable will be passed as + // an array element to Promise.all, so we infer/unwrap the array type U here. + TResult extends PromiseLike ? U[] + : // All other onQueryUpdated results end up in the final Promise.all array as + // themselves, with their original TResult type. Note that TResult will + // default to ApolloQueryResult if no onQueryUpdated function is passed + // to client.refetchQueries. + TResult[]; // The result of client.refetchQueries is thenable/awaitable, if you just want // an array of fully resolved results, but you can also access the raw results @@ -126,12 +123,11 @@ export type InternalRefetchQueriesResult = // If onQueryUpdated returns a boolean, that's equivalent to refetching the // query when the boolean is true and skipping the query when false, so the // internal type of refetched results is Promise>. - TResult extends boolean - ? Promise> - : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is - // not provided, TResult defaults to Promise> (see the - // generic type parameters of client.refetchQueries). - TResult; + TResult extends boolean ? Promise> + : // Otherwise, onQueryUpdated returns whatever it returns. If onQueryUpdated is + // not provided, TResult defaults to Promise> (see the + // generic type parameters of client.refetchQueries). + TResult; export type InternalRefetchQueriesMap = Map< ObservableQuery, diff --git a/src/link/core/ApolloLink.ts b/src/link/core/ApolloLink.ts index c59219727ba..ca9d2cfcd72 100644 --- a/src/link/core/ApolloLink.ts +++ b/src/link/core/ApolloLink.ts @@ -47,14 +47,14 @@ export class ApolloLink { if (isTerminating(leftLink) && isTerminating(rightLink)) { return new ApolloLink((operation) => { - return test(operation) - ? leftLink.request(operation) || Observable.of() + return test(operation) ? + leftLink.request(operation) || Observable.of() : rightLink.request(operation) || Observable.of(); }); } else { return new ApolloLink((operation, forward) => { - return test(operation) - ? leftLink.request(operation, forward) || Observable.of() + return test(operation) ? + leftLink.request(operation, forward) || Observable.of() : rightLink.request(operation, forward) || Observable.of(); }); } diff --git a/src/link/http/parseAndCheckHttpResponse.ts b/src/link/http/parseAndCheckHttpResponse.ts index feb8a88d29d..e4126f9231f 100644 --- a/src/link/http/parseAndCheckHttpResponse.ts +++ b/src/link/http/parseAndCheckHttpResponse.ts @@ -29,8 +29,9 @@ export async function readMultipartBody< // https://www.rfc-editor.org/rfc/rfc9110.html#name-parameters // e.g. multipart/mixed;boundary="graphql";deferSpec=20220824 // if no boundary is specified, default to - - const boundaryVal = contentType?.includes(delimiter) - ? contentType + const boundaryVal = + contentType?.includes(delimiter) ? + contentType ?.substring(contentType?.indexOf(delimiter) + delimiter.length) .replace(/['"]/g, "") .replace(/\;(.*)/gm, "") @@ -222,9 +223,9 @@ export function parseAndCheckHttpResponse(operations: Operation | Operation[]) { response, result, `Server response was missing for query '${ - Array.isArray(operations) - ? operations.map((op) => op.operationName) - : operations.operationName + Array.isArray(operations) ? + operations.map((op) => op.operationName) + : operations.operationName }'.` ); } diff --git a/src/link/persisted-queries/index.ts b/src/link/persisted-queries/index.ts index b2a8c97fbce..fa4c64bac58 100644 --- a/src/link/persisted-queries/index.ts +++ b/src/link/persisted-queries/index.ts @@ -186,9 +186,8 @@ export const createPersistedQueryLink = ( response, networkError, operation, - graphQLErrors: isNonEmptyArray(graphQLErrors) - ? graphQLErrors - : void 0, + graphQLErrors: + isNonEmptyArray(graphQLErrors) ? graphQLErrors : void 0, meta: processErrors(graphQLErrors), }; diff --git a/src/link/remove-typename/removeTypenameFromVariables.ts b/src/link/remove-typename/removeTypenameFromVariables.ts index f8362dddbc3..b8c173b15d2 100644 --- a/src/link/remove-typename/removeTypenameFromVariables.ts +++ b/src/link/remove-typename/removeTypenameFromVariables.ts @@ -23,8 +23,9 @@ export function removeTypenameFromVariables( const { query, variables } = operation; if (variables) { - operation.variables = except - ? maybeStripTypenameUsingConfig(query, variables, except) + operation.variables = + except ? + maybeStripTypenameUsingConfig(query, variables, except) : stripTypename(variables); } @@ -45,8 +46,9 @@ function maybeStripTypenameUsingConfig( const typename = variableDefinitions[key]; const typenameConfig = config[typename]; - keyVal[1] = typenameConfig - ? maybeStripTypename(value, typenameConfig) + keyVal[1] = + typenameConfig ? + maybeStripTypename(value, typenameConfig) : stripTypename(value); return keyVal; @@ -81,8 +83,9 @@ function maybeStripTypename( const fieldConfig = config[key]; - modified[key] = fieldConfig - ? maybeStripTypename(child, fieldConfig) + modified[key] = + fieldConfig ? + maybeStripTypename(child, fieldConfig) : stripTypename(child); }); diff --git a/src/link/schema/index.ts b/src/link/schema/index.ts index 7809ec8f8a2..336fd9c9870 100644 --- a/src/link/schema/index.ts +++ b/src/link/schema/index.ts @@ -53,9 +53,9 @@ export class SchemaLink extends ApolloLink { return new Observable((observer) => { new Promise((resolve) => resolve( - typeof this.context === "function" - ? this.context(operation) - : this.context + typeof this.context === "function" ? + this.context(operation) + : this.context ) ) .then((context) => { diff --git a/src/link/utils/transformOperation.ts b/src/link/utils/transformOperation.ts index 9e640bb97c4..7509662d5c7 100644 --- a/src/link/utils/transformOperation.ts +++ b/src/link/utils/transformOperation.ts @@ -12,9 +12,9 @@ export function transformOperation(operation: GraphQLRequest): GraphQLRequest { // Best guess at an operation name if (!transformedOperation.operationName) { transformedOperation.operationName = - typeof transformedOperation.query !== "string" - ? getOperationName(transformedOperation.query) || undefined - : ""; + typeof transformedOperation.query !== "string" ? + getOperationName(transformedOperation.query) || undefined + : ""; } return transformedOperation as Operation; diff --git a/src/react/components/__tests__/client/Query.test.tsx b/src/react/components/__tests__/client/Query.test.tsx index acdd2015301..9182e61e19e 100644 --- a/src/react/components/__tests__/client/Query.test.tsx +++ b/src/react/components/__tests__/client/Query.test.tsx @@ -369,16 +369,16 @@ describe("Query component", () => { .fetchMore({ variables: { first: 1 }, updateQuery: (prev: any, { fetchMoreResult }: any) => - fetchMoreResult - ? { - allPeople: { - people: [ - ...prev.allPeople.people, - ...fetchMoreResult.allPeople.people, - ], - }, - } - : prev, + fetchMoreResult ? + { + allPeople: { + people: [ + ...prev.allPeople.people, + ...fetchMoreResult.allPeople.people, + ], + }, + } + : prev, }) .then((result2: any) => { expect(result2.data).toEqual(data2); diff --git a/src/react/context/ApolloContext.ts b/src/react/context/ApolloContext.ts index e942e8e9dad..de6203aaadc 100644 --- a/src/react/context/ApolloContext.ts +++ b/src/react/context/ApolloContext.ts @@ -13,9 +13,8 @@ export interface ApolloContextValue { // (which can lead to problems like having an Apollo Client instance added // in one context, then attempting to retrieve it from another different // context), a single Apollo context is created and tracked in global state. -const contextKey = canUseSymbol - ? Symbol.for("__APOLLO_CONTEXT__") - : "__APOLLO_CONTEXT__"; +const contextKey = + canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__"; export function getApolloContext(): React.Context { invariant( diff --git a/src/react/hoc/__tests__/queries/recomposeWithState.ts b/src/react/hoc/__tests__/queries/recomposeWithState.ts index a1bde0a6c18..2ec2ad79756 100644 --- a/src/react/hoc/__tests__/queries/recomposeWithState.ts +++ b/src/react/hoc/__tests__/queries/recomposeWithState.ts @@ -40,9 +40,9 @@ export const withState = > { state = { stateValue: - typeof initialState === "function" - ? initialState(this.props) - : initialState, + typeof initialState === "function" ? + initialState(this.props) + : initialState, }; updateStateValue = ( diff --git a/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx b/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx index 13172453f78..0a687741f64 100644 --- a/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx +++ b/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx @@ -52,9 +52,9 @@ describe("SSR", () => { const WrappedElement = graphql(query)( ({ data }: ChildProps) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
) ); @@ -105,9 +105,9 @@ describe("SSR", () => { options: { fetchPolicy: "network-only" }, })(({ data }: ChildProps) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
)); @@ -191,9 +191,9 @@ describe("SSR", () => { const WrappedElement = graphql(query)( ({ data }: ChildProps) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
) ); @@ -282,9 +282,9 @@ describe("SSR", () => { React.PropsWithChildren> > = ({ data }) => (
- {!data || data.loading || !data.user - ? "loading" - : data.user.firstName} + {!data || data.loading || !data.user ? + "loading" + : data.user.firstName}
); @@ -365,9 +365,9 @@ describe("SSR", () => { React.PropsWithChildren> > = ({ data }) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.lastName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.lastName}
@@ -521,9 +521,9 @@ describe("SSR", () => { const Element = graphql(query)( ({ data }: ChildProps) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
) ); @@ -595,9 +595,9 @@ describe("SSR", () => { expect(this.state.thing).toBe(2); return (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
); } @@ -714,9 +714,9 @@ describe("SSR", () => { expect(this.state.client).toBe(apolloClient); return (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
); } @@ -785,9 +785,9 @@ describe("SSR", () => { options: (props) => ({ variables: props, ssr: false }), })(({ data }) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
)); @@ -939,9 +939,9 @@ describe("SSR", () => { > > = ({ data }) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
); @@ -1024,9 +1024,9 @@ describe("SSR", () => { > > = ({ data }) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
); @@ -1069,9 +1069,9 @@ describe("SSR", () => { const WrappedElement = graphql<{}, Data>(query)( ({ data }: ChildProps<{}, Data>) => (
- {!data || data.loading || !data.currentUser - ? "loading" - : data.currentUser.firstName} + {!data || data.loading || !data.currentUser ? + "loading" + : data.currentUser.firstName}
) ); diff --git a/src/react/hoc/mutation-hoc.tsx b/src/react/hoc/mutation-hoc.tsx index 7705c1eeda4..8d4162eeee0 100644 --- a/src/react/hoc/mutation-hoc.tsx +++ b/src/react/hoc/mutation-hoc.tsx @@ -97,9 +97,8 @@ export function withMutation< // this matches the query HoC const result = Object.assign(r, data || {}); const name = operationOptions.name || "mutate"; - const resultName = operationOptions.name - ? `${name}Result` - : "result"; + const resultName = + operationOptions.name ? `${name}Result` : "result"; let childProps = { [name]: mutate, [resultName]: result, diff --git a/src/react/hoc/query-hoc.tsx b/src/react/hoc/query-hoc.tsx index 144133494c6..cccabd9722f 100644 --- a/src/react/hoc/query-hoc.tsx +++ b/src/react/hoc/query-hoc.tsx @@ -60,9 +60,8 @@ export function withQuery< render() { let props = this.props; const shouldSkip = mapPropsToSkip(props); - const opts = shouldSkip - ? Object.create(null) - : { ...mapPropsToOptions(props) }; + const opts = + shouldSkip ? Object.create(null) : { ...mapPropsToOptions(props) }; if (!shouldSkip && !opts.variables && operation.variables.length > 0) { opts.variables = calculateVariablesFromProps(operation, props); diff --git a/src/react/hoc/subscription-hoc.tsx b/src/react/hoc/subscription-hoc.tsx index b044c1c2658..fd3d035599b 100644 --- a/src/react/hoc/subscription-hoc.tsx +++ b/src/react/hoc/subscription-hoc.tsx @@ -79,9 +79,8 @@ export function withSubscription< render() { let props = this.props; const shouldSkip = mapPropsToSkip(props); - const opts = shouldSkip - ? Object.create(null) - : mapPropsToOptions(props); + const opts = + shouldSkip ? Object.create(null) : mapPropsToOptions(props); if (!shouldSkip && !opts.variables && operation.variables.length > 0) { opts.variables = calculateVariablesFromProps(operation, props); diff --git a/src/react/hoc/withApollo.tsx b/src/react/hoc/withApollo.tsx index bfa21b454a4..3ec1e39ec29 100644 --- a/src/react/hoc/withApollo.tsx +++ b/src/react/hoc/withApollo.tsx @@ -49,9 +49,8 @@ export function withApollo( {(client) => { const props = Object.assign({}, this.props, { client, - ref: operationOptions.withRef - ? this.setWrappedInstance - : undefined, + ref: + operationOptions.withRef ? this.setWrappedInstance : undefined, }); return ; }} diff --git a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx index 131364939cd..32bd0edcdc0 100644 --- a/src/react/hooks/__tests__/useBackgroundQuery.test.tsx +++ b/src/react/hooks/__tests__/useBackgroundQuery.test.tsx @@ -131,7 +131,9 @@ function renderIntegrationTest({ }> - {variables ? : } + {variables ? + + : } @@ -154,17 +156,15 @@ interface VariablesCaseVariables { } function useVariablesIntegrationTestCase() { - const query: TypedDocumentNode< - VariablesCaseData, - VariablesCaseVariables - > = gql` - query CharacterQuery($id: ID!) { - character(id: $id) { - id - name + const query: TypedDocumentNode = + gql` + query CharacterQuery($id: ID!) { + character(id: $id) { + id + name + } } - } - `; + `; const CHARACTERS = ["Spider-Man", "Black Widow", "Iron Man", "Hulk"]; let mocks = [...CHARACTERS].map((name, index) => ({ request: { query, variables: { id: String(index + 1) } }, @@ -208,11 +208,11 @@ function renderVariablesIntegrationTest({ character: { ...result.data.character, name: - index > 3 - ? index > 7 - ? `${result.data.character.name} (updated again)` - : `${result.data.character.name} (updated)` - : result.data.character.name, + index > 3 ? + index > 7 ? + `${result.data.character.name} (updated again)` + : `${result.data.character.name} (updated)` + : result.data.character.name, }, }, }, @@ -274,7 +274,9 @@ function renderVariablesIntegrationTest({ return (
- {error ?
{error.message}
: null} + {error ? +
{error.message}
+ : null}