├── website ├── static │ ├── .nojekyll │ └── img │ │ ├── favicon.ico │ │ ├── graphitation-logo.png │ │ ├── graphitation-logo.pxd │ │ ├── graphql-logo-black.png │ │ ├── graphql-logo-rhodamine.png │ │ ├── tutorial │ │ ├── localeDropdown.png │ │ └── docsVersionDropdown.png │ │ └── graphitation-logo-only-capital.pxd ├── docs │ ├── packages │ │ ├── _category_.json │ │ └── apollo-react-relay-duct-tape │ │ │ ├── _category_.json │ │ │ └── intro.md │ └── learn-graphql │ │ ├── _category_.json │ │ ├── guides │ │ ├── _category_.json │ │ ├── slidedeck │ │ │ ├── Slide10.png │ │ │ ├── Slide11.png │ │ │ ├── Slide13.png │ │ │ ├── Slide14.png │ │ │ ├── Slide18.png │ │ │ ├── Slide19.png │ │ │ ├── Slide2.png │ │ │ ├── Slide20.png │ │ │ ├── Slide22.png │ │ │ ├── Slide25.png │ │ │ ├── Slide3.png │ │ │ ├── Slide4.png │ │ │ └── Slide7+8+9.png │ │ ├── images │ │ │ └── SmallChatList.png │ │ └── graphql-client.md │ │ ├── howto │ │ ├── _category_.json │ │ └── models.md │ │ └── faq.md ├── babel.config.js ├── src │ ├── pages │ │ ├── markdown-page.md │ │ └── index.module.css │ └── components │ │ └── HomepageFeatures.module.css ├── tsconfig.json ├── .gitignore ├── sidebars.js └── README.md ├── packages ├── cli │ ├── .gitignore │ ├── README.md │ ├── .eslintrc.json │ ├── bin │ │ └── supermassive.js │ └── tsconfig.json ├── supermassive │ ├── starwars.json │ ├── .gitignore │ ├── resources │ │ └── starwars.json │ ├── .eslintrc.json │ ├── src │ │ ├── jsutils │ │ │ ├── PromiseOrValue.ts │ │ │ ├── IterableOrAsyncIterable.ts │ │ │ ├── identityFunc.ts │ │ │ ├── Maybe.ts │ │ │ ├── NOTICE │ │ │ ├── devAssert.ts │ │ │ ├── README.md │ │ │ ├── isPromise.ts │ │ │ ├── isObjectLike.ts │ │ │ ├── ObjMap.ts │ │ │ ├── invariant.ts │ │ │ ├── isAsyncIterable.ts │ │ │ ├── AccumulatorMap.ts │ │ │ ├── printPathArray.ts │ │ │ ├── mapValue.ts │ │ │ ├── toObjMap.ts │ │ │ ├── promiseForObject.ts │ │ │ ├── Path.ts │ │ │ ├── keyValMap.ts │ │ │ └── promiseReduce.ts │ │ ├── utilities │ │ │ ├── blankGraphQLTag.ts │ │ │ ├── __tests__ │ │ │ │ ├── fixtures │ │ │ │ │ ├── esModuleResolvers.ts │ │ │ │ │ └── schemaWithBooleanParameter.ts │ │ │ │ └── encodeASTSchema.test.ts │ │ │ ├── typeNameFromAST.ts │ │ │ ├── array.ts │ │ │ ├── annotateDocumentGraphQLTransform.ts │ │ │ └── schemaFragmentFromMinimalViableSchemaDocument.ts │ │ ├── benchmarks │ │ │ ├── swapi-schema │ │ │ │ ├── models.ts │ │ │ │ └── index.ts │ │ │ ├── fixtures │ │ │ │ └── query1.graphql │ │ │ └── nice-benchmark.ts │ │ ├── __testUtils__ │ │ │ └── gql.ts │ │ └── legacyAST │ │ │ └── annotateDocumentGraphQLTransform.ts │ └── tsconfig.json ├── ts-codegen │ ├── .gitignore │ ├── .eslintrc.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── supermassive-extractors │ ├── .gitignore │ ├── .eslintrc.json │ ├── README.md │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── apollo-forest-run-benchmark │ ├── .gitignore │ ├── .eslintrc.json │ ├── tsconfig.json │ ├── src │ │ ├── utils │ │ │ ├── __tests__ │ │ │ │ └── garbage-collection.test.ts │ │ │ ├── file.ts │ │ │ └── garbage-collection.ts │ │ ├── config.ts │ │ └── summary │ │ │ └── analyze-results.ts │ └── data │ │ └── queries │ │ └── add-task.graphql ├── apollo-forest-run │ ├── compat │ │ ├── src │ │ │ ├── version.ts │ │ │ ├── link │ │ │ │ ├── batch │ │ │ │ │ └── index.ts │ │ │ │ ├── retry │ │ │ │ │ └── index.ts │ │ │ │ ├── batch-http │ │ │ │ │ └── index.ts │ │ │ │ ├── core │ │ │ │ │ ├── from.ts │ │ │ │ │ ├── empty.ts │ │ │ │ │ ├── split.ts │ │ │ │ │ ├── concat.ts │ │ │ │ │ ├── execute.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── utils │ │ │ │ │ ├── fromError.ts │ │ │ │ │ ├── fromPromise.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ ├── fromError.ts │ │ │ │ │ │ ├── validateOperation.ts │ │ │ │ │ │ └── fromPromise.ts │ │ │ │ │ ├── throwServerError.ts │ │ │ │ │ ├── validateOperation.ts │ │ │ │ │ ├── toPromise.ts │ │ │ │ │ ├── createOperation.ts │ │ │ │ │ └── transformOperation.ts │ │ │ │ └── http │ │ │ │ │ ├── createSignalIfSupported.ts │ │ │ │ │ ├── HttpLink.ts │ │ │ │ │ ├── selectURI.ts │ │ │ │ │ ├── __tests__ │ │ │ │ │ ├── checkFetcher.ts │ │ │ │ │ ├── serializeFetchParameter.ts │ │ │ │ │ └── helpers.ts │ │ │ │ │ ├── serializeFetchParameter.ts │ │ │ │ │ ├── checkFetcher.ts │ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── utilities │ │ │ │ ├── globals │ │ │ │ │ ├── maybe.ts │ │ │ │ │ └── fix-graphql.ts │ │ │ │ ├── common │ │ │ │ │ ├── arrays.ts │ │ │ │ │ ├── objects.ts │ │ │ │ │ ├── errorHandling.ts │ │ │ │ │ ├── stringifyForDisplay.ts │ │ │ │ │ ├── filterInPlace.ts │ │ │ │ │ ├── makeUniqueId.ts │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ └── canUse.ts │ │ │ │ │ ├── compact.ts │ │ │ │ │ └── mergeOptions.ts │ │ │ │ ├── observables │ │ │ │ │ ├── iteration.ts │ │ │ │ │ └── Observable.ts │ │ │ │ └── graphql │ │ │ │ │ └── __tests__ │ │ │ │ │ └── storeUtils.ts │ │ │ ├── testing │ │ │ │ ├── index.ts │ │ │ │ └── core │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── mocking │ │ │ │ │ ├── mockQueryManager.ts │ │ │ │ │ ├── mockClient.ts │ │ │ │ │ └── mockWatchQuery.ts │ │ │ │ │ ├── itAsync.ts │ │ │ │ │ └── wrap.ts │ │ │ ├── cache │ │ │ │ └── inmemory │ │ │ │ │ ├── __mocks__ │ │ │ │ │ └── optimism.ts │ │ │ │ │ ├── __tests__ │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ ├── readFromStore.ts.snap │ │ │ │ │ │ └── fragmentMatcher.ts.snap │ │ │ │ │ └── fixPolyfills.ts │ │ │ ├── react │ │ │ │ ├── components │ │ │ │ │ └── index.ts │ │ │ │ ├── ssr │ │ │ │ │ ├── index.ts │ │ │ │ │ └── renderToStringWithData.ts │ │ │ │ ├── hooks │ │ │ │ │ ├── index.ts │ │ │ │ │ └── useApolloClient.ts │ │ │ │ ├── hoc │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ └── queries │ │ │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ │ └── lifecycle.test.tsx.snap │ │ │ │ │ └── index.ts │ │ │ │ ├── context │ │ │ │ │ ├── index.ts │ │ │ │ │ └── ApolloConsumer.tsx │ │ │ │ └── index.ts │ │ │ ├── config │ │ │ │ └── jest │ │ │ │ │ └── setup.ts │ │ │ └── __tests__ │ │ │ │ └── __snapshots__ │ │ │ │ ├── graphqlSubscriptions.ts.snap │ │ │ │ └── mutationResults.ts.snap │ │ ├── config │ │ │ └── jest.config.js │ │ └── tsconfig.json │ ├── .eslintrc.json │ ├── src │ │ ├── diff │ │ │ ├── itemChangeKind.ts │ │ │ ├── diffErrorKind.ts │ │ │ └── differenceKind.ts │ │ ├── values │ │ │ ├── index.ts │ │ │ └── valueKind.ts │ │ ├── jsutils │ │ │ ├── assert.ts │ │ │ ├── normalize.ts │ │ │ └── circularBuffer.ts │ │ └── telemetry │ │ │ └── updateStats │ │ │ └── logUpdateStats.ts │ ├── docs │ │ └── benchmark.png │ └── tsconfig.json ├── graphql-js-tag │ ├── .eslintrc.json │ ├── tsconfig.json │ └── README.md ├── apollo-mock-client │ ├── .eslintrc.json │ └── tsconfig.json ├── graphql-eslint-rules │ ├── .eslintrc.json │ ├── tsconfig.json │ ├── README.md │ └── src │ │ ├── __tests__ │ │ ├── __snapshots__ │ │ │ ├── non-nullable-list-items.test.ts.snap │ │ │ └── non-nullable-fields.test.ts.snap │ │ ├── non-nullable-list-items.test.ts │ │ └── non-nullable-fields.test.ts │ │ └── non-nullable-list-items.ts ├── rempl-apollo-devtools │ ├── src │ │ ├── subscriber │ │ │ ├── graphiql │ │ │ │ ├── index.tsx │ │ │ │ └── graphiql.styles.ts │ │ │ ├── apollo-operations-tracker │ │ │ │ └── index.ts │ │ │ ├── apollo-cache │ │ │ │ ├── index.ts │ │ │ │ ├── history │ │ │ │ │ ├── shared │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── components │ │ │ │ │ │ │ └── index.ts │ │ │ │ │ │ └── styles │ │ │ │ │ │ │ └── spacing.ts │ │ │ │ │ ├── hooks │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── VirtualizedJsonViewer.tsx │ │ │ │ │ ├── components │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── VirtualizedJsonViewer.styles.ts │ │ │ │ └── types.ts │ │ │ ├── rempl.ts │ │ │ ├── styles.css │ │ │ ├── apollo-additional-informations │ │ │ │ ├── index.ts │ │ │ │ ├── additional-informations-container.tsx │ │ │ │ └── additional-info.styles.ts │ │ │ ├── apollo-tracker │ │ │ │ ├── index.ts │ │ │ │ ├── Mutations │ │ │ │ │ ├── mutations.styles.ts │ │ │ │ │ └── mutations-container.tsx │ │ │ │ └── Queries │ │ │ │ │ ├── watched-queries.styles.ts │ │ │ │ │ └── watched-queries-container.tsx │ │ │ ├── types.ts │ │ │ └── index.tsx │ │ ├── consts.ts │ │ ├── history │ │ │ └── types.ts │ │ └── components │ │ │ ├── index.ts │ │ │ ├── common.styles.ts │ │ │ └── search │ │ │ ├── search.tsx │ │ │ └── search.styles.ts │ ├── apollo-devtools-maglev.css │ ├── docs │ │ ├── graphiql.png │ │ ├── cache-inspector.png │ │ ├── recent-activity.png │ │ ├── operations-monitor.png │ │ ├── affected-queries-view.png │ │ ├── operation-tracker-result.png │ │ ├── operations-tracker-copy.png │ │ └── operations-tracker-detailed-view.png │ ├── .eslintrc.json │ ├── apollo-devtools-multi-window.css │ └── tsconfig.json ├── apollo-react-relay-duct-tape │ ├── .eslintrc.json │ ├── src │ │ ├── index.ts │ │ ├── storeObservation │ │ │ ├── compiledHooks │ │ │ │ ├── useForceUpdate.ts │ │ │ │ ├── index.ts │ │ │ │ └── types.ts │ │ │ ├── index.ts │ │ │ ├── fragmentReferencesFieldPolicy.ts │ │ │ └── __tests__ │ │ │ │ └── __generated__ │ │ │ │ ├── compiledHooks_ChildFragment.graphql.ts │ │ │ │ ├── compiledHooks_QueryTypeFragment.graphql.ts │ │ │ │ └── compiledHooks_RefetchableFragment.graphql.ts │ │ ├── __tests__ │ │ │ └── __generated__ │ │ │ │ ├── hooksTestQuery.graphql.ts │ │ │ │ ├── hooksTestMutation.graphql.ts │ │ │ │ ├── hooksTestSubscription.graphql.ts │ │ │ │ └── hooksTestFragment.graphql.ts │ │ └── convertFetchPolicy.ts │ └── tsconfig.json ├── ts-transform-graphql-js-tag │ ├── .eslintrc.json │ └── tsconfig.json ├── graphql-codegen-resolvers-models │ ├── .eslintrc.json │ ├── README.md │ ├── tsconfig.json │ └── src │ │ └── config.ts ├── embedded-document-artefact-loader │ ├── src │ │ ├── __tests__ │ │ │ ├── tsconfig.json │ │ │ ├── fixtures │ │ │ │ ├── __generated__ │ │ │ │ │ └── SomeComponent_query.graphql.ts │ │ │ │ ├── a-jest-test-without-doc.ts │ │ │ │ └── a-jest-test.ts │ │ │ ├── tmp │ │ │ │ ├── test.out │ │ │ │ ├── test.in │ │ │ │ └── test.map │ │ │ └── utils │ │ │ │ └── simple-ts-loader.ts │ │ ├── addInlineSourceMap.ts │ │ └── source-map-utils.ts │ └── tsconfig.json ├── graphql-codegen-typescript-operations │ ├── .eslintrc.json │ ├── README.md │ └── tsconfig.json ├── graphql-js-operation-payload-generator │ ├── .eslintrc.json │ ├── src │ │ └── relay-test-utils-internal.d.ts │ ├── tsconfig.json │ └── scripts │ │ └── graphql-codegen.ts ├── graphql-codegen-typescript-typemap-plugin │ ├── .eslintrc.json │ ├── README.md │ └── tsconfig.json ├── graphql-codegen-supermassive-schema-extraction-plugin │ ├── .eslintrc.json │ ├── tsconfig.json │ └── README.md ├── graphql-codegen-supermassive-typed-document-node-plugin │ ├── .eslintrc.json │ ├── README.md │ └── tsconfig.json ├── graphql-codegen-near-operation-file-preset-with-resolver-metadata │ ├── README.md │ ├── .eslintrc.json │ ├── tsconfig.json │ ├── CHANGELOG.md │ └── CHANGELOG.json ├── apollo-react-relay-duct-tape-compiler │ ├── src │ │ ├── index.ts │ │ ├── typescriptTransforms │ │ │ ├── __tests__ │ │ │ │ └── fixtures │ │ │ │ │ ├── type-generator │ │ │ │ │ ├── plural-fragment.graphql │ │ │ │ │ ├── recursive-fragments.graphql │ │ │ │ │ ├── mutation-with-delete-record.graphql │ │ │ │ │ ├── refetchable-fragment.graphql │ │ │ │ │ ├── conditional.graphql │ │ │ │ │ ├── mutation-input-has-array.graphql │ │ │ │ │ ├── scalar-field.graphql │ │ │ │ │ ├── mutation.graphql │ │ │ │ │ ├── typename-inside-with-overlapping-fields.graphql │ │ │ │ │ ├── mutation-with-client-extension.graphql │ │ │ │ │ ├── query-with-raw-response-on-conditional.graphql │ │ │ │ │ ├── query-with-mering-scalars.error.graphql │ │ │ │ │ ├── query-with-defer.graphql │ │ │ │ │ ├── query-with-stream.graphql │ │ │ │ │ ├── query-with-stream-connection.graphql │ │ │ │ │ ├── query-with-mering-scalars.graphql │ │ │ │ │ ├── linked-field.graphql │ │ │ │ │ ├── query-with-handles.graphql │ │ │ │ │ ├── query-with-raw-response-on-literal-conditional.graphql │ │ │ │ │ ├── roots.graphql │ │ │ │ │ ├── match-field.graphql │ │ │ │ │ ├── mutation-with-response-on-inline-fragments.graphql │ │ │ │ │ ├── match-field-in-query.graphql │ │ │ │ │ ├── mutation-with-enums-on-fragment.graphql │ │ │ │ │ ├── unmasked-fragment-spreads.graphql │ │ │ │ │ ├── mutation-with-append-prepend-edge.graphql │ │ │ │ │ ├── mutation-with-nested-fragments.graphql │ │ │ │ │ ├── relay-client-id-field.graphql │ │ │ │ │ └── fragment-spread.graphql │ │ │ │ │ └── type-generator-disabled │ │ │ │ │ ├── query-with-module-field.graphql │ │ │ │ │ └── query-with-match-fields.graphql │ │ │ └── ambient.d.ts │ │ ├── types.ts │ │ ├── compilerTransforms │ │ │ └── utils.ts │ │ ├── typings.d.ts │ │ ├── __tests__ │ │ │ └── rewriteGraphitationDirectives.test.ts │ │ ├── cli-cjs.js │ │ └── typeGenerator.ts │ ├── README.md │ └── tsconfig.json └── webpack-loader │ └── tsconfig.json ├── .prettierrc ├── examples ├── supermassive-todomvc │ ├── .gitignore │ ├── .prettierrc │ ├── src │ │ ├── schema │ │ │ ├── models.ts │ │ │ ├── schema.ts │ │ │ ├── utils.ts │ │ │ └── asyncSplit.ts │ │ ├── graphql.d.ts │ │ ├── index.tsx │ │ └── components │ │ │ ├── __generated__ │ │ │ ├── TodoListQuery.graphql.ts │ │ │ ├── TodoFragment.graphql.ts │ │ │ └── TodoUpdatesSubscription.graphql.ts │ │ │ ├── Todo.tsx │ │ │ └── TodoUpdates.tsx │ ├── tsconfig-cli.json │ └── tsconfig.json ├── apollo-watch-fragments │ ├── src │ │ ├── react-app-env.d.ts │ │ ├── wdyr.ts │ │ ├── LoadingSpinner.tsx │ │ ├── index.tsx │ │ └── __generated__ │ │ │ ├── TodoListFooter_todosFragment.graphql.ts │ │ │ └── Todo_todoFragment.graphql.ts │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ └── manifest.json │ ├── codegen.yml │ ├── design.md │ └── tsconfig.json └── apollo-devtools-playground │ ├── src │ ├── react-app-env.d.ts │ ├── data │ │ ├── utils │ │ │ └── sleep.ts │ │ └── typeDefs.ts │ ├── index.tsx │ ├── setupTests.ts │ └── components │ │ └── chat │ │ ├── messages.styles.ts │ │ └── chat-renderer.styles.ts │ ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── subscriber.html │ └── manifest.json │ ├── .gitignore │ └── tsconfig.json ├── .gitattributes ├── package-template ├── .eslintrc.json ├── src │ ├── cli.ts │ ├── index.ts │ ├── __tests__ │ │ └── index.test.ts │ └── cli-cjs.js ├── README.md └── tsconfig.json ├── lage.config.js ├── .editorconfig ├── .npmignore ├── scripts ├── bin │ └── monorepo-scripts.js ├── config │ └── jest.config.js └── package.json ├── .gitignore ├── change └── @graphitation-supermassive-463d5e07-54e8-48a7-a524-bbddb8296a5d.json ├── tsconfig.json ├── CODE_OF_CONDUCT.md ├── .vscode ├── settings.json └── launch.json ├── .github └── workflows │ └── pr.yml ├── patches ├── source-map-js+1.2.1.patch ├── @graphql-tools+schema+8.3.1.patch ├── relay-compiler+12.0.0.patch └── relay-test-utils-internal+12.0.0.patch └── .config └── 1espt └── PipelineAutobaseliningConfig.yml /website/static/.nojekyll: -------------------------------------------------------------------------------- 1 | Hyde 2 | -------------------------------------------------------------------------------- /packages/cli/.gitignore: -------------------------------------------------------------------------------- 1 | __generated__ 2 | -------------------------------------------------------------------------------- /packages/supermassive/starwars.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/ts-codegen/.gitignore: -------------------------------------------------------------------------------- 1 | __generated__ 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all" 3 | } 4 | -------------------------------------------------------------------------------- /packages/supermassive/.gitignore: -------------------------------------------------------------------------------- 1 | __generated__ 2 | -------------------------------------------------------------------------------- /packages/supermassive/resources/starwars.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/cli/README.md: -------------------------------------------------------------------------------- 1 | # grahitation-cli 2 | 3 | TODO 4 | -------------------------------------------------------------------------------- /packages/supermassive-extractors/.gitignore: -------------------------------------------------------------------------------- 1 | __generated__ 2 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | forest-runs 2 | results -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/version.ts: -------------------------------------------------------------------------------- 1 | export const version = 'local'; 2 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | yarn-error.log 4 | stats/ -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/batch/index.ts: -------------------------------------------------------------------------------- 1 | export * from './batchLink'; 2 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/retry/index.ts: -------------------------------------------------------------------------------- 1 | export * from './retryLink'; 2 | -------------------------------------------------------------------------------- /packages/supermassive/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"] 3 | } 4 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 2, 3 | "useTabs": false 4 | } 5 | -------------------------------------------------------------------------------- /website/docs/packages/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Packages", 3 | "position": 2 4 | } 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | /.yarn/** linguist-vendored 2 | 3 | * text=auto eol=lf 4 | yarn.lock text eol=lf 5 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"] 3 | } -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './core'; 2 | export * from './react'; 3 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/batch-http/index.ts: -------------------------------------------------------------------------------- 1 | export * from './batchHttpLink'; 2 | -------------------------------------------------------------------------------- /packages/cli/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/PromiseOrValue.ts: -------------------------------------------------------------------------------- 1 | export type PromiseOrValue = Promise | T; 2 | -------------------------------------------------------------------------------- /package-template/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/ts-codegen/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /website/docs/learn-graphql/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Learn GraphQL", 3 | "position": 1 4 | } 5 | -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Guides", 3 | "position": 2 4 | } 5 | -------------------------------------------------------------------------------- /website/docs/learn-graphql/howto/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "How-To", 3 | "position": 3 4 | } 5 | -------------------------------------------------------------------------------- /packages/graphql-js-tag/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/apollo-mock-client/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/graphiql/index.tsx: -------------------------------------------------------------------------------- 1 | export { GraphiQLRenderer } from "./graphiql"; 2 | -------------------------------------------------------------------------------- /website/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/favicon.ico -------------------------------------------------------------------------------- /packages/supermassive-extractors/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/supermassive-extractors/README.md: -------------------------------------------------------------------------------- 1 | @graphitation/supermasive-extractors extract implicit resolvers. 2 | 3 | TODO 4 | -------------------------------------------------------------------------------- /packages/ts-transform-graphql-js-tag/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /website/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve("@docusaurus/core/lib/babel/preset")], 3 | }; 4 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/diff/itemChangeKind.ts: -------------------------------------------------------------------------------- 1 | export const ItemAdd = 0, 2 | ItemRemove = 1, 3 | ItemIndexChange = 2; 4 | -------------------------------------------------------------------------------- /packages/graphql-codegen-resolvers-models/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-operations-tracker/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./operations-tracker-container"; 2 | -------------------------------------------------------------------------------- /packages/ts-codegen/src/index.ts: -------------------------------------------------------------------------------- 1 | export { generateTS } from "./codegen"; 2 | export type { ContextTypeExtension } from "./types"; 3 | -------------------------------------------------------------------------------- /package-template/src/cli.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | function main() { 4 | console.log("Hello world"); 5 | } 6 | 7 | main(); 8 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "baseUrl": ".", 3 | "files": ["fixture.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/graphql-codegen-typescript-operations/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/graphql-js-operation-payload-generator/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/IterableOrAsyncIterable.ts: -------------------------------------------------------------------------------- 1 | export type IterableOrAsyncIterable = Iterable | AsyncIterable; 2 | -------------------------------------------------------------------------------- /website/static/img/graphitation-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/graphitation-logo.png -------------------------------------------------------------------------------- /website/static/img/graphitation-logo.pxd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/graphitation-logo.pxd -------------------------------------------------------------------------------- /package-template/src/index.ts: -------------------------------------------------------------------------------- 1 | export function bar(input: string) { 2 | return `bar ${input} - adding change without a change file`; 3 | } 4 | -------------------------------------------------------------------------------- /packages/graphql-codegen-typescript-typemap-plugin/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/apollo-devtools-maglev.css: -------------------------------------------------------------------------------- 1 | body > div[side="top"], 2 | body > div[side="right"] { 3 | top: 40px; 4 | } 5 | -------------------------------------------------------------------------------- /website/static/img/graphql-logo-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/graphql-logo-black.png -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/core/from.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from './ApolloLink'; 2 | 3 | export const from = ApolloLink.from; 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/docs/benchmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/apollo-forest-run/docs/benchmark.png -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/fixtures/__generated__/SomeComponent_query.graphql.ts: -------------------------------------------------------------------------------- 1 | export default "hello world"; 2 | -------------------------------------------------------------------------------- /website/docs/packages/apollo-react-relay-duct-tape/_category_.json: -------------------------------------------------------------------------------- 1 | { 2 | "label": "Apollo React/Relay Duct-Tape", 3 | "position": 3 4 | } 5 | -------------------------------------------------------------------------------- /website/static/img/graphql-logo-rhodamine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/graphql-logo-rhodamine.png -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | build 3 | apollo-devtools.js 4 | apollo-devtools.js.map 5 | public/apollo-devtools-* 6 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/core/empty.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from './ApolloLink'; 2 | 3 | export const empty = ApolloLink.empty; 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/core/split.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from './ApolloLink'; 2 | 3 | export const split = ApolloLink.split; 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/diff/diffErrorKind.ts: -------------------------------------------------------------------------------- 1 | export const MissingModelValue = 0, 2 | MissingModelFields = 1, 3 | MissingBaseFields = 2; 4 | -------------------------------------------------------------------------------- /packages/graphql-codegen-supermassive-schema-extraction-plugin/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/graphql-codegen-supermassive-typed-document-node-plugin/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/index.ts: -------------------------------------------------------------------------------- 1 | import ApolloCache from "./apollo-cache-container"; 2 | export { ApolloCache }; 3 | -------------------------------------------------------------------------------- /website/static/img/tutorial/localeDropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/tutorial/localeDropdown.png -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/examples/apollo-watch-fragments/public/favicon.ico -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/examples/apollo-watch-fragments/public/logo192.png -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/examples/apollo-watch-fragments/public/logo512.png -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/schema/models.ts: -------------------------------------------------------------------------------- 1 | export interface TodoModel { 2 | id: string; 3 | text: string; 4 | isCompleted: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/core/concat.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from './ApolloLink'; 2 | 3 | export const concat = ApolloLink.concat; 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/core/execute.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from './ApolloLink'; 2 | 3 | export const execute = ApolloLink.execute; 4 | -------------------------------------------------------------------------------- /packages/graphql-codegen-near-operation-file-preset-with-resolver-metadata/README.md: -------------------------------------------------------------------------------- 1 | # graphql-codegen-near-operation-file-preset-with-resolver-metadata 2 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/graphiql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/graphiql.png -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/rempl.ts: -------------------------------------------------------------------------------- 1 | import { getSubscriber } from "rempl"; 2 | 3 | export const remplSubscriber = getSubscriber(); 4 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./typescriptTransforms/createImportDocumentsTransform"; 2 | export * from "./types"; 3 | -------------------------------------------------------------------------------- /packages/graphql-codegen-near-operation-file-preset-with-resolver-metadata/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/graphql-js-operation-payload-generator/src/relay-test-utils-internal.d.ts: -------------------------------------------------------------------------------- 1 | declare module "relay-test-utils-internal/lib/generateTestsFromFixtures"; 2 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/shared/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./styles/common.styles"; 2 | export * from "./components"; 3 | -------------------------------------------------------------------------------- /website/static/img/tutorial/docsVersionDropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/tutorial/docsVersionDropdown.png -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/examples/apollo-devtools-playground/public/favicon.ico -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/examples/apollo-devtools-playground/public/logo192.png -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/examples/apollo-devtools-playground/public/logo512.png -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/cache-inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/cache-inspector.png -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/recent-activity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/recent-activity.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide10.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide11.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide13.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide14.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide18.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide19.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide2.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide20.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide22.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide25.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide3.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide4.png -------------------------------------------------------------------------------- /website/static/img/graphitation-logo-only-capital.pxd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/static/img/graphitation-logo-only-capital.pxd -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/src/data/utils/sleep.ts: -------------------------------------------------------------------------------- 1 | export function sleep(ms: number) { 2 | return new Promise((resolve) => setTimeout(resolve, ms)); 3 | } 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/globals/maybe.ts: -------------------------------------------------------------------------------- 1 | export function maybe(thunk: () => T): T | undefined { 2 | try { return thunk() } catch {} 3 | } 4 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/blankGraphQLTag.ts: -------------------------------------------------------------------------------- 1 | export default function blankGraphQLTag(strings: TemplateStringsArray): string { 2 | return strings[0]; 3 | } 4 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/operations-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/operations-monitor.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/images/SmallChatList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/images/SmallChatList.png -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/slidedeck/Slide7+8+9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/website/docs/learn-graphql/guides/slidedeck/Slide7+8+9.png -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/affected-queries-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/affected-queries-view.png -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/identityFunc.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns the first argument it receives. 3 | */ 4 | export function identityFunc(x: T): T { 5 | return x; 6 | } 7 | -------------------------------------------------------------------------------- /website/src/pages/markdown-page.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Markdown page example 3 | --- 4 | 5 | # Markdown page example 6 | 7 | You don't need React to write simple standalone pages. 8 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/operation-tracker-result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/operation-tracker-result.png -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/operations-tracker-copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/operations-tracker-copy.png -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/Maybe.ts: -------------------------------------------------------------------------------- 1 | /** Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/ */ 2 | export type Maybe = null | undefined | T; 3 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/graphql.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.graphql" { 2 | import { DocumentNode } from "graphql"; 3 | const Schema: DocumentNode; 4 | 5 | export = Schema; 6 | } 7 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { render } from "react-dom"; 3 | 4 | import App from "./App"; 5 | 6 | render(, document.body); 7 | -------------------------------------------------------------------------------- /lage.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pipeline: { 3 | types: ["^types"], 4 | build: [], 5 | test: ["build"], 6 | lint: [], 7 | }, 8 | npmClient: "yarn", 9 | }; 10 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "root": true, 4 | "rules": { 5 | "@typescript-eslint/no-explicit-any": "off" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/supermassive-extractors/src/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | extractImplicitTypesToTypescript, 3 | extractAndPrintImplicitTypesToTypescript, 4 | } from "./extractImplicitTypesToTypescript"; 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | 7 | [*.{js,json,.yml}] 8 | charset = utf-8 9 | indent_style = space 10 | indent_size = 2 11 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/src/index.tsx: -------------------------------------------------------------------------------- 1 | import ReactDOM from "react-dom"; 2 | 3 | import App from "./components/app"; 4 | 5 | ReactDOM.render(, document.getElementById("root")); 6 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | import '../utilities/globals'; 2 | export { MockedProvider, MockedProviderProps } from './react/MockedProvider'; 3 | export * from './core'; 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/diff/differenceKind.ts: -------------------------------------------------------------------------------- 1 | export const Replacement = 0, 2 | Filler = 1, 3 | ObjectDifference = 2, 4 | CompositeListDifference = 3, 5 | FieldEntryDifference = 4; 6 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/plural-fragment.graphql: -------------------------------------------------------------------------------- 1 | fragment PluralFragment on Node @relay(plural: true) { 2 | id 3 | } 4 | -------------------------------------------------------------------------------- /packages/cli/bin/supermassive.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | (function () { 4 | require("@graphitation/cli/lib/supermassive") 5 | .supermassive() 6 | .parseAsync(process.argv); 7 | })(); 8 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/docs/operations-tracker-detailed-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/graphitation/HEAD/packages/rempl-apollo-devtools/docs/operations-tracker-detailed-view.png -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/types.ts: -------------------------------------------------------------------------------- 1 | export type CacheObjectWithSize = { 2 | key: string; 3 | value: Record; 4 | valueSize: number | null; 5 | }; 6 | -------------------------------------------------------------------------------- /packages/supermassive/src/benchmarks/swapi-schema/models.ts: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | import { JsonDB } from "node-json-db"; 3 | 4 | export default new JsonDB(path.join(__dirname, "./starwars")); 5 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/arrays.ts: -------------------------------------------------------------------------------- 1 | export function isNonEmptyArray(value?: ArrayLike): value is Array { 2 | return Array.isArray(value) && value.length > 0; 3 | } 4 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/apollo-devtools-multi-window.css: -------------------------------------------------------------------------------- 1 | body > div[side]:not([side="bottom"]) { 2 | top: 110px; 3 | } 4 | 5 | body > div[side]:not([side="right"]) { 6 | left: 430px; 7 | } 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | !lib 2 | !dist 3 | rempl-apollo-devtools/lib 4 | src 5 | *.test.* 6 | **/__tests__/ 7 | .eslintrc.json 8 | tsconfig.json 9 | .tsbuildinfo 10 | CHANGELOG.json 11 | supermassive/lib/benchmarks -------------------------------------------------------------------------------- /package-template/src/__tests__/index.test.ts: -------------------------------------------------------------------------------- 1 | import { bar } from ".."; 2 | 3 | describe("bar", () => { 4 | it("returns a string", () => { 5 | expect(typeof bar("test")).toBe("string"); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/cache/inmemory/__mocks__/optimism.ts: -------------------------------------------------------------------------------- 1 | const optimism = jest.requireActual('optimism'); 2 | module.exports = { 3 | ...optimism, 4 | wrap: jest.fn(optimism.wrap), 5 | }; 6 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/objects.ts: -------------------------------------------------------------------------------- 1 | export function isNonNullObject(obj: any): obj is Record { 2 | return obj !== null && typeof obj === 'object'; 3 | } 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "lib", 5 | "rootDir": "src" 6 | }, 7 | "include": ["src/**/*"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/fixtures/a-jest-test-without-doc.ts: -------------------------------------------------------------------------------- 1 | describe("a jest test", () => { 2 | it("does nothing really", () => { 3 | expect(true).toBe(true); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/components/index.ts: -------------------------------------------------------------------------------- 1 | export { Query } from './Query'; 2 | export { Mutation } from './Mutation'; 3 | export { Subscription } from './Subscription'; 4 | 5 | export * from './types'; 6 | -------------------------------------------------------------------------------- /packages/graphql-codegen-resolvers-models/README.md: -------------------------------------------------------------------------------- 1 | # Custom GraphQL codegen plugins 2 | 3 | ## graphql-codegen-resolvers-models 4 | 5 | It allows us to intersect public types with models and also omit fields if needed 6 | -------------------------------------------------------------------------------- /website/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // This file is not used in compilation. It is here just for a nice editor experience. 3 | "extends": "@docusaurus/tsconfig", 4 | "compilerOptions": { 5 | "baseUrl": "." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/styles.css: -------------------------------------------------------------------------------- 1 | html { 2 | height: 100%; 3 | } 4 | 5 | body { 6 | height: 100%; 7 | overflow: hidden; 8 | margin: 0; 9 | padding: 0; 10 | box-sizing: border-box; 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/config/jest/setup.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag'; 2 | 3 | // Turn off warnings for repeated fragment names 4 | gql.disableFragmentWarnings(); 5 | 6 | process.on('unhandledRejection', () => {}); 7 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/README.md: -------------------------------------------------------------------------------- 1 | # @graphitation/apollo-react-relay-duct-tape-compiler 2 | 3 | This package contains all the build tooling needed to support the `@graphitation/apollo-react-relay-duct-tape` package. 4 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./hooks"; 2 | export * from "./types"; 3 | export * from "./storeObservation"; 4 | export { ApolloReactRelayDuctTapeProvider } from "./useOverridenOrDefaultApolloClient"; 5 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/NOTICE: -------------------------------------------------------------------------------- 1 | NOTICE 2 | 3 | This directory's files are taken from https://github.com/graphql/graphql-js/tree/v15.6.1/src/jsutils 4 | 5 | MIT license https://github.com/graphql/graphql-js/blob/v15.6.1/LICENSE 6 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/tmp/test.out: -------------------------------------------------------------------------------- 1 | 2 | import { graphql } from "@nova/react"; 3 | const doc = require("./__generated__/SomeComponentQuery.graphql").default; 4 | console.log() 5 | -------------------------------------------------------------------------------- /packages/graphql-codegen-typescript-typemap-plugin/README.md: -------------------------------------------------------------------------------- 1 | # graphql-codegen-typescript-typemap-plugin 2 | 3 | This plugin will emit a `TypeMap` object type that returns the schema types, emitted by the `typescript` plugin, keyed by their name. 4 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-additional-informations/index.ts: -------------------------------------------------------------------------------- 1 | import AdditionalInformationsContainer from "./additional-informations-container"; 2 | 3 | export { AdditionalInformationsContainer as AdditionalInformations }; 4 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/ssr/index.ts: -------------------------------------------------------------------------------- 1 | export { getMarkupFromTree, getDataFromTree } from './getDataFromTree'; 2 | export { renderToStringWithData } from './renderToStringWithData'; 3 | export { RenderPromises } from './RenderPromises'; 4 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/recursive-fragments.graphql: -------------------------------------------------------------------------------- 1 | fragment FragmentSpread on Node { 2 | id 3 | ... @include(if: $condition) { 4 | ...FragmentSpread 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/values/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./create"; 2 | export * from "./delete"; 3 | export * from "./draft"; 4 | export * from "./iterator"; 5 | export * from "./traverse"; 6 | export * from "./predicates"; 7 | export * from "./resolve"; 8 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/useForceUpdate.ts: -------------------------------------------------------------------------------- 1 | import { useReducer } from "react"; 2 | 3 | export function useForceUpdate() { 4 | const [_, forceUpdate] = useReducer((x) => x + 1, 0); 5 | return forceUpdate; 6 | } 7 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/fromError.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from '../../utilities'; 2 | 3 | export function fromError(errorValue: any): Observable { 4 | return new Observable(observer => { 5 | observer.error(errorValue); 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/errorHandling.ts: -------------------------------------------------------------------------------- 1 | import { ExecutionResult } from 'graphql'; 2 | 3 | export function graphQLResultHasError(result: ExecutionResult): boolean { 4 | return (result.errors && result.errors.length > 0) || false; 5 | } 6 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/values/valueKind.ts: -------------------------------------------------------------------------------- 1 | export const Object = 0, 2 | CompositeList = 1, 3 | CompositeNull = 2, 4 | CompositeUndefined = 3, 5 | LeafList = 4, 6 | LeafError = 5, 7 | LeafUndefined = 6, 8 | ComplexScalar = 7, 9 | ObjectDraft = 8; 10 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/consts.ts: -------------------------------------------------------------------------------- 1 | export const RECENT_DATA_CHANGES_TYPES = { 2 | ADDED: "added", 3 | REMOVED: "removed", 4 | CHANGED: "changed", 5 | }; 6 | 7 | export const ACTIVITY_TYPE = { 8 | CACHE: "cache", 9 | OPERATION: "operation", 10 | }; 11 | -------------------------------------------------------------------------------- /website/docs/learn-graphql/guides/graphql-client.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 5 3 | id: graphql-client 4 | title: The GraphQL Client 5 | description: How a good GraphQL client unlocks the true potential of GraphQL 6 | --- 7 | 8 | # The GraphQL Client 9 | 10 | TODO. 11 | -------------------------------------------------------------------------------- /website/docs/packages/apollo-react-relay-duct-tape/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 1 3 | --- 4 | 5 | # Intro 6 | 7 | A compatibility wrapper that provides the react-relay API on top of Apollo Client. 8 | 9 | _The name is a reference to the Apollo 13 mission._ 10 | -------------------------------------------------------------------------------- /packages/graphql-codegen-supermassive-typed-document-node-plugin/README.md: -------------------------------------------------------------------------------- 1 | # Custom GraphQL codegen plugins 2 | 3 | ## supermassive-typed-document-node 4 | 5 | Do the same stuff as the original typed-document-node plugin except it extends GraphQL AST data to match Supermassive AST 6 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/tmp/test.in: -------------------------------------------------------------------------------- 1 | 2 | import { graphql } from "@nova/react"; 3 | const doc = graphql` 4 | query SomeComponentQuery($id: ID!) { 5 | helloWorld 6 | } 7 | `; 8 | console.log() 9 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/__tests__/fixtures/esModuleResolvers.ts: -------------------------------------------------------------------------------- 1 | export const MyInterfaceType = { 2 | __resolveType: () => "MyObjectType", 3 | }; 4 | 5 | export const foo = () => { 6 | return "Result"; 7 | }; 8 | 9 | export const MyObjectType = { 10 | foo, 11 | }; 12 | -------------------------------------------------------------------------------- /website/src/components/HomepageFeatures.module.css: -------------------------------------------------------------------------------- 1 | .features { 2 | display: flex; 3 | align-items: center; 4 | padding: 2rem 0; 5 | width: 100%; 6 | } 7 | 8 | .features a { 9 | color: #000; 10 | } 11 | 12 | .featureSvg { 13 | height: 200px; 14 | width: 200px; 15 | } 16 | -------------------------------------------------------------------------------- /packages/supermassive/src/__testUtils__/gql.ts: -------------------------------------------------------------------------------- 1 | import { DocumentNode, parse } from "graphql"; 2 | 3 | export type GqlResult = { raw: string; document: DocumentNode }; 4 | 5 | export function gql(raw: TemplateStringsArray): GqlResult { 6 | return { raw: raw[0], document: parse(raw[0]) }; 7 | } 8 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation-with-delete-record.graphql: -------------------------------------------------------------------------------- 1 | mutation DeleteRecordMutation( 2 | $input: CommentDeleteInput! 3 | ) { 4 | commentDelete(input: $input) { 5 | deletedCommentId @deleteRecord 6 | } 7 | } -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/refetchable-fragment.graphql: -------------------------------------------------------------------------------- 1 | fragment RefetchableFragment on Node 2 | @refetchable(queryName: "RefetchableFragmentQuery") { 3 | id 4 | fragAndField: profilePicture { 5 | uri 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/graphql-codegen-typescript-operations/README.md: -------------------------------------------------------------------------------- 1 | # graphql-codegen-typescript-operations 2 | 3 | Based on GraphQL codegen typescript operations [plugin](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-operations). 4 | It adds a possibility to export all used types and enums. 5 | -------------------------------------------------------------------------------- /packages/graphql-js-tag/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/webpack-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./nodeFromCacheFieldPolicy"; 2 | export * from "./fragmentReferencesFieldPolicy"; 3 | export * from "./typePolicies"; 4 | export * from "./shallowCompareFragmentReferences"; 5 | export * from "./getPossibleTypesAndDataIdFromNode"; 6 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/public/subscriber.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Subscriber 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/conditional.graphql: -------------------------------------------------------------------------------- 1 | fragment ConditionField on Node { 2 | id @include(if: $condition) 3 | } 4 | 5 | fragment NestedCondition on Node { 6 | ... @include(if: $condition) { 7 | id 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/ts-transform-graphql-js-tag/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import "@testing-library/jest-dom/extend-expect"; 6 | -------------------------------------------------------------------------------- /packages/graphql-codegen-resolvers-models/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/hooks/index.ts: -------------------------------------------------------------------------------- 1 | import '../../utilities/globals'; 2 | 3 | export * from './useApolloClient'; 4 | export * from './useLazyQuery'; 5 | export * from './useMutation'; 6 | export { useQuery } from './useQuery'; 7 | export * from './useSubscription'; 8 | export * from './useReactiveVar'; 9 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-tracker/index.ts: -------------------------------------------------------------------------------- 1 | import WatchedQueriesContainer from "./Queries/watched-queries-container"; 2 | import MutationsContainer from "./Mutations/mutations-container"; 3 | 4 | export { MutationsContainer as Mutations }; 5 | export { WatchedQueriesContainer as WatchedQueries }; 6 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "jsx": "react", 8 | "outDir": "lib" 9 | }, 10 | "include": ["src"], 11 | "references": [] 12 | } 13 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/schema/schema.ts: -------------------------------------------------------------------------------- 1 | import typeDefs from "./typeDefs.graphql"; 2 | import { resolvers } from "./resolvers"; 3 | import { makeExecutableSchema } from "@graphql-tools/schema"; 4 | 5 | const schema = makeExecutableSchema({ 6 | typeDefs, 7 | resolvers, 8 | }); 9 | 10 | export default schema; 11 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/hoc/__tests__/queries/__snapshots__/lifecycle.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`[queries] lifecycle handles asynchronous racecondition with prefilled data from the server 1`] = ` 4 |
5 |

6 | stub 7 |

8 |
9 | `; 10 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation-input-has-array.graphql: -------------------------------------------------------------------------------- 1 | mutation InputHasArray($input: UpdateAllSeenStateInput) @raw_response_type { 2 | viewerNotificationsUpdateAllSeenState(input: $input) { 3 | stories { 4 | actorCount 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/supermassive-extractors/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "jsx": "react" 9 | }, 10 | "include": ["src"], 11 | "references": [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/devAssert.ts: -------------------------------------------------------------------------------- 1 | export function devAssert(condition: unknown, message: string): void { 2 | const booleanCondition = Boolean(condition); 3 | // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') 4 | if (!booleanCondition) { 5 | throw new Error(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /scripts/bin/monorepo-scripts.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /* eslint-disable @typescript-eslint/no-var-requires */ 3 | 4 | const path = require("path"); 5 | const { addResolvePath } = require("just-scripts"); 6 | addResolvePath(path.join(__dirname, "..")); 7 | 8 | // Calling the CLI 9 | require("just-scripts/bin/just-scripts"); 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | dist 4 | .tsbuildinfo 5 | dist 6 | examples/apollo-watch-fragments/public/bundle.js 7 | 8 | # This is purely pre-cautionary; when linting becomes slow, delete this eslintcache entry 9 | .eslintcache 10 | 11 | *.tgz 12 | 13 | examples/supermassive-todomvc/**/*.d.ts* 14 | relay-preload-hooks.ts 15 | -------------------------------------------------------------------------------- /packages/graphql-codegen-supermassive-schema-extraction-plugin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/graphql-codegen-supermassive-typed-document-node-plugin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [] 11 | } 12 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/shared/components/index.ts: -------------------------------------------------------------------------------- 1 | export { CodeBlock } from "./CodeBlock"; 2 | export type { CodeBlockProps } from "./CodeBlock"; 3 | 4 | export { Loading } from "./Loading"; 5 | export { usePanelStyles } from "../styles/common.styles"; 6 | export { JsonViewer } from "./JsonViewer"; 7 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/README.md: -------------------------------------------------------------------------------- 1 | ## JavaScript Utils 2 | 3 | This directory contains dependency-free JavaScript utility functions used 4 | throughout the codebase. 5 | 6 | Each utility should belong in its own file and be the default export. 7 | 8 | These functions are not part of the module interface and are subject to change. 9 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /node_modules 3 | 4 | # Production 5 | /build 6 | 7 | # Generated files 8 | .docusaurus 9 | .cache-loader 10 | 11 | # Misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | -------------------------------------------------------------------------------- /change/@graphitation-supermassive-463d5e07-54e8-48a7-a524-bbddb8296a5d.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minor", 3 | "comment": "extractMinimalViableSchemaForRequestDocument include interface implementations", 4 | "packageName": "@graphitation/supermassive", 5 | "email": "77059398+vejrj@users.noreply.github.com", 6 | "dependentChangeType": "patch" 7 | } 8 | -------------------------------------------------------------------------------- /package-template/README.md: -------------------------------------------------------------------------------- 1 | # package template 2 | 3 | ## TODO 4 | 5 | - [ ] copy pasta this template into /packages 6 | - [ ] open package.json and change the name 7 | - [ ] run `yarn` at repo root 8 | - [ ] run `yarn build` and make sure the new package is building alongside with the rest of repo packages 9 | - [ ] change this README.md 10 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/scalar-field.graphql: -------------------------------------------------------------------------------- 1 | fragment ScalarField on User { 2 | id 3 | name 4 | websites 5 | traits 6 | aliasedLinkedField: birthdate { 7 | aliasedField: year 8 | } 9 | screennames { 10 | name 11 | service 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/graphql-codegen-typescript-operations/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "composite": true, 6 | "tsBuildInfoFile": ".tsbuildinfo", 7 | "rootDir": "src", 8 | "outDir": "lib" 9 | }, 10 | "include": ["src"], 11 | "references": [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/createSignalIfSupported.ts: -------------------------------------------------------------------------------- 1 | export const createSignalIfSupported = () => { 2 | if (typeof AbortController === 'undefined') 3 | return { controller: false, signal: false }; 4 | 5 | const controller = new AbortController(); 6 | const signal = controller.signal; 7 | return { controller, signal }; 8 | }; 9 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "allowJs": true 9 | }, 10 | "include": ["src", "node_modules/quick-lru/**/*"], 11 | "references": [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/graphql-codegen-typescript-typemap-plugin/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "composite": true, 6 | "tsBuildInfoFile": ".tsbuildinfo", 7 | "rootDir": "src", 8 | "outDir": "lib" 9 | }, 10 | "include": ["src"], 11 | "references": [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/history/types.ts: -------------------------------------------------------------------------------- 1 | import type { HistoryChangeSerialized } from "@graphitation/apollo-forest-run"; 2 | 3 | export interface OperationHistoryResponse { 4 | history: HistoryChangeSerialized[]; 5 | operation: { 6 | name: string; 7 | variables?: Record; 8 | }; 9 | totalCount: number; 10 | } 11 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/types.ts: -------------------------------------------------------------------------------- 1 | import type { HistoryChangeSerialized } from "@graphitation/apollo-forest-run"; 2 | 3 | export interface OperationHistoryResponse { 4 | history: HistoryChangeSerialized[]; 5 | operation: { 6 | name: string; 7 | variables?: Record; 8 | }; 9 | totalCount: number; 10 | } 11 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/isPromise.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns true if the value acts like a Promise, i.e. has a "then" function, 3 | * otherwise returns false. 4 | */ 5 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 6 | export function isPromise(value: any): value is Promise { 7 | return typeof value?.then === "function"; 8 | } 9 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/isObjectLike.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Return true if `value` is object-like. A value is object-like if it's not 3 | * `null` and has a `typeof` result of "object". 4 | */ 5 | export function isObjectLike( 6 | value: unknown, 7 | ): value is { [key: string]: unknown } { 8 | return typeof value == "object" && value !== null; 9 | } 10 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/src/utils/__tests__/garbage-collection.test.ts: -------------------------------------------------------------------------------- 1 | import { GarbageCollector } from "../garbage-collection"; 2 | 3 | describe("GarbageCollector", () => { 4 | it("should collect unused objects", () => { 5 | const gc = new GarbageCollector(); 6 | gc.collect(); 7 | expect(gc.getStats().runs).toBe(1); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/graphql-codegen-supermassive-schema-extraction-plugin/README.md: -------------------------------------------------------------------------------- 1 | # Custom GraphQL codegen plugins 2 | 3 | ## graphql-codegen-supermassive-schema-extraction-plugin 4 | 5 | Encodes type definitions into compact schema format of Supermassive V3. 6 | 7 | Output file contains JSON, which is faster than JS literal: https://v8.dev/blog/cost-of-javascript-2019#json 8 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/typeNameFromAST.ts: -------------------------------------------------------------------------------- 1 | import { Kind, TypeNode } from "graphql"; 2 | 3 | export function typeNameFromAST(typeAst: TypeNode): string { 4 | if (typeAst.kind === Kind.LIST_TYPE || typeAst.kind === Kind.NON_NULL_TYPE) { 5 | return typeNameFromAST(typeAst.type); 6 | } else { 7 | return typeAst.name.value; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/src/wdyr.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import * as React from "react"; 4 | 5 | if (process.env.NODE_ENV === "development") { 6 | const whyDidYouRender = require("@welldone-software/why-did-you-render"); 7 | whyDidYouRender(React, { 8 | trackAllPureComponents: true, 9 | }); 10 | } 11 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/core/index.ts: -------------------------------------------------------------------------------- 1 | import '../../utilities/globals'; 2 | 3 | export { empty } from './empty'; 4 | export { from } from './from'; 5 | export { split } from './split'; 6 | export { concat } from './concat'; 7 | export { execute } from './execute'; 8 | export { ApolloLink } from './ApolloLink'; 9 | 10 | export * from './types'; 11 | -------------------------------------------------------------------------------- /packages/graphql-codegen-near-operation-file-preset-with-resolver-metadata/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "composite": true, 6 | "tsBuildInfoFile": ".tsbuildinfo", 7 | "rootDir": "src", 8 | "outDir": "lib" 9 | }, 10 | "include": ["src"], 11 | "references": [] 12 | } 13 | -------------------------------------------------------------------------------- /packages/supermassive/src/benchmarks/fixtures/query1.graphql: -------------------------------------------------------------------------------- 1 | { 2 | empireHero: person(id: 1) { 3 | ...PersonFields 4 | height 5 | mass 6 | } 7 | 8 | jediHero: person(id: 4) { 9 | ...PersonFields 10 | } 11 | } 12 | 13 | fragment PersonFields on Person { 14 | name 15 | gender 16 | birth_year 17 | vehicles { 18 | name 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/ObjMap.ts: -------------------------------------------------------------------------------- 1 | export interface ObjMap { 2 | [key: string]: T; 3 | } 4 | 5 | export type ObjMapLike = ObjMap | { [key: string]: T }; 6 | 7 | export interface ReadOnlyObjMap { 8 | readonly [key: string]: T; 9 | } 10 | 11 | export type ReadOnlyObjMapLike = 12 | | ReadOnlyObjMap 13 | | { readonly [key: string]: T }; 14 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/__tests__/fixtures/schemaWithBooleanParameter.ts: -------------------------------------------------------------------------------- 1 | import { gql } from "../../../__testUtils__/gql"; 2 | 3 | export const schemaWithBooleanParameter = gql` 4 | type Query { 5 | person(id: Int!): Person 6 | } 7 | 8 | type Person { 9 | name: String! 10 | phones(includeDefault: Boolean = true): [String!]! 11 | } 12 | `; 13 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/codegen.yml: -------------------------------------------------------------------------------- 1 | overwrite: true 2 | schema: "./data/schema.graphql" 3 | generates: 4 | ./src/graphql/resolver-typings.ts: 5 | plugins: 6 | - "typescript" 7 | - "typescript-resolvers" 8 | config: 9 | allowParentTypeOverride: true 10 | defaultMapper: Partial<{T}> 11 | mappers: 12 | Todo: ../db#TodoData 13 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/__tests__/__snapshots__/graphqlSubscriptions.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`GraphQL Subscriptions should throw an error if the result has errors on it 1`] = `[Error: This is an error]`; 4 | 5 | exports[`GraphQL Subscriptions should throw an error if the result has errors on it 2`] = `[Error: This is an error]`; 6 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/hoc/index.ts: -------------------------------------------------------------------------------- 1 | import '../../utilities/globals'; 2 | 3 | export { graphql } from './graphql'; 4 | 5 | export { withQuery } from './query-hoc'; 6 | export { withMutation } from './mutation-hoc'; 7 | export { withSubscription } from './subscription-hoc'; 8 | export { withApollo } from './withApollo'; 9 | 10 | export * from './types'; 11 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/hooks/index.ts: -------------------------------------------------------------------------------- 1 | export { useHistoryData } from "./useHistoryData"; 2 | export type { 3 | UseHistoryDataResult, 4 | UseHistoryDataOptions, 5 | } from "./useHistoryData"; 6 | 7 | export { useHistorySelection } from "./useHistorySelection"; 8 | export type { UseHistorySelectionOptions } from "./useHistorySelection"; 9 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/index.ts: -------------------------------------------------------------------------------- 1 | export { HistoryDialog } from "./HistoryDialog"; 2 | export { HistoryTimeline } from "./HistoryTimeline"; 3 | export { HistoryDetails } from "./HistoryDetails"; 4 | export { FieldChangesList } from "./FieldChangesList"; 5 | export { DiffViewer } from "./DiffViewer"; 6 | export { SectionCard } from "./SectionCard"; 7 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/context/index.ts: -------------------------------------------------------------------------------- 1 | import '../../utilities/globals'; 2 | 3 | export { ApolloConsumer, ApolloConsumerProps } from './ApolloConsumer'; 4 | export { 5 | ApolloContextValue, 6 | getApolloContext, 7 | getApolloContext as resetApolloContext 8 | } from './ApolloContext'; 9 | export { ApolloProvider, ApolloProviderProps } from './ApolloProvider'; 10 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/array.ts: -------------------------------------------------------------------------------- 1 | export function arraysAreEqual( 2 | array1: readonly unknown[], 3 | array2: readonly unknown[], 4 | ): boolean { 5 | if (array1.length !== array2.length) { 6 | return false; 7 | } 8 | for (let i = 0; i < array1.length - 1; i++) { 9 | if (array1[i] !== array2[i]) { 10 | return false; 11 | } 12 | } 13 | return true; 14 | } 15 | -------------------------------------------------------------------------------- /package-template/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [], 11 | "ts-node": { 12 | "transpileOnly": true, 13 | "target": "es5", 14 | "module": "commonjs" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/types.ts: -------------------------------------------------------------------------------- 1 | import type { DocumentNode } from "graphql"; 2 | 3 | import type { Metadata } from "./formatModuleTransforms/extractMetadataTransform"; 4 | 5 | export type { Metadata }; 6 | 7 | export interface CompiledArtefactModule { 8 | executionQueryDocument?: DocumentNode; 9 | watchQueryDocument?: DocumentNode; 10 | metadata?: Metadata; 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/stringifyForDisplay.ts: -------------------------------------------------------------------------------- 1 | import { makeUniqueId } from "./makeUniqueId"; 2 | 3 | export function stringifyForDisplay(value: any): string { 4 | const undefId = makeUniqueId("stringifyForDisplay"); 5 | return JSON.stringify(value, (key, value) => { 6 | return value === void 0 ? undefId : value; 7 | }).split(JSON.stringify(undefId)).join(""); 8 | } 9 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/shared/styles/spacing.ts: -------------------------------------------------------------------------------- 1 | export const SPACING_XS = "clamp(2px, calc(1px + 0.1vw), 4px)"; 2 | export const SPACING_SM = "clamp(4px, calc(3px + 0.3vw), 8px)"; 3 | export const SPACING_MD = "clamp(8px, calc(4px + 0.5vw), 12px)"; 4 | export const SPACING_LG = "clamp(8px, calc(3px + 1vw), 16px)"; 5 | export const SPACING_XL = "clamp(12px, calc(5px + 1vw), 20px)"; 6 | -------------------------------------------------------------------------------- /packages/ts-codegen/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "jsx": "react" 9 | }, 10 | "include": ["src"], 11 | "references": [], 12 | "ts-node": { 13 | "compilerOptions": { 14 | "module": "CommonJS" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/ssr/renderToStringWithData.ts: -------------------------------------------------------------------------------- 1 | import { ReactElement } from 'react'; 2 | import { getMarkupFromTree } from './getDataFromTree'; 3 | 4 | export function renderToStringWithData( 5 | component: ReactElement 6 | ): Promise { 7 | return getMarkupFromTree({ 8 | tree: component, 9 | renderFunction: require('react-dom/server').renderToString 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/filterInPlace.ts: -------------------------------------------------------------------------------- 1 | export function filterInPlace( 2 | array: T[], 3 | test: (elem: T) => boolean, 4 | context?: any, 5 | ): T[] { 6 | let target = 0; 7 | array.forEach(function (elem, i) { 8 | if (test.call(this, elem, i, array)) { 9 | array[target++] = elem; 10 | } 11 | }, context); 12 | array.length = target; 13 | return array; 14 | } 15 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/fragmentReferencesFieldPolicy.ts: -------------------------------------------------------------------------------- 1 | import { FieldReadFunction } from "@apollo/client"; 2 | 3 | export const fragmentReferencesFieldPolicy: FieldReadFunction = ( 4 | _existingCacheData, 5 | { variables }, 6 | ) => { 7 | return !variables 8 | ? null 9 | : variables.__fragments === undefined 10 | ? variables 11 | : variables.__fragments; 12 | }; 13 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/fromPromise.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from '../../utilities'; 2 | 3 | export function fromPromise(promise: Promise): Observable { 4 | return new Observable(observer => { 5 | promise 6 | .then((value: T) => { 7 | observer.next(value); 8 | observer.complete(); 9 | }) 10 | .catch(observer.error.bind(observer)); 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/jsutils/assert.ts: -------------------------------------------------------------------------------- 1 | export function assert(condition: unknown, message = ""): asserts condition { 2 | if (!condition) { 3 | throw new Error("Invariant violation" + (message ? `: ${message}` : "")); 4 | } 5 | } 6 | 7 | export function assertNever(...values: never[]): never { 8 | throw new Error( 9 | `Unexpected member of typed union: \n` + JSON.stringify(values), 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [], 11 | "ts-node": { 12 | "transpileOnly": true, 13 | "target": "es5", 14 | "module": "commonjs" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/tmp/test.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["fixture.ts"],"names":[],"mappings":"AAAA;AACA;AACA,oBAAoB,AACpB,AACA,AACA,AACA,6DAAS;AACT;AACA","file":"fixture.ts.map","sourcesContent":["\n import { graphql } from \"@nova/react\";\n const doc = graphql`\n query SomeComponentQuery($id: ID!) {\n helloWorld\n }\n `;\n console.log()\n "]} -------------------------------------------------------------------------------- /website/docs/learn-graphql/howto/models.md: -------------------------------------------------------------------------------- 1 | --- 2 | id: howto-models 3 | title: How-To guide for models 4 | description: How to properly create models 5 | --- 6 | 7 | # How-To: Models 8 | 9 | TODO: 10 | 11 | - Show a more elaborate example where the field resolver needs data that we clearly do not want to expose in the schema type. 12 | - What logic to put in the model vs resolver, do not convert to schema types in the model 13 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/HttpLink.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink, RequestHandler } from '../core'; 2 | import { HttpOptions } from './selectHttpOptionsAndBody'; 3 | import { createHttpLink } from './createHttpLink'; 4 | 5 | export class HttpLink extends ApolloLink { 6 | public requester: RequestHandler; 7 | constructor(public options: HttpOptions = {}) { 8 | super(createHttpLink(options).request); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/apollo-mock-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "jsx": "react" 9 | }, 10 | "include": ["src"], 11 | "references": [ 12 | { "path": "../graphql-js-tag" }, 13 | { "path": "../graphql-js-operation-payload-generator" } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation.graphql: -------------------------------------------------------------------------------- 1 | mutation CommentCreateMutation( 2 | $input: CommentCreateInput! 3 | $first: Int 4 | $orderBy: [String!] 5 | ) { 6 | commentCreate(input: $input) { 7 | comment { 8 | id 9 | name 10 | friends(first: $first, orderby: $orderBy) { 11 | count 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/typename-inside-with-overlapping-fields.graphql: -------------------------------------------------------------------------------- 1 | fragment TypenameInsideWithOverlappingFields on Viewer { 2 | actor { 3 | __typename 4 | ... on Page { 5 | id 6 | name 7 | } 8 | ... on User { 9 | id 10 | name 11 | profile_picture { 12 | uri 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/README.md: -------------------------------------------------------------------------------- 1 | # GraphQL eslint rules 2 | 3 | This package contains the following eslint rules: 4 | 5 | - missing-apollo-key-fields: Enforce selecting key fields when they are available on a GraphQL object type 6 | - operation-naming-conventions: Enforce descriptive operation names based on the package they reside in 7 | - fragment-naming-conventions: Enforce descriptive fragment names based on the package they reside in 8 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/index.ts: -------------------------------------------------------------------------------- 1 | import '../utilities/globals'; 2 | 3 | export { 4 | ApolloProvider, 5 | ApolloConsumer, 6 | getApolloContext, 7 | resetApolloContext, 8 | ApolloContextValue 9 | } from './context'; 10 | 11 | export * from './hooks'; 12 | 13 | export { 14 | DocumentType, 15 | IDocumentDefinition, 16 | operationName, 17 | parser 18 | } from './parser'; 19 | 20 | export * from './types/types'; 21 | -------------------------------------------------------------------------------- /packages/graphql-js-operation-payload-generator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib" 8 | }, 9 | "include": ["src"], 10 | "references": [{ "path": "../graphql-js-tag" }], 11 | "ts-node": { 12 | "compilerOptions": { 13 | "module": "commonjs" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/invariant.ts: -------------------------------------------------------------------------------- 1 | export function invariant( 2 | condition: unknown, 3 | message?: string, 4 | ): asserts condition { 5 | const booleanCondition = Boolean(condition); 6 | // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') 7 | if (!booleanCondition) { 8 | throw new Error( 9 | message != null ? message : "Unexpected invariant triggered.", 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation-with-client-extension.graphql: -------------------------------------------------------------------------------- 1 | mutation Test($input: UpdateAllSeenStateInput) @raw_response_type { 2 | viewerNotificationsUpdateAllSeenState(input: $input) { 3 | stories { 4 | foos { 5 | bar 6 | } 7 | } 8 | } 9 | } 10 | 11 | extend type Story { 12 | foos: [Foo] 13 | } 14 | 15 | type Foo { 16 | bar: String 17 | } -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export { Dropdown } from "./dropdown/dropdown"; 2 | export { Dialog } from "./dialog/dialog"; 3 | export { ActivityDialog } from "./activity-dialog/activity-dialog"; 4 | export { List } from "./list/list"; 5 | export { Menu } from "./menu/menu"; 6 | export { TabMenu } from "./menu/tab-menu"; 7 | export { Search } from "./search/search"; 8 | export { VerticalViewer } from "./vertical-viewer/vertical-viewer"; 9 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/tsconfig-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "jsx": "react" 9 | }, 10 | "include": ["src"], 11 | "references": [], 12 | "ts-node": { 13 | "transpileOnly": true, 14 | "compilerOptions": { 15 | "module": "CommonJS" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/src/__tests__/__snapshots__/non-nullable-list-items.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Invalid #1 1`] = ` 4 | "#### ⌨️ Code 5 | 6 | 1 | type SomeType { 7 | 2 | someArray: [Item] 8 | 3 | } 9 | 10 | #### ❌ Error 11 | 12 | 1 | type SomeType { 13 | > 2 | someArray: [Item] 14 | | ^^^^^ List items must be not nullable. 15 | 3 | }" 16 | `; 17 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "module": "ES6", 5 | "moduleResolution": "Node", 6 | "declaration": true, 7 | "declarationMap": true, 8 | "strict": true, 9 | "allowSyntheticDefaultImports": true, 10 | "esModuleInterop": true, 11 | "paths": { 12 | "@graphql-tools/utils": ["./node_modules/@graphql-tools/utils"], 13 | "graphql": ["./node_modules/graphql"] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/design.md: -------------------------------------------------------------------------------- 1 | Apollo watch queries: 2 | 3 | 1. Create single large query composed of all fragments and use that to actually query the data. 4 | 2. Replace `useQuery` in root component with a `useQuery` that excludes fragments annotated with `@watchNode`. 5 | 3. Replace `useFragment` with `@watchNode` fragments with `useQuery` and Relay's refetchable `node` query. 6 | Then use an Apollo Client `Query.node` type-policy to read the already cached data 7 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-raw-response-on-conditional.graphql: -------------------------------------------------------------------------------- 1 | query ExampleQuery($id: ID!, $condition: Boolean!) @raw_response_type { 2 | node(id: $id) { 3 | ...FriendFragment 4 | } 5 | } 6 | 7 | fragment FriendFragment on User { 8 | ... @include(if: $condition) { 9 | name 10 | lastName 11 | feedback { 12 | id 13 | name 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/jsutils/normalize.ts: -------------------------------------------------------------------------------- 1 | export function sortKeys(value: T): T { 2 | if (typeof value !== "object" || value === null) { 3 | return value; 4 | } 5 | if (Array.isArray(value)) { 6 | return value.map((test) => sortKeys(test)) as T; 7 | } 8 | return Object.fromEntries( 9 | Object.entries(value) 10 | .sort((a, b) => a[0].localeCompare(b[0])) 11 | .map(([key, value]) => [key, sortKeys(value)]), 12 | ) as T; 13 | } 14 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/isAsyncIterable.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns true if the provided object implements the AsyncIterator protocol via 3 | * implementing a `Symbol.asyncIterator` method. 4 | */ 5 | export function isAsyncIterable( 6 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 7 | maybeAsyncIterable: any, 8 | ): maybeAsyncIterable is AsyncIterable { 9 | return typeof maybeAsyncIterable?.[Symbol.asyncIterator] === "function"; 10 | } 11 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/cache/inmemory/__tests__/__snapshots__/readFromStore.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`reading from the store returns === results for different queries 1`] = ` 4 | Object { 5 | "ROOT_QUERY": Object { 6 | "__typename": "Query", 7 | "a": Array [ 8 | "a", 9 | "y", 10 | "y", 11 | ], 12 | "b": Object { 13 | "c": "C", 14 | "d": "D", 15 | }, 16 | }, 17 | } 18 | `; 19 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/index.ts: -------------------------------------------------------------------------------- 1 | import '../../utilities/globals'; 2 | 3 | export { fromError } from './fromError'; 4 | export { toPromise } from './toPromise'; 5 | export { fromPromise } from './fromPromise'; 6 | export { ServerError, throwServerError } from './throwServerError'; 7 | export { validateOperation } from './validateOperation'; 8 | export { createOperation } from './createOperation'; 9 | export { transformOperation } from './transformOperation'; 10 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator-disabled/query-with-module-field.graphql: -------------------------------------------------------------------------------- 1 | query Test @raw_response_type { 2 | node(id: "1") { 3 | ...Test_user 4 | } 5 | } 6 | 7 | fragment Test_user on User { 8 | plainUserRenderer { 9 | ...Test_userRenderer @module(name: "Renderer.react") 10 | } 11 | } 12 | 13 | fragment Test_userRenderer on PlainUserRenderer { 14 | user { 15 | username 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-mering-scalars.error.graphql: -------------------------------------------------------------------------------- 1 | query ScalarMerging($id: ID!) { 2 | node(id: $id) { 3 | ... on User { 4 | favouriteMeal { 5 | ... on MealA { 6 | ingredients { 7 | name 8 | isGood 9 | } 10 | } 11 | ... on MealB { 12 | ingredients 13 | } 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "jsx": "react" 9 | }, 10 | "include": ["src"], 11 | "references": [ 12 | { "path": "../apollo-mock-client" }, 13 | { "path": "../graphql-js-tag" }, 14 | { "path": "../graphql-js-operation-payload-generator" } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/AccumulatorMap.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * ES6 Map with additional `add` method to accumulate items. 3 | */ 4 | export class AccumulatorMap extends Map> { 5 | get [Symbol.toStringTag]() { 6 | return "AccumulatorMap"; 7 | } 8 | 9 | add(key: K, item: T): void { 10 | const group = this.get(key); 11 | if (group === undefined) { 12 | this.set(key, [item]); 13 | } else { 14 | group.push(item); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnSave": true, 4 | "cSpell.words": ["Daichi", "fukuda", "Kadji"], 5 | "jestrunner.configPath": "scripts/config/jest.config.js", 6 | "files.eol": "\n", 7 | "jest.jestCommandLine": "node node_modules/jest-cli/bin/jest.js --config scripts/config/jest.config.js", 8 | "jest.runMode": "on-demand", 9 | "editor.codeActionsOnSave": { 10 | "source.organizeImports": "never" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /website/src/pages/index.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS files with the .module.css suffix will be treated as CSS modules 3 | * and scoped locally. 4 | */ 5 | 6 | .heroBanner { 7 | padding: 4rem 0; 8 | text-align: center; 9 | position: relative; 10 | overflow: hidden; 11 | } 12 | 13 | @media screen and (max-width: 966px) { 14 | .heroBanner { 15 | padding: 2rem; 16 | } 17 | } 18 | 19 | .buttons { 20 | display: flex; 21 | align-items: center; 22 | justify-content: center; 23 | } 24 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-defer.graphql: -------------------------------------------------------------------------------- 1 | query TestDefer @raw_response_type { 2 | node(id: "1") { 3 | ... on User { 4 | name 5 | friends(first: 10) 6 | @stream_connection(key: "TestDefer_friends", initial_count: 0) { 7 | edges { 8 | node { 9 | actor { 10 | name 11 | } 12 | } 13 | } 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "module": "commonjs" 9 | }, 10 | "include": ["src"], 11 | "references": [], 12 | "ts-node": { 13 | "transpileOnly": true, 14 | "compilerOptions": { 15 | "target": "es5", 16 | "module": "commonjs" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/printPathArray.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Build a string describing the path. 3 | */ 4 | export function printPathArray(path: ReadonlyArray): string { 5 | let result = ""; 6 | for (let i = 0; i < path.length; i++) { 7 | if (typeof path[i] === "number") { 8 | result += `[${path[i].toString()}]`; 9 | } else { 10 | if (i > 0) { 11 | result += "."; 12 | } 13 | result += path[i]; 14 | } 15 | } 16 | return result; 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/testing/core/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | MockLink, 3 | mockSingleLink, 4 | MockedResponse, 5 | ResultFunction 6 | } from './mocking/mockLink'; 7 | export { 8 | MockSubscriptionLink, 9 | mockObservableLink 10 | } from './mocking/mockSubscriptionLink'; 11 | export { createMockClient } from './mocking/mockClient'; 12 | export { default as subscribeAndCount } from './subscribeAndCount'; 13 | export { itAsync } from './itAsync'; 14 | export * from './withConsoleSpy'; 15 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/makeUniqueId.ts: -------------------------------------------------------------------------------- 1 | const prefixCounts = new Map(); 2 | 3 | // These IDs won't be globally unique, but they will be unique within this 4 | // process, thanks to the counter, and unguessable thanks to the random suffix. 5 | export function makeUniqueId(prefix: string) { 6 | const count = prefixCounts.get(prefix) || 1; 7 | prefixCounts.set(prefix, count + 1); 8 | return `${prefix}:${count}:${Math.random().toString(36).slice(2)}`; 9 | } 10 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Attach by Process ID", 9 | "processId": "${command:PickProcess}", 10 | "request": "attach", 11 | "skipFiles": ["/**"], 12 | "type": "pwa-node" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/__tests__/fromError.ts: -------------------------------------------------------------------------------- 1 | import { toPromise } from '../toPromise'; 2 | import { fromError, } from '../fromError'; 3 | 4 | describe('fromError', () => { 5 | it('acts as error call', () => { 6 | const error = new Error('I always error'); 7 | const observable = fromError(error); 8 | return toPromise(observable) 9 | .then(() => { throw "should not have thrown" }) 10 | .catch(actualError => expect(error).toEqual(actualError)); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-stream.graphql: -------------------------------------------------------------------------------- 1 | query TestStream @raw_response_type { 2 | node(id: "1") { 3 | ... on User { 4 | name 5 | friends(first: 10) 6 | @stream_connection( 7 | key: "PaginationFragment_friends" 8 | initial_count: 1 9 | ) { 10 | edges { 11 | node { 12 | id 13 | } 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-stream-connection.graphql: -------------------------------------------------------------------------------- 1 | query TestDefer @raw_response_type { 2 | node(id: "1") { 3 | ... on User { 4 | name 5 | friends(first: 10) 6 | @stream_connection(key: "TestDefer_friends", initial_count: 0) { 7 | edges { 8 | node { 9 | actor { 10 | name 11 | } 12 | } 13 | } 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-mering-scalars.graphql: -------------------------------------------------------------------------------- 1 | query ScalarMerging($id: ID!) { 2 | node(id: $id) { 3 | ... on User { 4 | favouriteMeal { 5 | ... on MealA { 6 | __typename 7 | ingredients { 8 | name 9 | isGood 10 | } 11 | } 12 | ... on MealB { 13 | __typename 14 | ingredients 15 | } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: PR 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | strategy: 10 | matrix: 11 | node-version: [16.x] 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | with: 16 | fetch-depth: 0 17 | - name: Use Node.js ${{ matrix.node-version }} 18 | uses: actions/setup-node@v1 19 | with: 20 | node-version: ${{ matrix.node-version }} 21 | - run: yarn install 22 | - run: yarn ci 23 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/linked-field.graphql: -------------------------------------------------------------------------------- 1 | fragment LinkedField on User { 2 | profilePicture { 3 | uri 4 | width 5 | height 6 | } 7 | hometown { 8 | # object 9 | id 10 | profilePicture { 11 | uri 12 | } 13 | } 14 | actor { 15 | # interface 16 | id 17 | } 18 | } 19 | 20 | query UnionTypeTest { 21 | neverNode { 22 | __typename 23 | ... on FakeNode { 24 | id 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/graphql-codegen-near-operation-file-preset-with-resolver-metadata/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log - @graphitation/graphql-codegen-near-operation-file-preset-with-resolver-metadata 2 | 3 | 4 | 5 | 6 | 7 | ## 1.1.0 8 | 9 | Wed, 30 Jul 2025 14:39:20 GMT 10 | 11 | ### Minor changes 12 | 13 | - Wrapping near-operation-file preset and adding resolvers metadata (77059398+vejrj@users.noreply.github.com) 14 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/graphiql/graphiql.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands } from "@fluentui/react-components"; 2 | 3 | export const qraphiqlStyles = makeStyles({ 4 | root: { 5 | flexShrink: 1, 6 | flexGrow: 1, 7 | flexBasic: 0, 8 | height: "100%", 9 | ...shorthands.padding("10px"), 10 | }, 11 | innerContainer: { 12 | height: "100%", 13 | backgroundColor: "#fff", 14 | ...shorthands.borderRadius("6px"), 15 | ...shorthands.overflow("auto"), 16 | }, 17 | }); 18 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/__tests__/canUse.ts: -------------------------------------------------------------------------------- 1 | import { canUseDOM, canUseLayoutEffect } from "../canUse"; 2 | 3 | describe("canUse* boolean constants", () => { 4 | // https://github.com/apollographql/apollo-client/pull/9675 5 | it("sets canUseDOM to true when using Jest in Node.js with jsdom", () => { 6 | expect(canUseDOM).toBe(true); 7 | }); 8 | it("sets canUseLayoutEffect to false when using Jest in Node.js with jsdom", () => { 9 | expect(canUseLayoutEffect).toBe(false); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/index.ts: -------------------------------------------------------------------------------- 1 | export { useCompiledLazyLoadQuery } from "./useCompiledLazyLoadQuery"; 2 | export { useCompiledFragment } from "./useCompiledFragment"; 3 | export { useCompiledRefetchableFragment } from "./useCompiledRefetchableFragment"; 4 | export { useCompiledPaginationFragment } from "./useCompiledPaginationFragment"; 5 | 6 | export type { RefetchFn, Disposable } from "./useCompiledRefetchableFragment"; 7 | export type { PaginationFn } from "./useCompiledPaginationFragment"; 8 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/throwServerError.ts: -------------------------------------------------------------------------------- 1 | export type ServerError = Error & { 2 | response: Response; 3 | result: Record; 4 | statusCode: number; 5 | }; 6 | 7 | export const throwServerError = ( 8 | response: Response, 9 | result: any, 10 | message: string 11 | ) => { 12 | const error = new Error(message) as ServerError; 13 | error.name = 'ServerError'; 14 | error.response = response; 15 | error.statusCode = response.status; 16 | error.result = result; 17 | throw error; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-handles.graphql: -------------------------------------------------------------------------------- 1 | query LinkedHandleField($id: ID!) @raw_response_type { 2 | node(id: $id) { 3 | ... on User { 4 | friends(first: 10) @__clientField(handle: "clientFriends") { 5 | count 6 | } 7 | } 8 | } 9 | } 10 | 11 | query ScalarHandleField($id: ID!) @raw_response_type { 12 | node(id: $id) { 13 | ... on User { 14 | name @__clientField(handle: "clientName") 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/src/utils/file.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "path"; 3 | 4 | const RESULTS_DIR = "results"; 5 | const TIMESTAMP = new Date().toISOString().replace(/[:.]/g, "-"); 6 | 7 | export const saveResultFile = (name: string, data: string) => { 8 | const fileName = name.replace(/(\.[^.]*)?$/, `-${TIMESTAMP}$1`); 9 | 10 | if (!fs.existsSync(RESULTS_DIR)) { 11 | fs.mkdirSync(RESULTS_DIR, { recursive: true }); 12 | } 13 | 14 | fs.writeFileSync(path.join(RESULTS_DIR, fileName), data); 15 | }; 16 | -------------------------------------------------------------------------------- /patches/source-map-js+1.2.1.patch: -------------------------------------------------------------------------------- 1 | diff --git a/node_modules/source-map-js/source-map.d.ts b/node_modules/source-map-js/source-map.d.ts 2 | index ec8892f..c22d01f 100644 3 | --- a/node_modules/source-map-js/source-map.d.ts 4 | +++ b/node_modules/source-map-js/source-map.d.ts 5 | @@ -4,7 +4,7 @@ export interface StartOfSourceMap { 6 | } 7 | 8 | export interface RawSourceMap extends StartOfSourceMap { 9 | - version: string; 10 | + version: number; 11 | sources: string[]; 12 | names: string[]; 13 | sourcesContent?: string[]; 14 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/mapValue.ts: -------------------------------------------------------------------------------- 1 | import type { ObjMap, ReadOnlyObjMap } from "./ObjMap"; 2 | 3 | /** 4 | * Creates an object map with the same keys as `map` and values generated by 5 | * running each value of `map` thru `fn`. 6 | */ 7 | export function mapValue( 8 | map: ReadOnlyObjMap, 9 | fn: (value: T, key: string) => V, 10 | ): ObjMap { 11 | const result = Object.create(null); 12 | 13 | for (const [key, value] of Object.entries(map)) { 14 | result[key] = fn(value, key); 15 | } 16 | return result; 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/selectURI.ts: -------------------------------------------------------------------------------- 1 | import { Operation } from '../core'; 2 | 3 | export const selectURI = ( 4 | operation: Operation, 5 | fallbackURI?: string | ((operation: Operation) => string), 6 | ) => { 7 | const context = operation.getContext(); 8 | const contextURI = context.uri; 9 | 10 | if (contextURI) { 11 | return contextURI; 12 | } else if (typeof fallbackURI === 'function') { 13 | return fallbackURI(operation); 14 | } else { 15 | return (fallbackURI as string) || '/graphql'; 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /packages/graphql-codegen-resolvers-models/src/config.ts: -------------------------------------------------------------------------------- 1 | import { RawConfig } from "@graphql-codegen/visitor-plugin-common"; 2 | 3 | export type MapperConfigValue = { 4 | extend?: boolean; 5 | exclude?: string[]; 6 | }; 7 | export interface ResolversModelsPluginConfig extends RawConfig { 8 | mappers?: { [typeName: string]: string }; 9 | mapperTypeSuffix?: string; 10 | mappersConfig?: { 11 | [typeName: string]: MapperConfigValue; 12 | }; 13 | federation?: boolean; 14 | modelIntersectionSuffix?: string; 15 | namespacedImportName?: string; 16 | } 17 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/src/LoadingSpinner.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * https://loading.io/css/ 3 | * https://github.com/loadingio/css-spinner/tree/master/src/spinner 4 | */ 5 | 6 | import * as React from "react"; 7 | 8 | export const LoadingSpinner: React.FC = () => ( 9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | ); 24 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/query-with-raw-response-on-literal-conditional.graphql: -------------------------------------------------------------------------------- 1 | query ExampleQuery($id: ID!) @raw_response_type { 2 | node(id: $id) { 3 | username 4 | ...FriendFragment 5 | ... @include(if: false) { 6 | friends(first: 0) { 7 | count 8 | } 9 | } 10 | } 11 | } 12 | 13 | fragment FriendFragment on User { 14 | ... @include(if: false) { 15 | name 16 | lastName 17 | feedback { 18 | id 19 | name 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/src/__tests__/non-nullable-list-items.test.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLRuleTester } from "@graphql-eslint/eslint-plugin"; 2 | import rule from "../non-nullable-list-items"; 3 | 4 | const ruleTester = new GraphQLRuleTester(); 5 | 6 | ruleTester.runGraphQLTests("non-nullable-list-items", rule, { 7 | valid: [ 8 | { 9 | code: ` 10 | type SomeType { 11 | someArray: [Item!] 12 | }`, 13 | }, 14 | ], 15 | invalid: [ 16 | { 17 | code: ` 18 | type SomeType { 19 | someArray: [Item] 20 | }`, 21 | errors: 1, 22 | }, 23 | ], 24 | }); 25 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/roots.graphql: -------------------------------------------------------------------------------- 1 | query ExampleQuery($id: ID!) { 2 | node(id: $id) { 3 | id 4 | } 5 | } 6 | 7 | fragment ExampleFragment on User { 8 | id 9 | } 10 | 11 | mutation TestMutation($input: CommentCreateInput!) { 12 | commentCreate(input: $input) { 13 | comment { 14 | id 15 | } 16 | } 17 | } 18 | 19 | subscription TestSubscription($input: FeedbackLikeInput) { 20 | feedbackLikeSubscribe(input: $input) { 21 | feedback { 22 | id 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/graphql-js-operation-payload-generator/scripts/graphql-codegen.ts: -------------------------------------------------------------------------------- 1 | import { generate } from "@graphql-codegen/cli"; 2 | 3 | generate( 4 | { 5 | schema: require.resolve("relay-test-utils-internal/lib/testschema.graphql"), 6 | generates: { 7 | "./src/__tests__/__generated__/schema-types.ts": { 8 | plugins: [ 9 | "typescript", 10 | "@graphitation/graphql-codegen-typescript-typemap-plugin", 11 | ], 12 | config: { 13 | allowEnumStringTypes: true, 14 | }, 15 | }, 16 | }, 17 | }, 18 | true, 19 | ); 20 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/src/utils/garbage-collection.ts: -------------------------------------------------------------------------------- 1 | export class GarbageCollector { 2 | private stats: number[] = []; 3 | 4 | public collect(): void { 5 | const memoryStart = process.memoryUsage().heapUsed; 6 | if (global.gc) { 7 | global.gc(); 8 | } 9 | const memoryEnd = process.memoryUsage().heapUsed; 10 | 11 | this.stats.push(memoryStart - memoryEnd); 12 | } 13 | 14 | public getStats() { 15 | return { 16 | runs: this.stats.length, 17 | totalMemoryFreed: this.stats.reduce((acc, curr) => acc + curr, 0), 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/__tests__/checkFetcher.ts: -------------------------------------------------------------------------------- 1 | import { checkFetcher } from '../checkFetcher'; 2 | import { voidFetchDuringEachTest } from './helpers'; 3 | 4 | describe('checkFetcher', () => { 5 | voidFetchDuringEachTest(); 6 | 7 | it('throws if no fetch is present', () => { 8 | expect(() => checkFetcher(undefined)).toThrow( 9 | /has not been found globally/, 10 | ); 11 | }); 12 | 13 | it('does not throws if no fetch is present but a fetch is passed', () => { 14 | expect(() => checkFetcher((() => {}) as any)).not.toThrow(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/components/common.styles.ts: -------------------------------------------------------------------------------- 1 | import { GriffelStyle } from "@griffel/core"; 2 | // import { tokens } from "@fluentui/react-components"; 3 | import { shorthands } from "@griffel/react"; 4 | 5 | export const keyboardFocusedStyle: (inset: string) => GriffelStyle = ( 6 | inset, 7 | ) => ({ 8 | "&:focus-visible": { 9 | outlineStyle: "none", 10 | "&:after": { 11 | content: "''", 12 | position: "absolute", 13 | inset, 14 | ...shorthands.border("2px", "solid", "black"), 15 | ...shorthands.borderRadius("4px"), 16 | }, 17 | }, 18 | }); 19 | -------------------------------------------------------------------------------- /scripts/config/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | rootDir: process.cwd(), 4 | roots: ["/src"], 5 | testPathIgnorePatterns: [ 6 | "node_modules", 7 | "__generated__", 8 | "__tests__/utils", 9 | "__tests__/helpers", 10 | "__tests__/fixtures", 11 | "graphql17.test.ts$", 12 | ], 13 | transform: { 14 | "node_modules[\\\\/]+quick-lru": [ 15 | "babel-jest", 16 | { plugins: ["@babel/plugin-transform-modules-commonjs"] }, 17 | ], 18 | }, 19 | transformIgnorePatterns: ["/node_modules/(?!(quick-lru))", ".pnp.[^\\]+$]"], 20 | }; 21 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "ts-node": { 4 | "transpileOnly": true, 5 | "compilerOptions": { 6 | "module": "commonjs", 7 | "target": "ES5", 8 | "moduleResolution": "Node" 9 | }, 10 | "moduleType": { 11 | "webpack.config.ts": "cjs" 12 | } 13 | }, 14 | "compilerOptions": { 15 | "jsx": "react", 16 | "target": "ES2019", 17 | "module": "ESNext", 18 | "moduleResolution": "Node", 19 | "strict": true, 20 | "allowSyntheticDefaultImports": true, 21 | "esModuleInterop": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /website/docs/learn-graphql/faq.md: -------------------------------------------------------------------------------- 1 | --- 2 | sidebar_position: 4 3 | id: faq 4 | title: Frequently Asked Questions 5 | --- 6 | 7 | # FAQ 8 | 9 | ## When should I expose a relationship as an object type? 10 | 11 | Whenever you have a field called `somethingId` or `something_id`, it is most likely the case that you will want to expose `something` as a relationship with an object type. 12 | 13 | If you do need just the raw identifier, e.g. for passing to APIs _outside_ of GraphQL, the user can query for `something.id`. 14 | 15 | [🔗 More information](./guides/thinking-in-graphql.md#-design-from-back-end-perspective) 16 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestQuery.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type hooksTestQueryVariables = { 7 | id: number; 8 | }; 9 | export type hooksTestQueryResponse = { 10 | readonly user: { 11 | readonly " $fragmentSpreads": FragmentRefs<"hooksTestFragment">; 12 | }; 13 | }; 14 | export type hooksTestQuery = { 15 | readonly response: hooksTestQueryResponse; 16 | readonly variables: hooksTestQueryVariables; 17 | }; 18 | -------------------------------------------------------------------------------- /packages/graphql-js-tag/README.md: -------------------------------------------------------------------------------- 1 | # graphql-js-tag 2 | 3 | A simple graphql-js AST based `graphql` tagged template function. 4 | 5 | This version makes a few assumptions that allow it to make some optimizations: 6 | 7 | - Documents will not be mutated once created, which allows copying interpolated documents by reference instead of value. 8 | - Documents are named uniquely and defined only once, which makes de-duping by reference possible. 9 | 10 | Other optimizations: 11 | 12 | - The `invariant` call can be stripped out when applicable. 13 | - Inline documents are parsed ahead-of-time and have their AST inlined. 14 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/validateOperation.ts: -------------------------------------------------------------------------------- 1 | import { InvariantError } from '../../utilities/globals' 2 | import { GraphQLRequest } from '../core'; 3 | 4 | export function validateOperation(operation: GraphQLRequest): GraphQLRequest { 5 | const OPERATION_FIELDS = [ 6 | 'query', 7 | 'operationName', 8 | 'variables', 9 | 'extensions', 10 | 'context', 11 | ]; 12 | for (let key of Object.keys(operation)) { 13 | if (OPERATION_FIELDS.indexOf(key) < 0) { 14 | throw new InvariantError(`illegal argument: ${key}`); 15 | } 16 | } 17 | 18 | return operation; 19 | } 20 | -------------------------------------------------------------------------------- /packages/supermassive/src/legacyAST/annotateDocumentGraphQLTransform.ts: -------------------------------------------------------------------------------- 1 | import { 2 | FragmentDefinitionNode, 3 | GraphQLSchema, 4 | Kind, 5 | OperationDefinitionNode, 6 | } from "graphql"; 7 | import { addTypesToRequestDocument } from "./addTypesToRequestDocument"; 8 | 9 | export const annotateDocumentGraphQLTransform = (schema: GraphQLSchema) => { 10 | return (node: FragmentDefinitionNode | OperationDefinitionNode) => { 11 | const document = addTypesToRequestDocument(schema, { 12 | kind: Kind.DOCUMENT, 13 | definitions: [node], 14 | }); 15 | return document.definitions[0]; 16 | }; 17 | }; 18 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/components/__generated__/TodoListQuery.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type TodoListQueryVariables = {}; 7 | export type TodoListQueryResponse = { 8 | readonly allTodos: ReadonlyArray<{ 9 | readonly id: string; 10 | readonly " $fragmentSpreads": FragmentRefs<"TodoFragment">; 11 | }>; 12 | }; 13 | export type TodoListQuery = { 14 | readonly response: TodoListQueryResponse; 15 | readonly variables: TodoListQueryVariables; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-additional-informations/additional-informations-container.tsx: -------------------------------------------------------------------------------- 1 | import React, { useContext } from "react"; 2 | import { ApolloGlobalOperationsContext } from "../contexts/apollo-global-operations-context"; 3 | import AdditionalInformationsRenderer from "./additional-informations-renderer"; 4 | 5 | const AdditionalInformationsContainer = React.memo(() => { 6 | const globalOperations = useContext(ApolloGlobalOperationsContext); 7 | 8 | return ; 9 | }); 10 | 11 | export default AdditionalInformationsContainer; 12 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/toObjMap.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | ObjMap, 3 | ObjMapLike, 4 | ReadOnlyObjMap, 5 | ReadOnlyObjMapLike, 6 | } from "./ObjMap"; 7 | 8 | export function toObjMap(obj: ObjMapLike): ObjMap; 9 | export function toObjMap(obj: ReadOnlyObjMapLike): ReadOnlyObjMap; 10 | export function toObjMap(obj: ObjMapLike | ReadOnlyObjMapLike) { 11 | if (Object.getPrototypeOf(obj) === null) { 12 | return obj; 13 | } 14 | 15 | const map = Object.create(null); 16 | for (const [key, value] of Object.entries(obj)) { 17 | map[key] = value; 18 | } 19 | return map; 20 | } 21 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/__tests__/serializeFetchParameter.ts: -------------------------------------------------------------------------------- 1 | import { serializeFetchParameter } from '../serializeFetchParameter'; 2 | 3 | describe('serializeFetchParameter', () => { 4 | it('throws a parse error on an unparsable body', () => { 5 | const b = {}; 6 | const a = { b }; 7 | (b as any).a = a; 8 | 9 | expect(() => serializeFetchParameter(b, 'Label')).toThrow(/Label/); 10 | }); 11 | 12 | it('returns a correctly parsed body', () => { 13 | const body = { no: 'thing' }; 14 | 15 | expect(serializeFetchParameter(body, 'Label')).toEqual('{"no":"thing"}'); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/components/__generated__/TodoFragment.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type TodoFragment = { 7 | readonly id: string; 8 | readonly text: string; 9 | readonly isCompleted: boolean; 10 | readonly " $fragmentType": "TodoFragment"; 11 | }; 12 | export type TodoFragment$data = TodoFragment; 13 | export type TodoFragment$key = { 14 | readonly " $data"?: TodoFragment$data | undefined; 15 | readonly " $fragmentSpreads": FragmentRefs<"TodoFragment">; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/compilerTransforms/utils.ts: -------------------------------------------------------------------------------- 1 | import invariant from "invariant"; 2 | import { CompilerContext, Fragment } from "relay-compiler"; 3 | 4 | export function implementsNodeInterface( 5 | context: CompilerContext, 6 | fragmentDefinition: Fragment, 7 | ) { 8 | const schema = context.getSchema(); 9 | const nodeType = schema.getTypeFromString("Node"); 10 | invariant( 11 | nodeType && schema.isInterface(nodeType), 12 | "Expected schema to define a Node interface in order to support narrow observables.", 13 | ); 14 | return schema.mayImplement(fragmentDefinition.type, nodeType); 15 | } 16 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/__tests__/encodeASTSchema.test.ts: -------------------------------------------------------------------------------- 1 | import { encodeASTSchema } from "../encodeASTSchema"; 2 | import { swapiSDL } from "./fixtures/swapiSDL"; 3 | import { kitchenSinkSDL } from "./fixtures/kitchenSinkSDL"; 4 | 5 | describe(encodeASTSchema, () => { 6 | test("correctly encodes swapi AST schema", () => { 7 | const encoded = encodeASTSchema(swapiSDL.document); 8 | expect(encoded).toMatchSnapshot(); 9 | }); 10 | 11 | test("correctly encodes kitchen sink AST schema", () => { 12 | const encoded = encodeASTSchema(kitchenSinkSDL.document); 13 | expect(encoded).toMatchSnapshot(); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/cache/inmemory/fixPolyfills.ts: -------------------------------------------------------------------------------- 1 | // Most JavaScript environments do not need the workarounds implemented in 2 | // fixPolyfills.native.ts, so importing fixPolyfills.ts merely imports 3 | // this empty module, adding nothing to bundle sizes or execution times. 4 | // When bundling for React Native, we substitute fixPolyfills.native.js 5 | // for fixPolyfills.js (see the "react-native" section of package.json), 6 | // to work around problems with Map and Set polyfills in older versions of 7 | // React Native (which should have been fixed in react-native@0.59.0): 8 | // https://github.com/apollographql/apollo-client/pull/5962 9 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/serializeFetchParameter.ts: -------------------------------------------------------------------------------- 1 | import { InvariantError } from '../../utilities/globals'; 2 | 3 | export type ClientParseError = InvariantError & { 4 | parseError: Error; 5 | }; 6 | 7 | export const serializeFetchParameter = (p: any, label: string) => { 8 | let serialized; 9 | try { 10 | serialized = JSON.stringify(p); 11 | } catch (e) { 12 | const parseError = new InvariantError( 13 | `Network request failed. ${label} is not serializable: ${e.message}`, 14 | ) as ClientParseError; 15 | parseError.parseError = e; 16 | throw parseError; 17 | } 18 | return serialized; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/supermassive/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "composite": true, 5 | "tsBuildInfoFile": ".tsbuildinfo", 6 | "rootDir": "src", 7 | "outDir": "lib", 8 | "jsx": "react", 9 | "skipLibCheck": true, 10 | "paths": { 11 | "@graphql-tools/schema": ["./node_modules/@graphql-tools/schema"], 12 | "graphql": ["./node_modules/graphql"] 13 | } 14 | }, 15 | "include": ["src"], 16 | "exclude": ["**/*.graphql17.test.ts"], 17 | "ts-node": { 18 | "transpileOnly": true, 19 | "compilerOptions": { 20 | "module": "CommonJS" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module "relay-compiler/lib/transforms/FilterDirectivesTransform" { 2 | import { IRTransform } from "relay-compiler/lib/core/CompilerContext"; 3 | export const transform: IRTransform; 4 | } 5 | 6 | declare module "relay-compiler/lib/transforms/ConnectionTransform" { 7 | import { IRTransform } from "relay-compiler/lib/core/CompilerContext"; 8 | export const transform: IRTransform; 9 | export const SCHEMA_EXTENSION: string; 10 | } 11 | 12 | declare module "relay-compiler/lib/util/dedupeJSONStringify" { 13 | export default function dedupeJSONStringify(obj: unknown): string; 14 | } 15 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Ostapoff Basic", 3 | "name": "Ostapoff Basic Template for CRA", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/testing/core/mocking/mockQueryManager.ts: -------------------------------------------------------------------------------- 1 | import { QueryManager } from '../../../core/QueryManager'; 2 | import { mockSingleLink, MockedResponse } from './mockLink'; 3 | import { InMemoryCache } from '../../../cache'; 4 | 5 | // Helper method for the tests that construct a query manager out of a 6 | // a list of mocked responses for a mocked network interface. 7 | export default ( 8 | reject: (reason: any) => any, 9 | ...mockedResponses: MockedResponse[] 10 | ) => { 11 | return new QueryManager({ 12 | link: mockSingleLink(...mockedResponses), 13 | cache: new InMemoryCache({ addTypename: false }), 14 | }); 15 | }; 16 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/match-field.graphql: -------------------------------------------------------------------------------- 1 | fragment NameRendererFragment on User { 2 | id 3 | nameRenderer @match { 4 | ...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") 5 | ...MarkdownUserNameRenderer_name 6 | @module(name: "MarkdownUserNameRenderer.react") 7 | } 8 | } 9 | 10 | fragment PlainUserNameRenderer_name on PlainUserNameRenderer { 11 | plaintext 12 | data { 13 | text 14 | } 15 | } 16 | 17 | fragment MarkdownUserNameRenderer_name on MarkdownUserNameRenderer { 18 | markdown 19 | data { 20 | markup 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/fixtures/a-jest-test.ts: -------------------------------------------------------------------------------- 1 | function graphql(..._args: any[]) { 2 | return "this is not the function you are looking for"; 3 | } 4 | 5 | describe("a jest test", () => { 6 | it("succeeds", () => { 7 | expect( 8 | graphql` 9 | fragment SomeComponent_query on Query { 10 | helloWorld 11 | } 12 | `, 13 | ).toEqual("hello world"); 14 | }); 15 | 16 | it("fails", () => { 17 | expect( 18 | graphql` 19 | fragment SomeComponent_query on Query { 20 | helloWorld 21 | } 22 | `, 23 | ).toEqual("bye world"); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestMutation.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type hooksTestMutationVariables = { 7 | id: string; 8 | name: string; 9 | }; 10 | export type hooksTestMutationResponse = { 11 | readonly updateUserName: { 12 | readonly " $fragmentSpreads": FragmentRefs<"hooksTestFragment">; 13 | }; 14 | }; 15 | export type hooksTestMutation = { 16 | readonly response: hooksTestMutationResponse; 17 | readonly variables: hooksTestMutationVariables; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestSubscription.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type hooksTestSubscriptionVariables = { 7 | id: string; 8 | }; 9 | export type hooksTestSubscriptionResponse = { 10 | readonly userNameChanged: { 11 | readonly " $fragmentSpreads": FragmentRefs<"hooksTestFragment">; 12 | }; 13 | }; 14 | export type hooksTestSubscription = { 15 | readonly response: hooksTestSubscriptionResponse; 16 | readonly variables: hooksTestSubscriptionVariables; 17 | }; 18 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/VirtualizedJsonViewer.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { useVirtualizedJsonViewerStyles } from "./VirtualizedJsonViewer.styles"; 3 | 4 | interface VirtualizedJsonViewerProps { 5 | data: unknown; 6 | maxHeight?: number; 7 | } 8 | 9 | export const VirtualizedJsonViewer: React.FC = ({ 10 | data, 11 | maxHeight = 400, 12 | }) => { 13 | const classes = useVirtualizedJsonViewerStyles(); 14 | 15 | return ( 16 |
17 |       {JSON.stringify(data, null, 2)}
18 |     
19 | ); 20 | }; 21 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/compact.ts: -------------------------------------------------------------------------------- 1 | import { TupleToIntersection } from './mergeDeep'; 2 | 3 | /** 4 | * Merges the provided objects shallowly and removes 5 | * all properties with an `undefined` value 6 | */ 7 | export function compact( 8 | ...objects: TArgs 9 | ): TupleToIntersection { 10 | const result = Object.create(null); 11 | 12 | objects.forEach(obj => { 13 | if (!obj) return; 14 | Object.keys(obj).forEach(key => { 15 | const value = (obj as any)[key]; 16 | if (value !== void 0) { 17 | result[key] = value; 18 | } 19 | }); 20 | }); 21 | 22 | return result; 23 | } 24 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation-with-response-on-inline-fragments.graphql: -------------------------------------------------------------------------------- 1 | mutation TestMutation($input: CommentCreateInput!) @raw_response_type { 2 | commentCreate(input: $input) { 3 | viewer { 4 | actor { 5 | ...InlineFragmentWithOverlappingFields 6 | } 7 | } 8 | } 9 | } 10 | 11 | fragment InlineFragmentWithOverlappingFields on Actor { 12 | ... on User { 13 | hometown { 14 | id 15 | name 16 | } 17 | } 18 | ... on Page { 19 | name 20 | hometown { 21 | id 22 | message { 23 | text 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/match-field-in-query.graphql: -------------------------------------------------------------------------------- 1 | query NameRendererQuery { 2 | me { 3 | nameRenderer @match { 4 | ...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") 5 | ...MarkdownUserNameRenderer_name 6 | @module(name: "MarkdownUserNameRenderer.react") 7 | } 8 | } 9 | } 10 | 11 | fragment PlainUserNameRenderer_name on PlainUserNameRenderer { 12 | plaintext 13 | data { 14 | text 15 | } 16 | } 17 | 18 | fragment MarkdownUserNameRenderer_name on MarkdownUserNameRenderer { 19 | markdown 20 | data { 21 | markup 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/__tests__/__generated__/hooksTestFragment.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type hooksTestFragment = { 7 | readonly id: string; 8 | readonly name: string; 9 | readonly __typename: "User"; 10 | readonly " $fragmentType": "hooksTestFragment"; 11 | }; 12 | export type hooksTestFragment$data = hooksTestFragment; 13 | export type hooksTestFragment$key = { 14 | readonly " $data"?: hooksTestFragment$data | undefined; 15 | readonly " $fragmentSpreads": FragmentRefs<"hooksTestFragment">; 16 | }; 17 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/schema/utils.ts: -------------------------------------------------------------------------------- 1 | import { Kind } from "graphql"; 2 | import { OperationDefinitionNode } from "@graphitation/supermassive"; 3 | import { Operation } from "@apollo/client"; 4 | 5 | export function getOperationDefinitionNode( 6 | operation: Operation 7 | ): OperationDefinitionNode | null { 8 | if (operation?.query?.definitions) { 9 | const operationDefinitionNode = operation.query.definitions.find( 10 | ({ kind }) => kind === Kind.OPERATION_DEFINITION 11 | ) as OperationDefinitionNode | undefined; 12 | 13 | if (operationDefinitionNode?.operation) { 14 | return operationDefinitionNode; 15 | } 16 | } 17 | return null; 18 | } 19 | -------------------------------------------------------------------------------- /package-template/src/cli-cjs.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * This trampoline allows dependent packages inside this monorepo to use this 5 | * CLI tool without first needing to compile the TypeScript code to CommonJS 6 | * for Node to consume. 7 | * 8 | * It relies on the `bin` entry of the `package.json` file to point to this 9 | * file, but be overwritten by a `publishConfig.bin` entry to point directly to 10 | * the compiled version of `cli.ts`. 11 | */ 12 | 13 | // Configure dynamic ts compiler 14 | require("ts-node").register({ 15 | project: require("path").resolve(__dirname, "../tsconfig.json"), 16 | }); 17 | // Now load normal ts cli bin 18 | require("./cli"); 19 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/observables/iteration.ts: -------------------------------------------------------------------------------- 1 | import { Observer } from "./Observable"; 2 | 3 | export function iterateObserversSafely( 4 | observers: Set>, 5 | method: keyof Observer, 6 | argument?: A, 7 | ) { 8 | // In case observers is modified during iteration, we need to commit to the 9 | // original elements, which also provides an opportunity to filter them down 10 | // to just the observers with the given method. 11 | const observersWithMethod: Observer[] = []; 12 | observers.forEach(obs => obs[method] && observersWithMethod.push(obs)); 13 | observersWithMethod.forEach(obs => (obs as any)[method](argument)); 14 | } 15 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/annotateDocumentGraphQLTransform.ts: -------------------------------------------------------------------------------- 1 | import { 2 | FragmentDefinitionNode, 3 | GraphQLSchema, 4 | OperationDefinitionNode, 5 | } from "graphql"; 6 | import { 7 | addMinimalViableSchemaToExecutableDefinitionNode, 8 | AddMinimalViableSchemaToRequestDocumentOptions, 9 | } from "./addMinimalViableSchemaToRequestDocument"; 10 | 11 | export const annotateDocumentGraphQLTransform = ( 12 | schema: GraphQLSchema, 13 | options?: AddMinimalViableSchemaToRequestDocumentOptions, 14 | ) => { 15 | return (node: FragmentDefinitionNode | OperationDefinitionNode) => 16 | addMinimalViableSchemaToExecutableDefinitionNode(schema, node, options); 17 | }; 18 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/__tests__/rewriteGraphitationDirectives.test.ts: -------------------------------------------------------------------------------- 1 | import { rewriteGraphitationDirectives } from "../rewriteGraphitationDirectives"; 2 | import dedent from "dedent"; 3 | 4 | describe(rewriteGraphitationDirectives, () => { 5 | it("rewrites @watchNode to Relay's @refetchable", () => { 6 | const doc = ` 7 | fragment SomeModule_fooFragment on User @watchNode { 8 | name 9 | } 10 | `; 11 | expect(rewriteGraphitationDirectives(doc).trim()).toEqual(dedent` 12 | fragment SomeModule_fooFragment on User @refetchable(queryName: "SomeModule_fooWatchNodeQuery") { 13 | name 14 | } 15 | `); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/components/__generated__/TodoUpdatesSubscription.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type TodoUpdatesSubscriptionVariables = { 7 | limit: number; 8 | }; 9 | export type TodoUpdatesSubscriptionResponse = { 10 | readonly emitTodos: { 11 | readonly id: string; 12 | readonly " $fragmentSpreads": FragmentRefs<"TodoFragment">; 13 | } | null; 14 | }; 15 | export type TodoUpdatesSubscription = { 16 | readonly response: TodoUpdatesSubscriptionResponse; 17 | readonly variables: TodoUpdatesSubscriptionVariables; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/toPromise.ts: -------------------------------------------------------------------------------- 1 | import { invariant } from '../../utilities/globals'; 2 | import { Observable } from '../../utilities'; 3 | 4 | export function toPromise(observable: Observable): Promise { 5 | let completed = false; 6 | return new Promise((resolve, reject) => { 7 | observable.subscribe({ 8 | next: data => { 9 | if (completed) { 10 | invariant.warn( 11 | `Promise Wrapper does not support multiple results from Observable`, 12 | ); 13 | } else { 14 | completed = true; 15 | resolve(data); 16 | } 17 | }, 18 | error: reject, 19 | }); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/testing/core/mocking/mockClient.ts: -------------------------------------------------------------------------------- 1 | import { DocumentNode } from 'graphql'; 2 | 3 | import { ApolloClient } from '../../../core'; 4 | import { InMemoryCache, NormalizedCacheObject } from '../../../cache'; 5 | import { mockSingleLink } from './mockLink'; 6 | 7 | export function createMockClient( 8 | data: TData, 9 | query: DocumentNode, 10 | variables = {}, 11 | ): ApolloClient { 12 | return new ApolloClient({ 13 | link: mockSingleLink({ 14 | request: { query, variables }, 15 | result: { data }, 16 | }).setOnError(error => { throw error }), 17 | cache: new InMemoryCache({ addTypename: false }), 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/src/non-nullable-list-items.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLESLintRule } from "@graphql-eslint/eslint-plugin"; 2 | 3 | const rule: GraphQLESLintRule = { 4 | meta: { 5 | type: "problem", 6 | docs: { 7 | description: `Ensures that list items are not nullable`, 8 | category: "Schema", 9 | }, 10 | schema: [], 11 | }, 12 | create(context) { 13 | return { 14 | ListType(node) { 15 | if (node.gqlType.kind !== "NonNullType") { 16 | context.report({ 17 | message: `List items must be not nullable.`, 18 | node, 19 | }); 20 | } 21 | }, 22 | }; 23 | }, 24 | }; 25 | 26 | export default rule; 27 | -------------------------------------------------------------------------------- /packages/supermassive/src/utilities/schemaFragmentFromMinimalViableSchemaDocument.ts: -------------------------------------------------------------------------------- 1 | import { 2 | DocumentWithMinimalViableSchema, 3 | SchemaFragment, 4 | UserResolvers, 5 | } from "../types"; 6 | import { createSchemaDefinitions } from "./mergeSchemaDefinitions"; 7 | 8 | export function schemaFragmentFromMinimalViableSchemaDocument( 9 | document: DocumentWithMinimalViableSchema, 10 | resolvers: UserResolvers, 11 | schemaId: string, 12 | ): SchemaFragment { 13 | const schemaDefinitions = createSchemaDefinitions( 14 | document.definitions.map((def) => def.__defs), 15 | ); 16 | 17 | return { 18 | schemaId, 19 | definitions: schemaDefinitions, 20 | resolvers, 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/src/index.tsx: -------------------------------------------------------------------------------- 1 | import "./wdyr"; 2 | 3 | import * as React from "react"; 4 | import ReactDOM from "react-dom"; 5 | import App from "./App"; 6 | import { ApolloClient, ApolloProvider } from "@apollo/client"; 7 | import { createClient } from "./graphql"; 8 | 9 | const client = createClient(); 10 | 11 | ReactDOM.render( 12 | 13 | 14 | 15 | 16 | , 17 | document.getElementById("root"), 18 | ); 19 | 20 | /** 21 | * Make the client available to the debug console. 22 | */ 23 | declare global { 24 | var $client: ApolloClient; 25 | } 26 | global.$client = client; 27 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation-with-enums-on-fragment.graphql: -------------------------------------------------------------------------------- 1 | mutation CommentCreateMutation( 2 | $input: CommentCreateInput! 3 | $first: Int 4 | $orderBy: [String!] 5 | ) @raw_response_type { 6 | commentCreate(input: $input) { 7 | comment { 8 | friends(first: $first, orderby: $orderBy) { 9 | edges { 10 | node { 11 | id 12 | __typename 13 | ...FriendFragment 14 | } 15 | } 16 | } 17 | } 18 | } 19 | } 20 | 21 | fragment FriendFragment on User { 22 | name 23 | lastName 24 | profilePicture2 { 25 | test_enums 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/cli-cjs.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * This trampoline allows dependent packages inside this monorepo to use this 5 | * CLI tool without first needing to compile the TypeScript code to CommonJS 6 | * for Node to consume. 7 | * 8 | * It relies on the `bin` entry of the `package.json` file to point to this 9 | * file, but be overwritten by a `publishConfig.bin` entry to point directly to 10 | * the compiled version of `cli.ts`. 11 | */ 12 | 13 | // Configure dynamic ts compiler 14 | require("ts-node").register({ 15 | project: require("path").resolve(__dirname, "../tsconfig.json"), 16 | }); 17 | // Now load normal ts cli bin 18 | require("./cli"); 19 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/compiledHooks/types.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | 3 | export interface FragmentReference { 4 | /** 5 | * In case of a watch query on a Node type, the `id` needs to be provided. 6 | * In case of a watch query on the Query type, this should be omitted. 7 | */ 8 | id?: unknown; 9 | 10 | /** 11 | * These are the request variables, which is named awkwardly `__fragments` 12 | * because that's the name of the property Relay uses to pass context data so 13 | * not introducing a different property name felt right, from a migration 14 | * perspective. 15 | */ 16 | __fragments?: Record; 17 | } 18 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/config/jest.config.js: -------------------------------------------------------------------------------- 1 | const { compilerOptions } = require("../tsconfig.json"); 2 | 3 | module.exports = { 4 | rootDir: '../src', 5 | transform: { 6 | '^.+.(t|j)sx?$': 'ts-jest' 7 | }, 8 | transformIgnorePatterns: [ 9 | '/node_modules/(?!(quick-lru))' 10 | ], 11 | globals: { 12 | 'ts-jest': { 13 | diagnostics: { 14 | exclude: ['**'], 15 | }, 16 | tsconfig: { 17 | ...compilerOptions, 18 | allowJs: true, 19 | }, 20 | }, 21 | }, 22 | moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], 23 | testURL: 'http://localhost', 24 | setupFiles: ['/config/jest/setup.ts'], 25 | testEnvironment: 'jsdom', 26 | }; 27 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/testing/core/mocking/mockWatchQuery.ts: -------------------------------------------------------------------------------- 1 | import { MockedResponse } from './mockLink'; 2 | import mockQueryManager from './mockQueryManager'; 3 | import { ObservableQuery } from '../../../core'; 4 | 5 | export default ( 6 | reject: (reason: any) => any, 7 | ...mockedResponses: MockedResponse[] 8 | ): ObservableQuery => { 9 | const queryManager = mockQueryManager(reject, ...mockedResponses); 10 | const firstRequest = mockedResponses[0].request; 11 | return queryManager.watchQuery({ 12 | query: firstRequest.query!, 13 | variables: firstRequest.variables, 14 | notifyOnNetworkStatusChange: false // XXX might not always be the right option. Set for legacy reasons. 15 | }); 16 | }; 17 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/unmasked-fragment-spreads.graphql: -------------------------------------------------------------------------------- 1 | fragment UserProfile on User { 2 | profilePicture(size: $ProfilePicture_SIZE) { 3 | ...PhotoFragment @relay(mask: false) 4 | 5 | # duplicated field should be merged 6 | ...AnotherRecursiveFragment @relay(mask: false) 7 | 8 | # Compose child fragment 9 | ...PhotoFragment 10 | } 11 | } 12 | 13 | fragment PhotoFragment on Image { 14 | uri 15 | ...RecursiveFragment @relay(mask: false) 16 | } 17 | 18 | fragment RecursiveFragment on Image @relay(mask: false) { 19 | uri 20 | width 21 | } 22 | 23 | fragment AnotherRecursiveFragment on Image { 24 | uri 25 | height 26 | } 27 | -------------------------------------------------------------------------------- /.config/1espt/PipelineAutobaseliningConfig.yml: -------------------------------------------------------------------------------- 1 | ## DO NOT MODIFY THIS FILE MANUALLY. This is part of auto-baselining from 1ES Pipeline Templates. Go to [https://aka.ms/1espt-autobaselining] for more details. 2 | 3 | pipelines: 4 | 8: 5 | retail: 6 | source: 7 | credscan: 8 | lastModifiedDate: 2024-10-14 9 | eslint: 10 | lastModifiedDate: 2024-10-14 11 | psscriptanalyzer: 12 | lastModifiedDate: 2024-10-14 13 | armory: 14 | lastModifiedDate: 2024-10-14 15 | binary: 16 | credscan: 17 | lastModifiedDate: 2025-01-20 18 | binskim: 19 | lastModifiedDate: 2025-01-20 20 | spotbugs: 21 | lastModifiedDate: 2025-01-20 22 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/hooks/useApolloClient.ts: -------------------------------------------------------------------------------- 1 | import { invariant } from '../../utilities/globals'; 2 | import { useContext } from 'react'; 3 | import { ApolloClient } from '../../core'; 4 | import { getApolloContext } from '../context'; 5 | 6 | export function useApolloClient( 7 | override?: ApolloClient, 8 | ): ApolloClient { 9 | const context = useContext(getApolloContext()); 10 | const client = override || context.client; 11 | invariant( 12 | !!client, 13 | 'Could not find "client" in the context or passed in as an option. ' + 14 | 'Wrap the root component in an , or pass an ApolloClient ' + 15 | 'instance in via options.', 16 | ); 17 | 18 | return client; 19 | } 20 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation-with-append-prepend-edge.graphql: -------------------------------------------------------------------------------- 1 | mutation AppendEdgeMutation( 2 | $input: CommentCreateInput!, 3 | $connections: [ID!]! 4 | ) { 5 | commentCreate(input: $input) { 6 | feedbackCommentEdge @appendEdge(connections: $connections) { 7 | cursor 8 | node { 9 | id 10 | } 11 | } 12 | } 13 | } 14 | 15 | mutation PrependEdgeMutation( 16 | $input: CommentCreateInput!, 17 | $connections: [ID!]! 18 | ) { 19 | commentCreate(input: $input) { 20 | feedbackCommentEdge @prependEdge(connections: $connections) { 21 | cursor 22 | node { 23 | id 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/data/queries/add-task.graphql: -------------------------------------------------------------------------------- 1 | query AddTask { 2 | organization { 3 | id 4 | departments { 5 | edges { 6 | node { 7 | id 8 | teams { 9 | id 10 | members { 11 | id 12 | projects { 13 | id 14 | tasks { 15 | id 16 | title 17 | completed 18 | priority 19 | assignee { 20 | id 21 | name 22 | email 23 | } 24 | } 25 | } 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "esModuleInterop": true, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "noEmit": true, 16 | "jsx": "react-jsx", 17 | "baseUrl": "src", 18 | "noFallthroughCasesInSwitch": true 19 | }, 20 | "include": ["src"], 21 | "ts-node": { 22 | "compilerOptions": { 23 | "module": "commonjs" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/src/__tests__/non-nullable-fields.test.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLRuleTester } from "@graphql-eslint/eslint-plugin"; 2 | import rule from "../non-nullable-fields"; 3 | 4 | const ruleTester = new GraphQLRuleTester(); 5 | 6 | ruleTester.runGraphQLTests("non-nullable-fields", rule, { 7 | valid: [ 8 | { 9 | code: ` 10 | type ChatMessage { 11 | id: String! 12 | content: String 13 | }`, 14 | options: [{ fields: ["id"] }], 15 | }, 16 | ], 17 | invalid: [ 18 | { 19 | code: ` 20 | type ChatMessage { 21 | id: String 22 | content: String 23 | someOtherImportantField: String 24 | }`, 25 | options: [{ fields: ["id", "someOtherImportantField"] }], 26 | errors: 2, 27 | }, 28 | ], 29 | }); 30 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/cache/inmemory/__tests__/__snapshots__/fragmentMatcher.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`policies.fragmentMatches can infer fuzzy subtypes heuristically 1`] = ` 4 | Object { 5 | "ROOT_QUERY": Object { 6 | "__typename": "Query", 7 | "objects": Array [ 8 | Object { 9 | "__typename": "E", 10 | "c": "ce", 11 | }, 12 | Object { 13 | "__typename": "F", 14 | "c": "cf", 15 | }, 16 | Object { 17 | "__typename": "G", 18 | "c": "cg", 19 | }, 20 | Object { 21 | "__typename": "TooLong", 22 | }, 23 | Object { 24 | "__typename": "H", 25 | }, 26 | ], 27 | }, 28 | } 29 | `; 30 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-additional-informations/additional-info.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands } from "@fluentui/react-components"; 2 | 3 | export const useStyles = makeStyles({ 4 | root: { 5 | flexShrink: 1, 6 | flexGrow: 1, 7 | flexBasic: 0, 8 | height: "calc(100% - 15px)", 9 | ...shorthands.padding("10px"), 10 | }, 11 | innerContainer: { 12 | height: "100%", 13 | backgroundColor: "#fff", 14 | ...shorthands.borderRadius("6px"), 15 | ...shorthands.overflow("auto"), 16 | }, 17 | infoItem: { 18 | ...shorthands.padding("10px"), 19 | ...shorthands.borderBottom("1px", "solid", "#F5F5F5"), 20 | "&:hover": { 21 | backgroundColor: "#F5F5F6", 22 | }, 23 | }, 24 | }); 25 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/components/Todo.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { useFragment } from "@graphitation/apollo-react-relay-duct-tape"; 4 | import { graphql } from "@graphitation/graphql-js-tag"; 5 | import { TodoFragment$key } from "./__generated__/TodoFragment.graphql"; 6 | 7 | export const TodoFragment = graphql` 8 | fragment TodoFragment on Todo { 9 | id 10 | text 11 | isCompleted 12 | } 13 | `; 14 | 15 | const Todo = ({ todo: todoRef }: { todo: TodoFragment$key }) => { 16 | const todo = useFragment(TodoFragment, todoRef); 17 | 18 | return ( 19 | <> 20 | {todo.text} 21 | 22 | 23 | ); 24 | }; 25 | 26 | export default Todo; 27 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/__tests__/validateOperation.ts: -------------------------------------------------------------------------------- 1 | import { validateOperation, } from '../validateOperation'; 2 | import gql from "graphql-tag"; 3 | 4 | describe('validateOperation', () => { 5 | it('should throw when invalid field in operation', () => { 6 | expect(() => validateOperation({ qwerty: '' })).toThrow(); 7 | }); 8 | 9 | it('should not throw when valid fields in operation', () => { 10 | expect(() => 11 | validateOperation({ 12 | query: gql` 13 | query SampleQuery { 14 | stub { 15 | id 16 | } 17 | } 18 | `, 19 | context: {}, 20 | variables: {}, 21 | }), 22 | ).not.toThrow(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/mutation-with-nested-fragments.graphql: -------------------------------------------------------------------------------- 1 | mutation CommentCreateMutation( 2 | $input: CommentCreateInput! 3 | $first: Int 4 | $orderBy: [String!] 5 | ) @raw_response_type { 6 | commentCreate(input: $input) { 7 | comment { 8 | friends(first: $first, orderby: $orderBy) { 9 | edges { 10 | node { 11 | lastName 12 | ...FriendFragment 13 | } 14 | } 15 | } 16 | } 17 | } 18 | } 19 | 20 | fragment FriendFragment on User { 21 | name 22 | lastName 23 | feedback { 24 | ...FeedbackFragment 25 | } 26 | } 27 | 28 | fragment FeedbackFragment on Feedback { 29 | id 30 | name 31 | } 32 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/components/index.ts: -------------------------------------------------------------------------------- 1 | export { TimelineItem } from "./TimelineItem"; 2 | export type { TimelineItemProps } from "./TimelineItem"; 3 | 4 | export { MissingFieldItem } from "./MissingFieldItem"; 5 | export type { MissingFieldItemProps } from "./MissingFieldItem"; 6 | 7 | export { OperationMetadata } from "./OperationMetadata"; 8 | export type { OperationMetadataProps } from "./OperationMetadata"; 9 | 10 | export { DialogHeader } from "./DialogHeader"; 11 | export type { DialogHeaderProps } from "./DialogHeader"; 12 | 13 | export { ArrayIndexItem } from "./ArrayIndexItem"; 14 | export { ListViewMode } from "./ListViewMode"; 15 | export { ArrayRow } from "./ArrayRow"; 16 | export * from "./arrayDiffUtils"; 17 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/src/components/chat/messages.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands } from "@fluentui/react-components"; 2 | 3 | export const useMessagesStyles = makeStyles({ 4 | itemContainer: { 5 | display: "grid", 6 | gridTemplateColumns: "auto 450px 150px", 7 | alignItems: "center", 8 | ...shorthands.padding("10px", "20px"), 9 | ...shorthands.borderBottom("1px", "solid", "#F5F5F5"), 10 | "&:hover": { 11 | backgroundColor: "#F5F5F6", 12 | }, 13 | }, 14 | idColumn: { 15 | ...shorthands.overflow("hidden"), 16 | textOverflow: "ellipsis", 17 | whiteSpace: "nowrap", 18 | }, 19 | button: { 20 | minWidth: "auto", 21 | height: "auto", 22 | ...shorthands.padding("3px", "12px"), 23 | }, 24 | }); 25 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/testing/core/itAsync.ts: -------------------------------------------------------------------------------- 1 | function wrap(key?: "only" | "skip" | "todo") { 2 | return ( 3 | message: string, 4 | callback: ( 5 | resolve: (result?: any) => void, 6 | reject: (reason?: any) => void, 7 | ) => any, 8 | timeout?: number, 9 | ) => (key ? it[key] : it)(message, function () { 10 | return new Promise( 11 | (resolve, reject) => callback.call(this, resolve, reject), 12 | ); 13 | }, timeout); 14 | } 15 | 16 | const wrappedIt = wrap(); 17 | 18 | export const itAsync = Object.assign(function ( 19 | ...args: Parameters 20 | ) { 21 | return wrappedIt.apply(this, args); 22 | }, { 23 | only: wrap("only"), 24 | skip: wrap("skip"), 25 | todo: wrap("todo"), 26 | }); 27 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noImplicitAny": true, 4 | "strictNullChecks": true, 5 | "noUnusedParameters": false, 6 | "noUnusedLocals": true, 7 | "skipLibCheck": true, 8 | "moduleResolution": "node", 9 | "importHelpers": true, 10 | "removeComments": true, 11 | "sourceMap": true, 12 | "declaration": true, 13 | "declarationMap": true, 14 | "target": "es2018", 15 | "module": "es2015", 16 | "esModuleInterop": true, 17 | "experimentalDecorators": true, 18 | "outDir": "./dist", 19 | "lib": ["es2015", "esnext.asynciterable", "dom"], 20 | "jsx": "react" 21 | }, 22 | "include": ["src/**/*.ts"], 23 | "exclude": [ 24 | "src/**/__tests__/**/*" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/promiseForObject.ts: -------------------------------------------------------------------------------- 1 | import type { ObjMap } from "./ObjMap"; 2 | 3 | /** 4 | * This function transforms a JS object `ObjMap>` into 5 | * a `Promise>` 6 | * 7 | * This is akin to bluebird's `Promise.props`, but implemented only using 8 | * `Promise.all` so it will work with any implementation of ES6 promises. 9 | */ 10 | export function promiseForObject( 11 | object: ObjMap>, 12 | ): Promise> { 13 | return Promise.all(Object.values(object)).then((resolvedValues) => { 14 | const resolvedObject = Object.create(null); 15 | for (const [i, key] of Object.keys(object).entries()) { 16 | resolvedObject[key] = resolvedValues[i]; 17 | } 18 | return resolvedObject; 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /patches/@graphql-tools+schema+8.3.1.patch: -------------------------------------------------------------------------------- 1 | diff --git a/node_modules/@graphql-tools/schema/types.d.ts b/node_modules/@graphql-tools/schema/types.d.ts 2 | index ec40a77..7065f69 100644 3 | --- a/node_modules/@graphql-tools/schema/types.d.ts 4 | +++ b/node_modules/@graphql-tools/schema/types.d.ts 5 | @@ -1,5 +1,4 @@ 6 | -import { TypeSource, IResolvers, IResolverValidationOptions, GraphQLParseOptions, PruneSchemaOptions } from '@graphql-tools/utils'; 7 | -import { SchemaExtensions } from '@graphql-tools/merge'; 8 | +import { TypeSource, IResolvers, IResolverValidationOptions, GraphQLParseOptions, PruneSchemaOptions, SchemaExtensions } from '@graphql-tools/utils'; 9 | import { BuildSchemaOptions } from 'graphql'; 10 | /** 11 | * Configuration object for creating an executable schema 12 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/__tests__/utils/simple-ts-loader.ts: -------------------------------------------------------------------------------- 1 | import type { LoaderDefinitionFunction } from "webpack"; 2 | import * as ts from "typescript"; 3 | 4 | const simpleTSLoader: LoaderDefinitionFunction = function ( 5 | source, 6 | _sourceMap, 7 | _additionalData, 8 | ) { 9 | const callback = this.async(); 10 | 11 | const { outputText, sourceMapText } = ts.transpileModule(source, { 12 | compilerOptions: { 13 | module: ts.ModuleKind.ES2015, 14 | target: ts.ScriptTarget.ES2015, 15 | sourceMap: true, 16 | inlineSources: true, 17 | inlineSourceMap: false, 18 | }, 19 | fileName: "fixture.ts", 20 | }); 21 | 22 | callback(null, outputText, sourceMapText); 23 | }; 24 | 25 | export default simpleTSLoader; 26 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/src/data/typeDefs.ts: -------------------------------------------------------------------------------- 1 | const typeDefs = ` 2 | directive @cache( 3 | history: Int 4 | ) on QUERY | MUTATION | SUBSCRIPTION 5 | 6 | type Message { 7 | id: ID! 8 | text: String! 9 | } 10 | 11 | type Chat { 12 | messages: [Message]! 13 | } 14 | 15 | type UserPreference { 16 | id: ID! 17 | theme: String 18 | language: String 19 | notifications: Boolean 20 | privacy: String 21 | } 22 | 23 | type Query { 24 | message(id: ID!): Message! 25 | chat: Chat! 26 | userPreference: UserPreference! 27 | } 28 | 29 | type Mutation { 30 | addMessage(text: String!): Message! 31 | removeMessage(id: ID!): Boolean! 32 | updateMessage(id: ID!, text: String!): Message! 33 | shuffleMessages: Boolean! 34 | } 35 | `; 36 | 37 | export default typeDefs; 38 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/addInlineSourceMap.ts: -------------------------------------------------------------------------------- 1 | const COMMENT = 2 | "//# sourceMappingURL=data:application/json;charset=utf-8;base64,"; 3 | 4 | export function addInlineSourceMap(source: string, sourceMap: string) { 5 | return `${source}\n${COMMENT}${Buffer.from(sourceMap).toString("base64")}\n`; 6 | } 7 | 8 | export function extractInlineSourceMap( 9 | source: string, 10 | ): [code: string, map: string | undefined] { 11 | const [sourceWithoutSourceMap, encodedSourceMap] = source.split(COMMENT); 12 | if (encodedSourceMap && sourceWithoutSourceMap) { 13 | return [ 14 | sourceWithoutSourceMap, 15 | Buffer.from(encodedSourceMap, "base64").toString("utf8"), 16 | ]; 17 | } else { 18 | return [sourceWithoutSourceMap, undefined]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/checkFetcher.ts: -------------------------------------------------------------------------------- 1 | import { InvariantError } from '../../utilities/globals'; 2 | 3 | export const checkFetcher = (fetcher: WindowOrWorkerGlobalScope['fetch'] | undefined) => { 4 | if (!fetcher && typeof fetch === 'undefined') { 5 | throw new InvariantError(` 6 | "fetch" has not been found globally and no fetcher has been \ 7 | configured. To fix this, install a fetch package (like \ 8 | https://www.npmjs.com/package/cross-fetch), instantiate the \ 9 | fetcher, and pass it into your HttpLink constructor. For example: 10 | 11 | import fetch from 'cross-fetch'; 12 | import { ApolloClient, HttpLink } from '@apollo/client'; 13 | const client = new ApolloClient({ 14 | link: new HttpLink({ uri: '/graphql', fetch }) 15 | }); 16 | `); 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/testing/core/wrap.ts: -------------------------------------------------------------------------------- 1 | // I'm not sure why mocha doesn't provide something like this, you can't 2 | // always use promises 3 | export default ( 4 | reject: (reason: any) => any, 5 | cb: (...args: TArgs) => TResult, 6 | ) => (...args: TArgs) => { 7 | try { 8 | return cb(...args); 9 | } catch (e) { 10 | reject(e); 11 | } 12 | }; 13 | 14 | export function withError(func: Function, regex: RegExp) { 15 | let message: string = null as never; 16 | const oldError = console.error; 17 | 18 | console.error = (m: string) => (message = m); 19 | 20 | try { 21 | const result = func(); 22 | expect(message).toMatch(regex); 23 | return result; 24 | } finally { 25 | console.error = oldError; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator-disabled/query-with-match-fields.graphql: -------------------------------------------------------------------------------- 1 | query Test @raw_response_type { 2 | node(id: "1") { 3 | ...NameRendererFragment 4 | } 5 | } 6 | 7 | fragment NameRendererFragment on User { 8 | id 9 | nameRenderer @match { 10 | ...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") 11 | ...MarkdownUserNameRenderer_name 12 | @module(name: "MarkdownUserNameRenderer.react") 13 | } 14 | } 15 | 16 | fragment PlainUserNameRenderer_name on PlainUserNameRenderer { 17 | plaintext 18 | data { 19 | text 20 | } 21 | } 22 | 23 | fragment MarkdownUserNameRenderer_name on MarkdownUserNameRenderer { 24 | markdown 25 | data { 26 | markup 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "monorepo-scripts", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "private": true, 7 | "bin": { 8 | "monorepo-scripts": "bin/monorepo-scripts.js" 9 | }, 10 | "devDependencies": { 11 | "@typescript-eslint/eslint-plugin": "^5.59.8", 12 | "@typescript-eslint/parser": "^5.59.8", 13 | "esbuild": "^0.17.12", 14 | "eslint": "^8.41.0", 15 | "eslint-config-prettier": "^8.3.0", 16 | "eslint-plugin-check-file": "^2.3.0", 17 | "eslint-plugin-jest": "^27.2.1", 18 | "eslint-plugin-prettier": "^4.0.0", 19 | "fast-glob": "^3.2.5", 20 | "jest": "^29.3.1", 21 | "just-scripts": "^1.5.3", 22 | "ts-jest": "^29.2.0", 23 | "ts-node": "^9.1.1", 24 | "typescript": "^5.5.3" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/relay-client-id-field.graphql: -------------------------------------------------------------------------------- 1 | query RelayClientIDFieldQuery($id: ID!) { 2 | __id # ok on query type 3 | me { 4 | __id # ok on object type with 'id' 5 | __typename 6 | id 7 | } 8 | node(id: $id) { 9 | __id # ok on interface type 10 | __typename 11 | id 12 | ... on Comment { 13 | commentBody(supported: ["PlainCommentBody"]) { 14 | __id # ok on union type 15 | __typename 16 | ... on PlainCommentBody { 17 | __id # ok on object type w/o 'id' 18 | text { 19 | __id # ok on object type w/o 'id' 20 | __typename 21 | text 22 | } 23 | } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/components/search/search.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { searchStyles } from "./search.styles"; 3 | import { Search20Regular } from "@fluentui/react-icons"; 4 | 5 | interface SearchProps { 6 | onSearchChange: (e: React.SyntheticEvent) => void; 7 | } 8 | 9 | export const Search = React.memo(({ onSearchChange }: SearchProps) => { 10 | const classes = searchStyles(); 11 | 12 | return ( 13 |
14 | 15 | onSearchChange(e)} 21 | /> 22 |
23 | ); 24 | }); 25 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/src/__generated__/TodoListFooter_todosFragment.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type TodoListFooter_todosFragment = { 7 | readonly uncompletedCount: number; 8 | readonly " $fragmentType": "TodoListFooter_todosFragment"; 9 | }; 10 | export type TodoListFooter_todosFragment$data = TodoListFooter_todosFragment; 11 | export type TodoListFooter_todosFragment$key = { 12 | readonly " $data"?: TodoListFooter_todosFragment$data | undefined; 13 | readonly " $fragmentSpreads": FragmentRefs<"TodoListFooter_todosFragment">; 14 | }; 15 | 16 | 17 | import { documents } from "./TodoListFooter_todosWatchNodeQuery.graphql"; 18 | export default documents; -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/schema/asyncSplit.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink, Observable } from "@apollo/client"; 2 | 3 | export function asyncSplit( 4 | test: () => Promise | boolean, 5 | left: () => Promise, 6 | right: () => Promise 7 | ): ApolloLink { 8 | let link: ApolloLink; 9 | return new ApolloLink((operation, forward) => { 10 | if (link) { 11 | return link.request(operation, forward); 12 | } else { 13 | return new Observable((observer) => { 14 | (async () => { 15 | if (await test()) { 16 | link = await left(); 17 | } else { 18 | link = await right(); 19 | } 20 | link.request(operation, forward)?.subscribe(observer); 21 | })(); 22 | }); 23 | } 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /patches/relay-compiler+12.0.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/node_modules/relay-compiler/lib/core/Schema.js b/node_modules/relay-compiler/lib/core/Schema.js 2 | index 3aa2c30..315444a 100644 3 | --- a/node_modules/relay-compiler/lib/core/Schema.js 4 | +++ b/node_modules/relay-compiler/lib/core/Schema.js 5 | @@ -1708,6 +1708,8 @@ var TypeMap = /*#__PURE__*/function () { 6 | _this9._parseInterfaceTypeExtension(definition); 7 | } else if (definition.kind === 'ObjectTypeExtension') { 8 | _this9._parseObjectTypeExtension(definition); 9 | + } else if (definition.kind === 'UnionTypeDefinition') { 10 | + _this9._parseUnionNode(definition, true); 11 | } else if (definition.kind === 'DirectiveDefinition') { 12 | _this9._parseDirective(definition, true 13 | /* client directive */ 14 | -------------------------------------------------------------------------------- /packages/embedded-document-artefact-loader/src/source-map-utils.ts: -------------------------------------------------------------------------------- 1 | import { 2 | SourceMapConsumer, 3 | SourceMapGenerator, 4 | RawSourceMap, 5 | } from "source-map-js"; 6 | 7 | function toRawSourceMap(sourceMap: string | RawSourceMap): RawSourceMap { 8 | return typeof sourceMap === "string" ? JSON.parse(sourceMap) : sourceMap; 9 | } 10 | 11 | export function applySourceMap( 12 | sourcePath: string, 13 | previousSourceMap: string | RawSourceMap, 14 | nextSourceMap: string | RawSourceMap, 15 | ): SourceMapGenerator { 16 | const prev = new SourceMapConsumer(toRawSourceMap(previousSourceMap)); 17 | const next = new SourceMapConsumer(toRawSourceMap(nextSourceMap)); 18 | const pipeline = SourceMapGenerator.fromSourceMap(next); 19 | pipeline.applySourceMap(prev, sourcePath); 20 | return pipeline; 21 | } 22 | -------------------------------------------------------------------------------- /packages/supermassive/src/benchmarks/swapi-schema/index.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLSchema, parse } from "graphql"; 2 | import { join } from "path"; 3 | import { readFileSync } from "fs"; 4 | import resolvers from "./resolvers"; 5 | import { makeExecutableSchema } from "./makeExecutableSchema"; 6 | import { Resolvers } from "../../types"; 7 | 8 | export const typeDefs = parse( 9 | readFileSync(join(__dirname, "./schema.graphql"), { 10 | encoding: "utf-8", 11 | }), 12 | ); 13 | 14 | const schema = makeExecutableSchema({ 15 | typeDefs, 16 | resolvers: resolvers as Resolvers, 17 | }); 18 | 19 | export default schema; 20 | 21 | export const makeSchema: () => GraphQLSchema = () => 22 | makeExecutableSchema({ 23 | typeDefs, 24 | resolvers: resolvers as Resolvers, 25 | }); 26 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/telemetry/updateStats/logUpdateStats.ts: -------------------------------------------------------------------------------- 1 | import type { CacheEnv, WriteResult, ModifyResult } from "../../cache/types"; 2 | import { isWrite } from "../../cache/write"; 3 | 4 | export function logUpdateStats( 5 | env: CacheEnv, 6 | log: (WriteResult | ModifyResult)[], 7 | watchers: Set, 8 | ) { 9 | if (!env.logUpdateStats) { 10 | return; 11 | } 12 | 13 | log.forEach((entry) => { 14 | if (!isWrite(entry) || !entry.updateStats?.length) { 15 | return; 16 | } 17 | env.notify?.({ 18 | kind: "UPDATE_STATS", 19 | causedBy: entry.incoming.operation.debugName, 20 | watchersCount: watchers.size, 21 | updateStats: entry.updateStats as NonNullable< 22 | (typeof entry.updateStats)[number] 23 | >[], 24 | }); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/src/__generated__/Todo_todoFragment.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type Todo_todoFragment = { 7 | readonly id: string; 8 | readonly description: string; 9 | readonly isCompleted: boolean; 10 | readonly someOtherField?: string | undefined; 11 | readonly " $fragmentType": "Todo_todoFragment"; 12 | }; 13 | export type Todo_todoFragment$data = Todo_todoFragment; 14 | export type Todo_todoFragment$key = { 15 | readonly " $data"?: Todo_todoFragment$data | undefined; 16 | readonly " $fragmentSpreads": FragmentRefs<"Todo_todoFragment">; 17 | }; 18 | 19 | 20 | import { documents } from "./TodoRefetchQuery.graphql"; 21 | export default documents; -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/__generated__/compiledHooks_ChildFragment.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type compiledHooks_ChildFragment = { 7 | readonly petName: string; 8 | readonly " $fragmentType": "compiledHooks_ChildFragment"; 9 | }; 10 | export type compiledHooks_ChildFragment$data = compiledHooks_ChildFragment; 11 | export type compiledHooks_ChildFragment$key = { 12 | readonly " $data"?: compiledHooks_ChildFragment$data | undefined; 13 | readonly " $fragmentSpreads": FragmentRefs<"compiledHooks_ChildFragment">; 14 | }; 15 | 16 | 17 | import { documents } from "./compiledHooks_ChildWatchNodeQuery.graphql"; 18 | export default documents; -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/common/mergeOptions.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | QueryOptions, 3 | WatchQueryOptions, 4 | MutationOptions, 5 | } from "../../core"; 6 | 7 | import { compact } from "./compact"; 8 | 9 | type OptionsUnion = 10 | | WatchQueryOptions 11 | | QueryOptions 12 | | MutationOptions; 13 | 14 | export function mergeOptions< 15 | TOptions extends OptionsUnion 16 | >( 17 | defaults: TOptions | Partial | undefined, 18 | options: TOptions | Partial, 19 | ): TOptions { 20 | return compact(defaults, options, options.variables && { 21 | variables: { 22 | ...(defaults && defaults.variables), 23 | ...options.variables, 24 | }, 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /examples/apollo-devtools-playground/src/components/chat/chat-renderer.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands, tokens } from "@fluentui/react-components"; 2 | 3 | export const useChatRendererStyles = makeStyles({ 4 | title: { 5 | ...shorthands.padding("15px"), 6 | }, 7 | inputContainer: { 8 | display: "flex", 9 | ...shorthands.padding("15px"), 10 | }, 11 | input: { 12 | display: "inline-block", 13 | boxSizing: "border-box", 14 | width: "300px", 15 | height: "32px", 16 | marginRight: "20px", 17 | ...shorthands.padding(0, 0, 0, "5px"), 18 | ...shorthands.border("1px", "solid", tokens.colorNeutralBackground2Pressed), 19 | ...shorthands.borderRadius("6px"), 20 | outlineStyle: "none", 21 | "&:focus": { 22 | ...shorthands.borderColor("#97CBFF"), 23 | }, 24 | }, 25 | }); 26 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/createOperation.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLRequest, Operation } from '../core'; 2 | 3 | export function createOperation( 4 | starting: any, 5 | operation: GraphQLRequest, 6 | ): Operation { 7 | let context = { ...starting }; 8 | const setContext = (next: any) => { 9 | if (typeof next === 'function') { 10 | context = { ...context, ...next(context) }; 11 | } else { 12 | context = { ...context, ...next }; 13 | } 14 | }; 15 | const getContext = () => ({ ...context }); 16 | 17 | Object.defineProperty(operation, 'setContext', { 18 | enumerable: false, 19 | value: setContext, 20 | }); 21 | 22 | Object.defineProperty(operation, 'getContext', { 23 | enumerable: false, 24 | value: getContext, 25 | }); 26 | 27 | return operation as Operation; 28 | } 29 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/convertFetchPolicy.ts: -------------------------------------------------------------------------------- 1 | import type { WatchQueryFetchPolicy as ApolloWatchQueryFetchPolicy } from "@apollo/client"; 2 | import type { FetchPolicy } from "./types"; 3 | 4 | /** 5 | * This is for internal use only. 6 | */ 7 | type PrivateFetchPolicy = FetchPolicy | "no-cache"; 8 | 9 | const FETCH_POLICY_MAPPING: Record< 10 | PrivateFetchPolicy, 11 | ApolloWatchQueryFetchPolicy 12 | > = { 13 | "store-or-network": "cache-first", 14 | "store-and-network": "cache-and-network", 15 | "network-only": "network-only", 16 | "store-only": "cache-only", 17 | "no-cache": "no-cache", 18 | }; 19 | 20 | export function convertFetchPolicy( 21 | fetchPolicy: PrivateFetchPolicy | undefined, 22 | ): ApolloWatchQueryFetchPolicy | undefined { 23 | return fetchPolicy && FETCH_POLICY_MAPPING[fetchPolicy]; 24 | } 25 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-tracker/Mutations/mutations.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands } from "@fluentui/react-components"; 2 | 3 | export const mutationsStyles = makeStyles({ 4 | root: { 5 | flexShrink: 1, 6 | flexGrow: 1, 7 | flexBasic: 0, 8 | height: "calc(100% - 15px)", 9 | ...shorthands.padding("10px"), 10 | }, 11 | innerContainer: { 12 | display: "grid", 13 | gridTemplateColumns: "175px auto", 14 | height: "100%", 15 | backgroundColor: "#fff", 16 | ...shorthands.borderRadius("6px"), 17 | }, 18 | innerContainerFull: { 19 | gridTemplateColumns: "0 auto", 20 | }, 21 | viewerContainer: { 22 | ...shorthands.overflow("hidden"), 23 | ...shorthands.borderLeft("1px", "solid", "#E1DFDD"), 24 | }, 25 | error: { 26 | color: "red", 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /patches/relay-test-utils-internal+12.0.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/node_modules/relay-test-utils-internal/lib/testschema.graphql b/node_modules/relay-test-utils-internal/lib/testschema.graphql 2 | index 2b6036e..4536218 100644 3 | --- a/node_modules/relay-test-utils-internal/lib/testschema.graphql 4 | +++ b/node_modules/relay-test-utils-internal/lib/testschema.graphql 5 | @@ -496,7 +496,7 @@ interface FeedUnit { 6 | 7 | type FriendsConnection { 8 | count: Int 9 | - edges: [FriendsEdge] 10 | + edges: [FriendsEdge]! 11 | pageInfo: PageInfo 12 | } 13 | 14 | @@ -1024,6 +1024,7 @@ type User implements Named & Node & Actor & HasJsField & Entity & AllConcreteTyp 15 | last: Int 16 | orderby: String 17 | ): CommentsConnection 18 | + count: Int! 19 | doesViewerLike: Boolean 20 | emailAddresses: [String] 21 | environment: Environment 22 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/src/config.ts: -------------------------------------------------------------------------------- 1 | import type { CacheConfiguration } from "./types"; 2 | 3 | export const CONFIG = { 4 | cacheConfigurations: [ 5 | { 6 | name: "Default", 7 | description: "Default ForestRun configuration", 8 | options: {}, 9 | }, 10 | ] as const satisfies CacheConfiguration[], 11 | watcherCounts: [0, 50], 12 | sampling: { 13 | minSamples: 200, 14 | minExecutionTime: 200, //ms 15 | warmupSamples: 25, 16 | batchSize: 50, 17 | }, 18 | reliability: { 19 | epochs: 6, 20 | stabilityThreshold: 0.05, 21 | }, 22 | } as const; 23 | 24 | export const CACHE_FACTORIES = [ 25 | { 26 | name: "baseline", 27 | importPath: "../../forest-runs/baseline", 28 | }, 29 | { 30 | name: "current", 31 | importPath: "../../forest-runs/current", 32 | }, 33 | ] as const; 34 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/transformOperation.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLRequest, Operation } from '../core'; 2 | import { getOperationName } from '../../utilities'; 3 | 4 | export function transformOperation(operation: GraphQLRequest): GraphQLRequest { 5 | const transformedOperation: GraphQLRequest = { 6 | variables: operation.variables || {}, 7 | extensions: operation.extensions || {}, 8 | operationName: operation.operationName, 9 | query: operation.query, 10 | }; 11 | 12 | // Best guess at an operation name 13 | if (!transformedOperation.operationName) { 14 | transformedOperation.operationName = 15 | typeof transformedOperation.query !== 'string' 16 | ? getOperationName(transformedOperation.query) || undefined 17 | : ''; 18 | } 19 | 20 | return transformedOperation as Operation; 21 | } 22 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/components/search/search.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands } from "@fluentui/react-components"; 2 | 3 | export const searchStyles = makeStyles({ 4 | root: { 5 | position: "relative", 6 | width: "90%", 7 | maxWidth: "300px", 8 | color: "#646464", 9 | }, 10 | input: { 11 | display: "inline-block", 12 | boxSizing: "border-box", 13 | width: "100%", 14 | height: "32px", 15 | ...shorthands.padding(0, 0, 0, "30px"), 16 | backgroundColor: "#F5F5F6", 17 | ...shorthands.border("2px", "solid", "transparent"), 18 | ...shorthands.borderRadius("6px"), 19 | outlineStyle: "none", 20 | "&:focus": { 21 | ...shorthands.borderColor("#97CBFF"), 22 | }, 23 | }, 24 | icon: { 25 | position: "absolute", 26 | top: "5px", 27 | left: "5px", 28 | }, 29 | }); 30 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-tracker/Queries/watched-queries.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands } from "@fluentui/react-components"; 2 | 3 | export const watchedQueriesStyles = makeStyles({ 4 | root: { 5 | flexShrink: 1, 6 | flexGrow: 1, 7 | flexBasic: 0, 8 | height: "calc(100% - 15px)", 9 | ...shorthands.padding("10px"), 10 | }, 11 | innerContainer: { 12 | display: "grid", 13 | gridTemplateColumns: "175px auto", 14 | height: "100%", 15 | backgroundColor: "#fff", 16 | ...shorthands.borderRadius("6px"), 17 | }, 18 | innerContainerFull: { 19 | gridTemplateColumns: "0 auto", 20 | }, 21 | viewerContainer: { 22 | ...shorthands.overflow("hidden"), 23 | ...shorthands.borderLeft("1px", "solid", "#E1DFDD"), 24 | }, 25 | error: { 26 | color: "red", 27 | }, 28 | }); 29 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-cache/history/VirtualizedJsonViewer.styles.ts: -------------------------------------------------------------------------------- 1 | import { makeStyles, shorthands, tokens } from "@fluentui/react-components"; 2 | 3 | export const useVirtualizedJsonViewerStyles = makeStyles({ 4 | container: { 5 | fontFamily: tokens.fontFamilyMonospace, 6 | fontSize: tokens.fontSizeBase200, 7 | ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS), 8 | backgroundColor: tokens.colorNeutralBackground3, 9 | ...shorthands.borderRadius(tokens.borderRadiusMedium), 10 | ...shorthands.border( 11 | tokens.strokeWidthThin, 12 | "solid", 13 | tokens.colorNeutralStroke2, 14 | ), 15 | overflowX: "hidden", 16 | whiteSpace: "pre-wrap", 17 | overflowWrap: "break-word", 18 | wordBreak: "break-all", 19 | ...shorthands.margin(0), 20 | }, 21 | }); 22 | -------------------------------------------------------------------------------- /packages/graphql-codegen-near-operation-file-preset-with-resolver-metadata/CHANGELOG.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@graphitation/graphql-codegen-near-operation-file-preset-with-resolver-metadata", 3 | "entries": [ 4 | { 5 | "date": "Wed, 30 Jul 2025 14:39:20 GMT", 6 | "version": "1.1.0", 7 | "tag": "@graphitation/graphql-codegen-near-operation-file-preset-with-resolver-metadata_v1.1.0", 8 | "comments": { 9 | "minor": [ 10 | { 11 | "author": "77059398+vejrj@users.noreply.github.com", 12 | "package": "@graphitation/graphql-codegen-near-operation-file-preset-with-resolver-metadata", 13 | "commit": "561d8e4ca9100fb1e5355671e44fa19d7f48c32d", 14 | "comment": "Wrapping near-operation-file preset and adding resolvers metadata" 15 | } 16 | ] 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /website/sidebars.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Creating a sidebar enables you to: 3 | - create an ordered group of docs 4 | - render a sidebar for each doc of that group 5 | - provide next/previous navigation 6 | 7 | The sidebars can be generated from the filesystem, or explicitly defined here. 8 | 9 | Create as many sidebars as you want. 10 | */ 11 | 12 | // @ts-check 13 | 14 | /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ 15 | const sidebars = { 16 | // By default, Docusaurus generates a sidebar from the docs folder structure 17 | tutorialSidebar: [{ type: "autogenerated", dirName: "." }], 18 | 19 | // But you can create a sidebar manually 20 | /* 21 | tutorialSidebar: [ 22 | { 23 | type: 'category', 24 | label: 'Tutorial', 25 | items: ['hello'], 26 | }, 27 | ], 28 | */ 29 | }; 30 | 31 | module.exports = sidebars; 32 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/__tests__/__snapshots__/mutationResults.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`mutation results should write results to cache according to errorPolicy 1`] = `Object {}`; 4 | 5 | exports[`mutation results should write results to cache according to errorPolicy 2`] = ` 6 | Object { 7 | "Person:{\\"name\\":\\"Jenn Creighton\\"}": Object { 8 | "__typename": "Person", 9 | "name": "Jenn Creighton", 10 | }, 11 | } 12 | `; 13 | 14 | exports[`mutation results should write results to cache according to errorPolicy 3`] = ` 15 | Object { 16 | "Person:{\\"name\\":\\"Ellen Shapiro\\"}": Object { 17 | "__typename": "Person", 18 | "name": "Ellen Shapiro", 19 | }, 20 | "Person:{\\"name\\":\\"Jenn Creighton\\"}": Object { 21 | "__typename": "Person", 22 | "name": "Jenn Creighton", 23 | }, 24 | } 25 | `; 26 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/utils/__tests__/fromPromise.ts: -------------------------------------------------------------------------------- 1 | import { fromPromise } from '../fromPromise'; 2 | import { toPromise, } from '../toPromise'; 3 | 4 | describe('fromPromise', () => { 5 | const data = { 6 | data: { 7 | hello: 'world', 8 | }, 9 | }; 10 | const error = new Error('I always error'); 11 | 12 | it('return next call as Promise resolution', () => { 13 | const observable = fromPromise(Promise.resolve(data)); 14 | return toPromise(observable).then(result => 15 | expect(data).toEqual(result), 16 | ); 17 | }); 18 | 19 | it('return Promise rejection as error call', () => { 20 | const observable = fromPromise(Promise.reject(error)); 21 | return toPromise(observable) 22 | .then(() => { throw "should not have thrown" }) 23 | .catch(actualError => expect(error).toEqual(actualError)); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/globals/fix-graphql.ts: -------------------------------------------------------------------------------- 1 | // The ordering of these imports is important, because it ensures the temporary 2 | // process.env.NODE_ENV polyfill is defined globally (if necessary) before we 3 | // import { Source } from 'graphql'. The instanceOf function that we really care 4 | // about (the one that uses process.env.NODE_ENV) is not exported from the 5 | // top-level graphql package, but graphql/language/source uses instanceOf, and 6 | // has relatively few dependencies, so importing it here should not increase 7 | // bundle sizes as much as other options. 8 | import { remove } from 'ts-invariant/process'; 9 | import { Source } from 'graphql'; 10 | 11 | export function removeTemporaryGlobals() { 12 | // Using Source here here just to make sure it won't be tree-shaken away. 13 | return typeof Source === "function" ? remove() : remove(); 14 | } 15 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/graphql/__tests__/storeUtils.ts: -------------------------------------------------------------------------------- 1 | import { getStoreKeyName } from '../storeUtils'; 2 | 3 | describe('getStoreKeyName', () => { 4 | it( 5 | 'should return a deterministic version of the store key name no matter ' + 6 | 'which order the args object properties are in', 7 | () => { 8 | const validStoreKeyName = 9 | 'someField({"prop1":"value1","prop2":"value2"})'; 10 | let generatedStoreKeyName = getStoreKeyName('someField', { 11 | prop1: 'value1', 12 | prop2: 'value2', 13 | }); 14 | expect(generatedStoreKeyName).toEqual(validStoreKeyName); 15 | 16 | generatedStoreKeyName = getStoreKeyName('someField', { 17 | prop2: 'value2', 18 | prop1: 'value1', 19 | }); 20 | expect(generatedStoreKeyName).toEqual(validStoreKeyName); 21 | }, 22 | ); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/Path.ts: -------------------------------------------------------------------------------- 1 | import type { Maybe } from "./Maybe"; 2 | 3 | export interface Path { 4 | readonly prev: Path | undefined; 5 | readonly key: string | number; 6 | readonly typename: string | undefined; 7 | } 8 | 9 | /** 10 | * Given a Path and a key, return a new Path containing the new key. 11 | */ 12 | export function addPath( 13 | prev: Readonly | undefined, 14 | key: string | number, 15 | typename: string | undefined, 16 | ): Path { 17 | return { prev, key, typename }; 18 | } 19 | 20 | /** 21 | * Given a Path, return an Array of the path keys. 22 | */ 23 | export function pathToArray( 24 | path: Maybe>, 25 | ): Array { 26 | const flattened = []; 27 | let curr = path; 28 | while (curr) { 29 | flattened.push(curr.key); 30 | curr = curr.prev; 31 | } 32 | return flattened.reverse(); 33 | } 34 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/index.ts: -------------------------------------------------------------------------------- 1 | import '../../utilities/globals'; 2 | 3 | export { 4 | parseAndCheckHttpResponse, 5 | ServerParseError 6 | } from './parseAndCheckHttpResponse'; 7 | export { 8 | serializeFetchParameter, 9 | ClientParseError 10 | } from './serializeFetchParameter'; 11 | export { 12 | HttpOptions, 13 | fallbackHttpConfig, 14 | defaultPrinter, 15 | selectHttpOptionsAndBody, 16 | selectHttpOptionsAndBodyInternal, // needed by ../batch-http but not public 17 | UriFunction 18 | } from './selectHttpOptionsAndBody'; 19 | export { checkFetcher } from './checkFetcher'; 20 | export { createSignalIfSupported } from './createSignalIfSupported'; 21 | export { selectURI } from './selectURI'; 22 | export { createHttpLink } from './createHttpLink'; 23 | export { HttpLink } from './HttpLink'; 24 | export { rewriteURIForGET } from './rewriteURIForGET'; 25 | -------------------------------------------------------------------------------- /packages/graphql-eslint-rules/src/__tests__/__snapshots__/non-nullable-fields.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Invalid #1 1`] = ` 4 | "#### ⌨️ Code 5 | 6 | 1 | type ChatMessage { 7 | 2 | id: String 8 | 3 | content: String 9 | 4 | someOtherImportantField: String 10 | 5 | } 11 | 12 | #### ⚙️ Options 13 | 14 | { 15 | "fields": [ 16 | "id", 17 | "someOtherImportantField" 18 | ] 19 | } 20 | 21 | #### ❌ Error 1/2 22 | 23 | 1 | type ChatMessage { 24 | > 2 | id: String 25 | | ^^^^ Field "id" cannot be nullable. 26 | 3 | content: String 27 | 28 | #### ❌ Error 2/2 29 | 30 | 3 | content: String 31 | > 4 | someOtherImportantField: String 32 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ Field "someOtherImportantField" cannot be nullable. 33 | 5 | }" 34 | `; 35 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/__generated__/compiledHooks_QueryTypeFragment.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type compiledHooks_QueryTypeFragment = { 7 | readonly nonNode: { 8 | readonly id: string | null; 9 | }; 10 | readonly " $fragmentType": "compiledHooks_QueryTypeFragment"; 11 | }; 12 | export type compiledHooks_QueryTypeFragment$data = compiledHooks_QueryTypeFragment; 13 | export type compiledHooks_QueryTypeFragment$key = { 14 | readonly " $data"?: compiledHooks_QueryTypeFragment$data | undefined; 15 | readonly " $fragmentSpreads": FragmentRefs<"compiledHooks_QueryTypeFragment">; 16 | }; 17 | 18 | 19 | import { documents } from "./compiledHooks_QueryTypeWatchNodeQuery.graphql"; 20 | export default documents; -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-tracker/Mutations/mutations-container.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect, memo } from "react"; 2 | import { Mutation } from "../../../types"; 3 | import { remplSubscriber } from "../../rempl"; 4 | import { Mutations } from "./mutations"; 5 | 6 | const MutationsContainer = memo(() => { 7 | const [apolloTrackerMutations, setApolloTrackerMutations] = useState< 8 | Mutation[] 9 | >([]); 10 | useEffect(() => { 11 | const unsubscribe = remplSubscriber 12 | .ns("apollo-tracker-mutations") 13 | .subscribe((data: Mutation[]) => { 14 | if (data) { 15 | setApolloTrackerMutations(data); 16 | } 17 | }); 18 | 19 | return () => { 20 | unsubscribe(); 21 | }; 22 | }, []); 23 | 24 | return ; 25 | }); 26 | 27 | export default MutationsContainer; 28 | -------------------------------------------------------------------------------- /packages/apollo-forest-run-benchmark/src/summary/analyze-results.ts: -------------------------------------------------------------------------------- 1 | import type { SummaryReport } from "../types"; 2 | 3 | import { analyzeSignificantChanges } from "./summary"; 4 | import { 5 | generateMarkdownReport, 6 | printSignificantChanges, 7 | } from "../utils/logger"; 8 | import { saveResultFile } from "../utils/file"; 9 | 10 | export const analyzeResults = (summary: SummaryReport) => { 11 | const changeReport = analyzeSignificantChanges(summary); 12 | const markdownReport = generateMarkdownReport(changeReport); 13 | 14 | printSignificantChanges(changeReport); 15 | 16 | saveResultFile("benchmark.md", markdownReport); 17 | saveResultFile("benchmark.json", JSON.stringify(summary, null, 2)); 18 | 19 | if (process.env.CI === "true") { 20 | console.log("::BEGIN_BENCHMARK_REPORT::"); 21 | console.log(markdownReport); 22 | console.log("::END_BENCHMARK_REPORT::"); 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /examples/supermassive-todomvc/src/components/TodoUpdates.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { useSubscription } from "@graphitation/apollo-react-relay-duct-tape"; 4 | import { graphql } from "@graphitation/graphql-js-tag"; 5 | 6 | const subscription = graphql` 7 | subscription TodoUpdatesSubscription($limit: Int!) { 8 | emitTodos(limit: $limit) { 9 | id 10 | ...TodoFragment 11 | } 12 | } 13 | `; 14 | 15 | interface TodoSubscriptionProps { 16 | onNext?: (response: any) => void; 17 | onError?: () => void | null; 18 | } 19 | 20 | const TodoUpdates: React.FC = ({ 21 | onNext, 22 | onError, 23 | children, 24 | }) => { 25 | useSubscription({ 26 | subscription, 27 | variables: { limit: 5 }, 28 | onNext, 29 | onError: onError || undefined, 30 | }); 31 | 32 | return <>{children}; 33 | }; 34 | 35 | export default TodoUpdates; 36 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/link/http/__tests__/helpers.ts: -------------------------------------------------------------------------------- 1 | export function voidFetchDuringEachTest() { 2 | let fetchDesc = Object.getOwnPropertyDescriptor(window, "fetch"); 3 | 4 | beforeEach(() => { 5 | fetchDesc = fetchDesc || Object.getOwnPropertyDescriptor(window, "fetch"); 6 | if (fetchDesc?.configurable) { 7 | delete (window as any).fetch; 8 | } 9 | }); 10 | 11 | afterEach(() => { 12 | if (fetchDesc?.configurable) { 13 | Object.defineProperty(window, "fetch", fetchDesc); 14 | } 15 | }); 16 | } 17 | 18 | describe("voidFetchDuringEachTest", () => { 19 | voidFetchDuringEachTest(); 20 | 21 | it("hides the global.fetch function", () => { 22 | expect(window.fetch).toBe(void 0); 23 | expect(() => fetch).toThrowError(ReferenceError); 24 | }); 25 | 26 | it("globalThis === window", () => { 27 | expect(globalThis).toBe(window); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/keyValMap.ts: -------------------------------------------------------------------------------- 1 | import type { ObjMap } from "./ObjMap"; 2 | 3 | /** 4 | * Creates a keyed JS object from an array, given a function to produce the keys 5 | * and a function to produce the values from each item in the array. 6 | * 7 | * const phoneBook = [ 8 | * { name: 'Jon', num: '555-1234' }, 9 | * { name: 'Jenny', num: '867-5309' } 10 | * ] 11 | * 12 | * // { Jon: '555-1234', Jenny: '867-5309' } 13 | * const phonesByName = keyValMap( 14 | * phoneBook, 15 | * entry => entry.name, 16 | * entry => entry.num 17 | * ) 18 | * 19 | */ 20 | export function keyValMap( 21 | list: ReadonlyArray, 22 | keyFn: (item: T) => string, 23 | valFn: (item: T) => V, 24 | ): ObjMap { 25 | const result = Object.create(null); 26 | for (const item of list) { 27 | result[keyFn(item)] = valFn(item); 28 | } 29 | return result; 30 | } 31 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/apollo-tracker/Queries/watched-queries-container.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect, memo } from "react"; 2 | import { WatchedQuery } from "../../../types"; 3 | import { remplSubscriber } from "../../rempl"; 4 | import { WatchedQueries } from "./watched-queries"; 5 | 6 | const WatchedQueriesContainer = memo(() => { 7 | const [apolloTrackerQueries, setApolloTrackerQueries] = useState< 8 | WatchedQuery[] 9 | >([]); 10 | useEffect(() => { 11 | const unsubscribe = remplSubscriber 12 | .ns("apollo-tracker-queries") 13 | .subscribe((data: WatchedQuery[]) => { 14 | if (data) { 15 | setApolloTrackerQueries(data); 16 | } 17 | }); 18 | 19 | return () => { 20 | unsubscribe(); 21 | }; 22 | }, []); 23 | 24 | return ; 25 | }); 26 | 27 | export default WatchedQueriesContainer; 28 | -------------------------------------------------------------------------------- /packages/rempl-apollo-devtools/src/subscriber/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | import { RecentActivities, ApolloTrackerMetadata } from "../types"; 5 | 6 | declare let __GRAPHIQL_CSS__: string; 7 | declare let __GLOBAL_CSS__: string; 8 | declare global { 9 | interface Window { 10 | REMPL_GRAPHQL_DEVTOOLS_RECENT_ACTIVITIES?: RecentActivities[]; 11 | REMPL_APOLLO_TRACKER_METADATA?: ApolloTrackerMetadata; 12 | GRAPHIQL_STORAGE: { [key: string]: string | null }; 13 | } 14 | } 15 | 16 | const style = document.createElement("style"); 17 | document.body.appendChild(style); 18 | style.innerText = __GLOBAL_CSS__ + __GRAPHIQL_CSS__; 19 | 20 | const rootEl = document.createElement("div"); 21 | rootEl.style.height = "100%"; 22 | rootEl.style.willChange = "transform"; 23 | 24 | document.body.appendChild(rootEl); 25 | 26 | ReactDOM.render(, rootEl); 27 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/src/jsutils/circularBuffer.ts: -------------------------------------------------------------------------------- 1 | export class CircularBuffer implements Iterable { 2 | public items: TItem[] = []; 3 | private head = 0; 4 | // Total number of entries ever added (including overwritten ones) 5 | public totalEntries = 0; 6 | private maxSize: number; 7 | 8 | constructor(maxSize: number) { 9 | this.maxSize = maxSize; 10 | } 11 | 12 | push(entry: TItem): void { 13 | if (this.maxSize === 0) { 14 | return; 15 | } 16 | 17 | this.totalEntries++; 18 | if (this.items.length < this.maxSize) { 19 | this.items.push(entry); 20 | } else { 21 | this.items[this.head] = entry; 22 | this.head = (this.head + 1) % this.maxSize; 23 | } 24 | } 25 | 26 | *[Symbol.iterator](): Iterator { 27 | for (let i = 0; i < this.items.length; i++) { 28 | yield this.items[(this.head + i) % this.items.length]; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/react/context/ApolloConsumer.tsx: -------------------------------------------------------------------------------- 1 | import { invariant } from '../../utilities/globals'; 2 | 3 | import * as React from 'react'; 4 | 5 | import { ApolloClient } from '../../core'; 6 | import { getApolloContext } from './ApolloContext'; 7 | 8 | export interface ApolloConsumerProps { 9 | children: (client: ApolloClient) => React.ReactChild | null; 10 | } 11 | 12 | export const ApolloConsumer: React.FC = props => { 13 | const ApolloContext = getApolloContext(); 14 | return ( 15 | 16 | {(context: any) => { 17 | invariant( 18 | context && context.client, 19 | 'Could not find "client" in the context of ApolloConsumer. ' + 20 | 'Wrap the root component in an .' 21 | ); 22 | return props.children(context.client); 23 | }} 24 | 25 | ); 26 | }; 27 | -------------------------------------------------------------------------------- /packages/supermassive/src/jsutils/promiseReduce.ts: -------------------------------------------------------------------------------- 1 | import type { PromiseOrValue } from "./PromiseOrValue"; 2 | 3 | import { isPromise } from "./isPromise"; 4 | 5 | /** 6 | * Similar to Array.prototype.reduce(), however the reducing callback may return 7 | * a Promise, in which case reduction will continue after each promise resolves. 8 | * 9 | * If the callback does not return a Promise, then this function will also not 10 | * return a Promise. 11 | */ 12 | export function promiseReduce( 13 | values: Iterable, 14 | callbackFn: (accumulator: U, currentValue: T) => PromiseOrValue, 15 | initialValue: PromiseOrValue, 16 | ): PromiseOrValue { 17 | let accumulator = initialValue; 18 | for (const value of values) { 19 | accumulator = isPromise(accumulator) 20 | ? accumulator.then((resolved) => callbackFn(resolved, value)) 21 | : callbackFn(accumulator, value); 22 | } 23 | return accumulator; 24 | } 25 | -------------------------------------------------------------------------------- /examples/apollo-watch-fragments/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "esModuleInterop": true, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "module": "esnext", 13 | "moduleResolution": "node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "jsx": "react", 17 | "sourceMap": true 18 | }, 19 | "include": ["src"], 20 | "references": [ 21 | { "path": "../../packages/apollo-react-relay-duct-tape" }, 22 | { "path": "../../packages/graphql-js-tag" }, 23 | { "path": "../../packages/graphql-js-operation-payload-generator" } 24 | ], 25 | "ts-node": { 26 | "compilerOptions": { 27 | "module": "commonjs" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape/src/storeObservation/__tests__/__generated__/compiledHooks_RefetchableFragment.graphql.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | // @ts-nocheck 4 | 5 | import { FragmentRefs } from "@graphitation/apollo-react-relay-duct-tape"; 6 | export type compiledHooks_RefetchableFragment = { 7 | readonly petName: string; 8 | readonly avatarUrl: string; 9 | readonly id: string; 10 | readonly " $fragmentType": "compiledHooks_RefetchableFragment"; 11 | }; 12 | export type compiledHooks_RefetchableFragment$data = compiledHooks_RefetchableFragment; 13 | export type compiledHooks_RefetchableFragment$key = { 14 | readonly " $data"?: compiledHooks_RefetchableFragment$data | undefined; 15 | readonly " $fragmentSpreads": FragmentRefs<"compiledHooks_RefetchableFragment">; 16 | }; 17 | 18 | 19 | import { documents } from "./compiledHooks_RefetchableFragment_RefetchQuery.graphql"; 20 | export default documents; -------------------------------------------------------------------------------- /website/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator. 4 | 5 | ### Installation 6 | 7 | ``` 8 | $ yarn 9 | ``` 10 | 11 | ### Local Development 12 | 13 | ``` 14 | $ yarn start 15 | ``` 16 | 17 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. 18 | 19 | ### Build 20 | 21 | ``` 22 | $ yarn build 23 | ``` 24 | 25 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 26 | 27 | ### Deployment 28 | 29 | Using SSH: 30 | 31 | ``` 32 | $ USE_SSH=true yarn deploy 33 | ``` 34 | 35 | Not using SSH: 36 | 37 | ``` 38 | $ GIT_USER= yarn deploy 39 | ``` 40 | 41 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. 42 | -------------------------------------------------------------------------------- /packages/apollo-forest-run/compat/src/utilities/observables/Observable.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Observable, 3 | Observer, 4 | Subscription as ObservableSubscription, 5 | Subscriber, 6 | } from 'zen-observable-ts'; 7 | 8 | // This simplified polyfill attempts to follow the ECMAScript Observable 9 | // proposal (https://github.com/zenparsing/es-observable) 10 | import 'symbol-observable'; 11 | 12 | export type { 13 | Observer, 14 | ObservableSubscription, 15 | Subscriber, 16 | }; 17 | 18 | // The zen-observable package defines Observable.prototype[Symbol.observable] 19 | // when Symbol is supported, but RxJS interop depends on also setting this fake 20 | // '@@observable' string as a polyfill for Symbol.observable. 21 | const { prototype } = Observable; 22 | const fakeObsSymbol = '@@observable' as keyof typeof prototype; 23 | if (!prototype[fakeObsSymbol]) { 24 | prototype[fakeObsSymbol] = function () { return this; }; 25 | } 26 | 27 | export { Observable }; 28 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typeGenerator.ts: -------------------------------------------------------------------------------- 1 | import { TypeGenerator } from "relay-compiler/lib/language/RelayLanguagePluginInterface"; 2 | 3 | export function generateFactory(wrappedGenerate: TypeGenerator["generate"]) { 4 | const generate: TypeGenerator["generate"] = (schema, node, options) => { 5 | const generated = wrappedGenerate(schema, node, options); 6 | return ( 7 | generated 8 | .replace("relay-runtime", "@graphitation/apollo-react-relay-duct-tape") 9 | // Align the generated types with the relay-compiler >= 15.0.0 output 10 | .replace(/\$fragmentRefs/g, "$fragmentSpreads") 11 | .replace(/\$refType/g, "$fragmentType") 12 | // These fields in the `@raw_response_type` output are really just for relay-runtime, so for now we can just 13 | // strip them out entirely. 14 | .replace(/^\s+readonly __is[A-Z].+;\n/gm, "") 15 | ); 16 | }; 17 | return generate; 18 | } 19 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/ambient.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace jest { 2 | interface Matchers { 3 | // Used in TypeScriptGenerator-tests.ts 4 | toMatchFile(width: string): void; 5 | } 6 | } 7 | 8 | declare module "relay-test-utils-internal/lib/generateTestsFromFixtures" { 9 | export function generateTestsFromFixtures( 10 | path: string, 11 | callback: (text: string) => void, 12 | ): void; 13 | } 14 | 15 | declare module "relay-test-utils-internal/lib/parseGraphQLText" { 16 | import type { Fragment, Root, Schema } from "relay-compiler"; 17 | function parseGraphQLText( 18 | schema: Schema, 19 | text: string, 20 | ): { definitions: ReadonlyArray; schema: Schema }; 21 | export = parseGraphQLText; 22 | } 23 | 24 | declare module "relay-test-utils-internal/lib/TestSchema" { 25 | import type { Schema } from "relay-compiler"; 26 | export const TestSchema: Schema; 27 | } 28 | -------------------------------------------------------------------------------- /packages/supermassive/src/benchmarks/nice-benchmark.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | 3 | import { Suite } from "benchmark"; 4 | 5 | export default class NiceBenchmark { 6 | private name: string; 7 | private suite: Suite; 8 | 9 | constructor(name: string) { 10 | this.name = name; 11 | this.suite = new Suite(name); 12 | this.suite.on("cycle", function (event: any) { 13 | console.log(String(event.target)); 14 | }); 15 | } 16 | 17 | add(name: string, fn: () => Promise | void) { 18 | this.suite.add(name, { 19 | defer: true, 20 | fn: async (deferred: any) => { 21 | await fn(); 22 | deferred.resolve(); 23 | }, 24 | }); 25 | } 26 | 27 | run(options?: any): Promise { 28 | return new Promise((resolve) => { 29 | this.suite.on("complete", resolve); 30 | console.log(this.name); 31 | this.suite.run(options); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/apollo-react-relay-duct-tape-compiler/src/typescriptTransforms/__tests__/fixtures/type-generator/fragment-spread.graphql: -------------------------------------------------------------------------------- 1 | fragment FragmentSpread on Node { 2 | id 3 | ...OtherFragment 4 | justFrag: profilePicture { 5 | ...PictureFragment 6 | } 7 | fragAndField: profilePicture { 8 | uri 9 | ...PictureFragment 10 | } 11 | ... on User { 12 | ...UserFrag1 13 | ...UserFrag2 14 | } 15 | } 16 | 17 | fragment ConcreateTypes on Viewer { 18 | actor { 19 | __typename 20 | ... on Page { 21 | id 22 | ...PageFragment 23 | } 24 | ... on User { 25 | name 26 | } 27 | } 28 | } 29 | 30 | fragment PictureFragment on Image { 31 | __typename 32 | } 33 | 34 | fragment OtherFragment on Node { 35 | __typename 36 | } 37 | 38 | fragment PageFragment on Page { 39 | __typename 40 | } 41 | 42 | fragment UserFrag1 on User { 43 | __typename 44 | } 45 | 46 | fragment UserFrag2 on User { 47 | __typename 48 | } 49 | --------------------------------------------------------------------------------