diff --git a/.api-reports/api-report-testing.md b/.api-reports/api-report-testing.md index eb8b2a052d5..2c1e6dd0195 100644 --- a/.api-reports/api-report-testing.md +++ b/.api-reports/api-report-testing.md @@ -4,8 +4,6 @@ ```ts -/// - import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; import type { ExecutionResult } from 'graphql'; @@ -13,7 +11,6 @@ import type { FieldNode } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; -import type { GraphQLSchema } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import * as React_2 from 'react'; @@ -449,21 +446,6 @@ type ConcastSourcesIterable = Iterable>; // @public (undocumented) export function createMockClient(data: TData, query: DocumentNode, variables?: {}): ApolloClient; -// @alpha -export const createSchemaFetch: (schema: GraphQLSchema, mockFetchOpts?: { - validate: boolean; -}) => ((uri: any, options: any) => Promise) & { - mockGlobal: () => { - restore: () => void; - } & Disposable; -}; - -// Warning: (ae-forgotten-export) The symbol "TestSchemaOptions" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "ProxiedSchema" needs to be exported by the entry point index.d.ts -// -// @alpha -export const createTestSchema: (schemaWithTypeDefs: GraphQLSchema, options: TestSchemaOptions) => ProxiedSchema; - // @public (undocumented) namespace DataProxy { // (undocumented) @@ -1283,11 +1265,6 @@ type Path = ReadonlyArray; // @public (undocumented) type Primitive = null | undefined | string | number | boolean | symbol | bigint; -// Warning: (ae-forgotten-export) The symbol "TestSchemaFns" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -type ProxiedSchema = GraphQLSchema & TestSchemaFns; - // @public (undocumented) class QueryInfo { constructor(queryManager: QueryManager, queryId?: string); @@ -1664,30 +1641,6 @@ interface SubscriptionOptions { variables?: TVariables; } -// @public (undocumented) -interface TestSchemaFns { - // (undocumented) - add: (addOptions: { - resolvers: Resolvers; - }) => ProxiedSchema; - // (undocumented) - fork: (forkOptions?: { - resolvers?: Resolvers; - }) => ProxiedSchema; - // (undocumented) - reset: () => void; -} - -// @public (undocumented) -interface TestSchemaOptions { - // (undocumented) - resolvers: Resolvers; - // (undocumented) - scalars?: { - [key: string]: any; - }; -} - // @public (undocumented) export function tick(): Promise; diff --git a/.api-reports/api-report-testing_alpha.md b/.api-reports/api-report-testing_alpha.md new file mode 100644 index 00000000000..ddc1bcc113e --- /dev/null +++ b/.api-reports/api-report-testing_alpha.md @@ -0,0 +1,85 @@ +## API Report File for "@apollo/client" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +import type { FieldNode } from 'graphql'; +import type { FragmentDefinitionNode } from 'graphql'; +import type { GraphQLSchema } from 'graphql'; + +// @alpha +export const createSchemaFetch: (schema: GraphQLSchema, mockFetchOpts?: { + validate: boolean; +}) => ((uri: any, options: any) => Promise) & { + mockGlobal: () => { + restore: () => void; + } & Disposable; +}; + +// Warning: (ae-forgotten-export) The symbol "TestSchemaOptions" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "ProxiedSchema" needs to be exported by the entry point index.d.ts +// +// @alpha +export const createTestSchema: (schemaWithTypeDefs: GraphQLSchema, options: TestSchemaOptions) => ProxiedSchema; + +// @public +interface FragmentMap { + // (undocumented) + [fragmentName: string]: FragmentDefinitionNode; +} + +// Warning: (ae-forgotten-export) The symbol "TestSchemaFns" needs to be exported by the entry point index.d.ts +// +// @public (undocumented) +type ProxiedSchema = GraphQLSchema & TestSchemaFns; + +// @public (undocumented) +type Resolver = (rootValue?: any, args?: any, context?: any, info?: { + field: FieldNode; + fragmentMap: FragmentMap; +}) => any; + +// @public (undocumented) +interface Resolvers { + // (undocumented) + [key: string]: { + [field: string]: Resolver; + }; +} + +// @public (undocumented) +interface TestSchemaFns { + // (undocumented) + add: (addOptions: { + resolvers: Resolvers; + }) => ProxiedSchema; + // (undocumented) + fork: (forkOptions?: { + resolvers?: Resolvers; + }) => ProxiedSchema; + // (undocumented) + reset: () => void; +} + +// @public (undocumented) +interface TestSchemaOptions { + // (undocumented) + resolvers: Resolvers; + // (undocumented) + scalars?: { + [key: string]: any; + }; +} + +// Warnings were encountered during analysis: +// +// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts +// src/core/types.ts:203:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts +// src/testing/alpha/createTestSchema.ts:10:23 - (ae-forgotten-export) The symbol "Resolvers" 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 259a5a2c9bd..da8706e0df2 100644 --- a/.api-reports/api-report-testing_core.md +++ b/.api-reports/api-report-testing_core.md @@ -4,8 +4,6 @@ ```ts -/// - import type { ASTNode } from 'graphql'; import type { DocumentNode } from 'graphql'; import type { ExecutionResult } from 'graphql'; @@ -13,7 +11,6 @@ import type { FieldNode } from 'graphql'; import type { FragmentDefinitionNode } from 'graphql'; import type { GraphQLError } from 'graphql'; import type { GraphQLErrorExtensions } from 'graphql'; -import type { GraphQLSchema } from 'graphql'; import { Observable } from 'zen-observable-ts'; import type { Observer } from 'zen-observable-ts'; import type { Subscriber } from 'zen-observable-ts'; @@ -448,21 +445,6 @@ type ConcastSourcesIterable = Iterable>; // @public (undocumented) export function createMockClient(data: TData, query: DocumentNode, variables?: {}): ApolloClient; -// @alpha -export const createSchemaFetch: (schema: GraphQLSchema, mockFetchOpts?: { - validate: boolean; -}) => ((uri: any, options: any) => Promise) & { - mockGlobal: () => { - restore: () => void; - } & Disposable; -}; - -// Warning: (ae-forgotten-export) The symbol "TestSchemaOptions" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "ProxiedSchema" needs to be exported by the entry point index.d.ts -// -// @alpha -export const createTestSchema: (schemaWithTypeDefs: GraphQLSchema, options: TestSchemaOptions) => ProxiedSchema; - // @public (undocumented) namespace DataProxy { // (undocumented) @@ -1238,11 +1220,6 @@ type Path = ReadonlyArray; // @public (undocumented) type Primitive = null | undefined | string | number | boolean | symbol | bigint; -// Warning: (ae-forgotten-export) The symbol "TestSchemaFns" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -type ProxiedSchema = GraphQLSchema & TestSchemaFns; - // @public (undocumented) class QueryInfo { constructor(queryManager: QueryManager, queryId?: string); @@ -1621,30 +1598,6 @@ interface SubscriptionOptions { variables?: TVariables; } -// @public (undocumented) -interface TestSchemaFns { - // (undocumented) - add: (addOptions: { - resolvers: Resolvers; - }) => ProxiedSchema; - // (undocumented) - fork: (forkOptions?: { - resolvers?: Resolvers; - }) => ProxiedSchema; - // (undocumented) - reset: () => void; -} - -// @public (undocumented) -interface TestSchemaOptions { - // (undocumented) - resolvers: Resolvers; - // (undocumented) - scalars?: { - [key: string]: any; - }; -} - // @public (undocumented) export function tick(): Promise; diff --git a/config/entryPoints.js b/config/entryPoints.js index cad194d61aa..cba8cfcbfe9 100644 --- a/config/entryPoints.js +++ b/config/entryPoints.js @@ -27,6 +27,7 @@ const entryPoints = [ { dirs: ["react", "ssr"] }, { dirs: ["testing"], extensions: [".js", ".jsx"] }, { dirs: ["testing", "core"] }, + { dirs: ["testing", "alpha"] }, { dirs: ["utilities"] }, { dirs: ["utilities", "subscriptions", "relay"] }, { dirs: ["utilities", "subscriptions", "urql"] }, diff --git a/src/__tests__/__snapshots__/exports.ts.snap b/src/__tests__/__snapshots__/exports.ts.snap index 11cd795a396..4b1abb5efa2 100644 --- a/src/__tests__/__snapshots__/exports.ts.snap +++ b/src/__tests__/__snapshots__/exports.ts.snap @@ -369,8 +369,6 @@ Array [ "MockSubscriptionLink", "MockedProvider", "createMockClient", - "createSchemaFetch", - "createTestSchema", "itAsync", "mockObservableLink", "mockSingleLink", @@ -383,13 +381,18 @@ Array [ ] `; +exports[`exports of public entry points @apollo/client/testing/alpha 1`] = ` +Array [ + "createSchemaFetch", + "createTestSchema", +] +`; + exports[`exports of public entry points @apollo/client/testing/core 1`] = ` Array [ "MockLink", "MockSubscriptionLink", "createMockClient", - "createSchemaFetch", - "createTestSchema", "itAsync", "mockObservableLink", "mockSingleLink", diff --git a/src/__tests__/exports.ts b/src/__tests__/exports.ts index 181a1cc2b0a..d4b1900443a 100644 --- a/src/__tests__/exports.ts +++ b/src/__tests__/exports.ts @@ -31,6 +31,7 @@ import * as reactParser from "../react/parser"; import * as reactSSR from "../react/ssr"; import * as testing from "../testing"; import * as testingCore from "../testing/core"; +import * as testingAlpha from "../testing/alpha"; import * as utilities from "../utilities"; import * as utilitiesGlobals from "../utilities/globals"; import * as urqlUtilities from "../utilities/subscriptions/urql"; @@ -77,6 +78,7 @@ describe("exports of public entry points", () => { check("@apollo/client/react/ssr", reactSSR); check("@apollo/client/testing", testing); check("@apollo/client/testing/core", testingCore); + check("@apollo/client/testing/alpha", testingAlpha); check("@apollo/client/utilities", utilities); check("@apollo/client/utilities/globals", utilitiesGlobals); check("@apollo/client/utilities/subscriptions/urql", urqlUtilities); diff --git a/src/testing/core/__tests__/createTestSchema.test.tsx b/src/testing/alpha/__tests__/createTestSchema.test.tsx similarity index 100% rename from src/testing/core/__tests__/createTestSchema.test.tsx rename to src/testing/alpha/__tests__/createTestSchema.test.tsx diff --git a/src/testing/core/createSchemaFetch.ts b/src/testing/alpha/createSchemaFetch.ts similarity index 100% rename from src/testing/core/createSchemaFetch.ts rename to src/testing/alpha/createSchemaFetch.ts diff --git a/src/testing/core/createTestSchema.ts b/src/testing/alpha/createTestSchema.ts similarity index 98% rename from src/testing/core/createTestSchema.ts rename to src/testing/alpha/createTestSchema.ts index a294223440e..694b821ae1f 100644 --- a/src/testing/core/createTestSchema.ts +++ b/src/testing/alpha/createTestSchema.ts @@ -1,7 +1,7 @@ import { addResolversToSchema } from "@graphql-tools/schema"; import type { GraphQLSchema } from "graphql"; -import { createMockSchema } from "../graphql-tools/utils.js"; +import { createMockSchema } from "./graphql-tools/utils.js"; import type { Resolvers } from "../../core/types.js"; type ProxiedSchema = GraphQLSchema & TestSchemaFns; diff --git a/src/testing/graphql-tools/LICENSE b/src/testing/alpha/graphql-tools/LICENSE similarity index 100% rename from src/testing/graphql-tools/LICENSE rename to src/testing/alpha/graphql-tools/LICENSE diff --git a/src/testing/graphql-tools/utils.test.ts b/src/testing/alpha/graphql-tools/utils.test.ts similarity index 100% rename from src/testing/graphql-tools/utils.test.ts rename to src/testing/alpha/graphql-tools/utils.test.ts diff --git a/src/testing/graphql-tools/utils.ts b/src/testing/alpha/graphql-tools/utils.ts similarity index 99% rename from src/testing/graphql-tools/utils.ts rename to src/testing/alpha/graphql-tools/utils.ts index 629802eb5bd..4ff08d7ab0f 100644 --- a/src/testing/graphql-tools/utils.ts +++ b/src/testing/alpha/graphql-tools/utils.ts @@ -20,7 +20,7 @@ import { isUnionType, } from "graphql"; -import { isNonNullObject } from "../../utilities/index.js"; +import { isNonNullObject } from "../../../utilities/index.js"; import { MapperKind, mapSchema, getRootTypeNames } from "@graphql-tools/utils"; // Taken from @graphql-tools/mock: diff --git a/src/testing/alpha/index.ts b/src/testing/alpha/index.ts new file mode 100644 index 00000000000..a7080de66d2 --- /dev/null +++ b/src/testing/alpha/index.ts @@ -0,0 +1,2 @@ +export { createTestSchema } from "./createTestSchema.js"; +export { createSchemaFetch } from "./createSchemaFetch.js"; diff --git a/src/testing/core/index.ts b/src/testing/core/index.ts index 3aaad32032b..e999590509a 100644 --- a/src/testing/core/index.ts +++ b/src/testing/core/index.ts @@ -12,6 +12,4 @@ export { createMockClient } from "./mocking/mockClient.js"; export { default as subscribeAndCount } from "./subscribeAndCount.js"; export { itAsync } from "./itAsync.js"; export { wait, tick } from "./wait.js"; -export { createTestSchema } from "./createTestSchema.js"; -export { createSchemaFetch } from "./createSchemaFetch.js"; export * from "./withConsoleSpy.js";