├── .gitignore ├── .vscode └── tasks.json ├── LICENSE ├── README.md ├── chapters ├── chapter01_Getting_Started_With_Typescript_5 │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── UML.js │ │ ├── aggregations.js │ │ ├── associations.js │ │ ├── assotiations.js │ │ ├── classes.js │ │ ├── compositions.js │ │ ├── decorators.js │ │ ├── degToRad.js │ │ ├── enums.js │ │ ├── index.js │ │ ├── inheritance.js │ │ ├── inputOutput.js │ │ ├── interfaces.js │ │ ├── intro.js │ │ ├── isArray.js │ │ ├── isObject.js │ │ ├── javascript-vs-typescript.js │ │ ├── maybeNumber.js │ │ ├── mul.js │ │ ├── noInfer.js │ │ ├── noUnusedLocals.js │ │ ├── refactoring.js │ │ ├── removeDuplicateChars.js │ │ ├── shape.js │ │ ├── typeInference.js │ │ ├── types.js │ │ └── visibility.js │ ├── package.json │ ├── src │ │ ├── UML.ts │ │ ├── aggregations.ts │ │ ├── associations.ts │ │ ├── classes.ts │ │ ├── compositions.ts │ │ ├── decorators.ts │ │ ├── degToRad.ts │ │ ├── enums.ts │ │ ├── index.ts │ │ ├── inheritance.ts │ │ ├── inputOutput.ts │ │ ├── interfaces.ts │ │ ├── intro.ts │ │ ├── isArray.ts │ │ ├── isObject.js │ │ ├── isObject.ts │ │ ├── javascript-vs-typescript.ts │ │ ├── maybeNumber.ts │ │ ├── mul.test.ts │ │ ├── mul.ts │ │ ├── noInfer.ts │ │ ├── noUnusedLocals.ts │ │ ├── refactoring.ts │ │ ├── removeDuplicateChars.ts │ │ ├── shape.ts │ │ ├── triggerNotification.js │ │ ├── typeInference.ts │ │ ├── types.ts │ │ └── visibility.ts │ ├── tsconfig.json │ └── vitest.config.ts ├── chapter02_Core_Principles_and_use_cases │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── DOM │ │ │ └── index.js │ │ ├── branded.js │ │ ├── conditional.js │ │ ├── errors.js │ │ ├── express │ │ │ └── server.js │ │ ├── infer.js │ │ ├── keyof.js │ │ ├── mapped.js │ │ ├── nest │ │ │ ├── app.controller.js │ │ │ ├── app.module.js │ │ │ └── main.js │ │ ├── omit.js │ │ ├── partial.js │ │ ├── records.js │ │ ├── required.js │ │ ├── server.js │ │ └── shutdown │ │ │ └── server.js │ ├── package.json │ ├── src │ │ ├── DOM │ │ │ ├── dist │ │ │ │ ├── index.js │ │ │ │ └── index.js.map │ │ │ ├── index.html │ │ │ ├── index.ts │ │ │ └── tsconfig.json │ │ ├── branded.ts │ │ ├── bun │ │ │ └── server.ts │ │ ├── conditional.ts │ │ ├── deno │ │ │ └── server.ts │ │ ├── errors.ts │ │ ├── express │ │ │ └── server.ts │ │ ├── infer.ts │ │ ├── keyof.ts │ │ ├── mapped.ts │ │ ├── nest │ │ │ ├── app.controller.ts │ │ │ ├── app.module.ts │ │ │ └── main.ts │ │ ├── omit.ts │ │ ├── partial.ts │ │ ├── pick.ts │ │ ├── react │ │ │ ├── .eslintrc.cjs │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── index.html │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── public │ │ │ │ └── vite.svg │ │ │ ├── src │ │ │ │ ├── App.css │ │ │ │ ├── App.tsx │ │ │ │ ├── assets │ │ │ │ │ └── react.svg │ │ │ │ ├── components │ │ │ │ │ ├── Button.tsx │ │ │ │ │ ├── Greetings.tsx │ │ │ │ │ └── Greetings2.tsx │ │ │ │ ├── index.css │ │ │ │ ├── main.tsx │ │ │ │ └── vite-env.d.ts │ │ │ ├── tsconfig.json │ │ │ ├── tsconfig.node.json │ │ │ └── vite.config.ts │ │ ├── records.ts │ │ ├── required.ts │ │ ├── shutdown │ │ │ └── server.ts │ │ └── vite │ │ │ ├── dist │ │ │ └── vite-example.js │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── src │ │ │ └── main.ts │ │ │ ├── tsconfig.json │ │ │ └── vite.config.ts │ ├── tsconfig.json │ └── vitest.config.ts ├── chapter03_Creational_Design_Patterns │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── abstract-factory.js │ │ ├── builder.js │ │ ├── decorator-singleton.js │ │ ├── factory-method.js │ │ ├── parametric-singleton.js │ │ ├── prototype-issues.js │ │ ├── prototype.js │ │ └── singleton.js │ ├── package.json │ ├── src │ │ ├── abstract-factory.test.ts │ │ ├── abstract-factory.ts │ │ ├── builder.test.ts │ │ ├── builder.ts │ │ ├── decorator-singleton.ts │ │ ├── factory-method.test.ts │ │ ├── factory-method.ts │ │ ├── parametric-singleton.ts │ │ ├── prototype-issues.ts │ │ ├── prototype.test.ts │ │ ├── prototype.ts │ │ ├── singleton.test.ts │ │ └── singleton.ts │ ├── tsconfig.json │ └── vitest.config.ts ├── chapter04_Structural_Design_Patterns │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── adapter.js │ │ ├── bridge.js │ │ ├── composite.js │ │ ├── decorator-variant.js │ │ ├── decorator.js │ │ ├── facade.js │ │ ├── flyweight.js │ │ └── proxy.js │ ├── package.json │ ├── src │ │ ├── adapter.test.ts │ │ ├── adapter.ts │ │ ├── bridge.test.ts │ │ ├── bridge.ts │ │ ├── composite.test.ts │ │ ├── composite.ts │ │ ├── decorator-variant.ts │ │ ├── decorator.test.ts │ │ ├── decorator.ts │ │ ├── facade.test.ts │ │ ├── facade.ts │ │ ├── flyweight.test.ts │ │ ├── flyweight.ts │ │ ├── proxy.test.ts │ │ └── proxy.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js ├── chapter05_Behavioral_Design_Patterns_Communication │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── chain-of-responsibility.js │ │ ├── command.js │ │ ├── iterator.js │ │ ├── mediator.js │ │ ├── memento.js │ │ ├── observer.js │ │ ├── state.js │ │ ├── strategy.js │ │ ├── template-method.js │ │ └── visitor.js │ ├── package.json │ ├── src │ │ ├── chain-of-responsibility.test.ts │ │ ├── chain-of-responsibility.ts │ │ ├── command.test.ts │ │ ├── command.ts │ │ ├── iterator.test.ts │ │ ├── iterator.ts │ │ ├── mediator.test.ts │ │ ├── mediator.ts │ │ ├── memento.test.ts │ │ ├── memento.ts │ │ ├── observer.ts │ │ ├── state.test.ts │ │ ├── state.ts │ │ ├── strategy.test.ts │ │ ├── strategy.ts │ │ ├── template-method.test.ts │ │ ├── template-method.ts │ │ ├── visitor.test.ts │ │ └── visitor.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js ├── chapter06_Behavioral_Design_Patterns_State │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── chain-of-responsibility.js │ │ ├── command.js │ │ ├── iterator.js │ │ ├── mediator.js │ │ ├── memento.js │ │ ├── observer.js │ │ ├── state.js │ │ ├── strategy.js │ │ ├── template-method.js │ │ ├── visitor.js │ │ └── websockets.js │ ├── package.json │ ├── src │ │ ├── chain-of-responsibility.test.ts │ │ ├── chain-of-responsibility.ts │ │ ├── command.test.ts │ │ ├── command.ts │ │ ├── iterator.test.ts │ │ ├── iterator.ts │ │ ├── mediator.test.ts │ │ ├── mediator.ts │ │ ├── memento.test.ts │ │ ├── memento.ts │ │ ├── observer.ts │ │ ├── state.test.ts │ │ ├── state.ts │ │ ├── strategy.test.ts │ │ ├── strategy.ts │ │ ├── template-method.test.ts │ │ ├── template-method.ts │ │ ├── visitor.test.ts │ │ ├── visitor.ts │ │ └── websockets.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js ├── chapter07_Functional_Programming_Concepts │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── first-class-citizens.js │ │ ├── function-composition.js │ │ ├── functional-structures.js │ │ ├── immutability.js │ │ ├── impure-functions.js │ │ ├── io-actions.js │ │ ├── lens.js │ │ ├── monads.js │ │ ├── pure-functions.js │ │ ├── recursion.js │ │ └── referential.js │ ├── package.json │ ├── src │ │ ├── first-class-citizens.ts │ │ ├── function-composition.ts │ │ ├── functional-structures.ts │ │ ├── immutability.ts │ │ ├── impure-functions.ts │ │ ├── io-actions.ts │ │ ├── lens.ts │ │ ├── monads.ts │ │ ├── pure-functions.ts │ │ ├── recursion.ts │ │ └── referential.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js ├── chapter08_Reactive_Programming_concepts │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── chapter05_Behavioral_Design_Patterns_Communication │ │ │ └── src │ │ │ │ └── observer.js │ │ └── chapter08_Reactive_Programming_concepts │ │ │ └── src │ │ │ ├── futures.js │ │ │ ├── observables.js │ │ │ ├── patterns.js │ │ │ ├── promises.js │ │ │ └── pull-push.js │ ├── package.json │ ├── src │ │ ├── futures.test.ts │ │ ├── futures.ts │ │ ├── observables.test.ts │ │ ├── observables.ts │ │ ├── patterns.ts │ │ ├── promises.ts │ │ ├── pull-push.test.ts │ │ └── pull-push.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js ├── chapter09_Best_practices │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── ddd.js │ │ ├── iterator-composite.js │ │ ├── iterator-visitor.js │ │ ├── mvc.js │ │ ├── mvp.js │ │ ├── singleton-facade.js │ │ ├── solid.js │ │ ├── utilities.js │ │ └── utilties.js │ ├── package.json │ ├── src │ │ ├── ddd.ts │ │ ├── iterator-composite.ts │ │ ├── iterator-visitor.ts │ │ ├── mvc.ts │ │ ├── singleton-facade.ts │ │ ├── solid.ts │ │ └── utilities.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js ├── chapter10_Anti_patterns │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── dist │ │ ├── class-overuse.js │ │ ├── generic-type.js │ │ ├── idiomatic-code.js │ │ ├── permissive-types.js │ │ └── type-inference.js │ ├── package.json │ ├── src │ │ ├── class-overuse.ts │ │ ├── generic-type.ts │ │ ├── idiomatic-code.ts │ │ ├── permissive-types.ts │ │ └── type-inference.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js └── chapter11-Open_source_patterns │ ├── apollo │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── package-lock.json │ ├── package.json │ ├── src │ │ └── client.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js │ └── trpc │ ├── .eslintrc.json │ ├── .prettierignore │ ├── .prettierrc.json │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── client.ts │ └── server.ts │ ├── tsconfig.json │ ├── vitest.config.ts │ └── vitest.setup.js ├── external-repos ├── apollo-client │ ├── .api-reports │ │ ├── api-report-cache.api.md │ │ ├── api-report-core.api.md │ │ ├── api-report-dev.api.md │ │ ├── api-report-errors.api.md │ │ ├── api-report-link_batch-http.api.md │ │ ├── api-report-link_batch.api.md │ │ ├── api-report-link_context.api.md │ │ ├── api-report-link_core.api.md │ │ ├── api-report-link_error.api.md │ │ ├── api-report-link_http.api.md │ │ ├── api-report-link_persisted-queries.api.md │ │ ├── api-report-link_remove-typename.api.md │ │ ├── api-report-link_retry.api.md │ │ ├── api-report-link_schema.api.md │ │ ├── api-report-link_subscriptions.api.md │ │ ├── api-report-link_utils.api.md │ │ ├── api-report-link_ws.api.md │ │ ├── api-report-react.api.md │ │ ├── api-report-react_components.api.md │ │ ├── api-report-react_context.api.md │ │ ├── api-report-react_hoc.api.md │ │ ├── api-report-react_hooks.api.md │ │ ├── api-report-react_internal.api.md │ │ ├── api-report-react_parser.api.md │ │ ├── api-report-react_ssr.api.md │ │ ├── api-report-testing.api.md │ │ ├── api-report-testing_core.api.md │ │ ├── api-report-testing_experimental.api.md │ │ ├── api-report-utilities.api.md │ │ ├── api-report-utilities_globals.api.md │ │ ├── api-report-utilities_subscriptions_relay.api.md │ │ ├── api-report-utilities_subscriptions_urql.api.md │ │ └── api-report.api.md │ ├── .attw.json │ ├── .changeset │ │ ├── README.md │ │ └── config.json │ ├── .circleci │ │ └── config.yml │ ├── .eslintrc │ ├── .git-blame-ignore-revs │ ├── .gitattributes │ ├── .github │ │ ├── CODEOWNERS │ │ ├── ISSUE_TEMPLATE │ │ │ ├── bug.yml │ │ │ ├── feature-request.md │ │ │ └── question-discussion.md │ │ ├── PULL_REQUEST_TEMPLATE.md │ │ ├── dependabot.yml │ │ └── workflows │ │ │ ├── api-extractor.yml │ │ │ ├── arethetypeswrong.yml │ │ │ ├── change-prerelease-tag.yml │ │ │ ├── cleanup-checks.yml │ │ │ ├── close-stale-issues.yml │ │ │ ├── compare-build-output.yml │ │ │ ├── devtools-errorcodes.yml │ │ │ ├── exit-prerelease.yml │ │ │ ├── issue-close-user-survey.yml │ │ │ ├── lock.yml │ │ │ ├── prerelease.yml │ │ │ ├── publish-pr-releases.yml │ │ │ ├── release.yml │ │ │ ├── size-limit.yml │ │ │ └── snapshot-release.yml │ ├── .gitignore │ ├── .npmrc │ ├── .prettierignore │ ├── .prettierrc │ ├── .semgrepignore │ ├── .size-limit.cjs │ ├── .size-limits.json │ ├── .vscode │ │ ├── launch.json │ │ └── settings.json │ ├── CHANGELOG.md │ ├── COLLABORATORS.md │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── ROADMAP.md │ ├── api-extractor.json │ ├── config │ │ ├── FixJSDOMEnvironment.js │ │ ├── apiExtractor.ts │ │ ├── bundlesize.ts │ │ ├── compare-build-output-to.sh │ │ ├── entryPoints.js │ │ ├── helpers.ts │ │ ├── inlineInheritDoc.ts │ │ ├── jest.config.js │ │ ├── postprocessDist.ts │ │ ├── precheck.js │ │ ├── prepareChangesetsRelease.ts │ │ ├── prepareDist.js │ │ ├── processInvariants.ts │ │ ├── rewriteSourceMaps.ts │ │ ├── rollup.config.js │ │ ├── tsconfig.json │ │ └── version.js │ ├── docs │ │ ├── README.md │ │ ├── shared │ │ │ ├── ApiDoc │ │ │ │ ├── Context.js │ │ │ │ ├── DocBlock.js │ │ │ │ ├── EnumDetails.js │ │ │ │ ├── Function.js │ │ │ │ ├── Heading.js │ │ │ │ ├── InterfaceDetails.js │ │ │ │ ├── ParameterTable.js │ │ │ │ ├── PropertyDetails.js │ │ │ │ ├── PropertySignatureTable.js │ │ │ │ ├── ResponsiveGrid.js │ │ │ │ ├── SourceLink.js │ │ │ │ ├── Tuple.js │ │ │ │ ├── index.js │ │ │ │ └── sortWithCustomOrder.js │ │ │ ├── DisplayClientError.js │ │ │ ├── Overrides │ │ │ │ └── UseLoadableQueryResult.js │ │ │ ├── link-chain.mdx │ │ │ ├── refetchQueries-options.mdx │ │ │ ├── useBackgroundQuery-options.mdx │ │ │ ├── useBackgroundQuery-result.mdx │ │ │ ├── useFragment-options.mdx │ │ │ ├── useFragment-result.mdx │ │ │ ├── useReadQuery-result.mdx │ │ │ └── useSuspenseQuery-result.mdx │ │ └── source │ │ │ ├── _redirects │ │ │ ├── api │ │ │ ├── cache │ │ │ │ └── InMemoryCache.mdx │ │ │ ├── core │ │ │ │ ├── ApolloClient.mdx │ │ │ │ └── ObservableQuery.mdx │ │ │ ├── link │ │ │ │ ├── apollo-link-batch-http.mdx │ │ │ │ ├── apollo-link-context.md │ │ │ │ ├── apollo-link-error.md │ │ │ │ ├── apollo-link-http.md │ │ │ │ ├── apollo-link-remove-typename.mdx │ │ │ │ ├── apollo-link-rest.md │ │ │ │ ├── apollo-link-retry.md │ │ │ │ ├── apollo-link-schema.md │ │ │ │ ├── apollo-link-subscriptions.md │ │ │ │ ├── apollo-link-ws.md │ │ │ │ ├── community-links.md │ │ │ │ ├── introduction.mdx │ │ │ │ └── persisted-queries.mdx │ │ │ └── react │ │ │ │ ├── components.mdx │ │ │ │ ├── hoc.mdx │ │ │ │ ├── hooks-experimental.mdx │ │ │ │ ├── hooks.mdx │ │ │ │ ├── preloading.mdx │ │ │ │ ├── ssr.md │ │ │ │ └── testing.md │ │ │ ├── assets │ │ │ ├── client-diagrams │ │ │ │ ├── 1-overview.png │ │ │ │ ├── 2-map.png │ │ │ │ ├── 3-minimize.png │ │ │ │ └── 4-normalize.png │ │ │ ├── client-mocking │ │ │ │ ├── cli-clientcheck.png │ │ │ │ ├── devtools-clientstate.png │ │ │ │ ├── vscode-autocomplete.png │ │ │ │ ├── vscode-errors.png │ │ │ │ └── vscode-typeinfo.png │ │ │ ├── client-schema.png │ │ │ ├── devtools │ │ │ │ ├── apollo-client-devtools │ │ │ │ │ └── ac-browser-devtools-3.png │ │ │ │ ├── devtools.png │ │ │ │ ├── mutation-init.png │ │ │ │ ├── mutation-result-data.png │ │ │ │ ├── mutation-result.png │ │ │ │ ├── query-init-data.png │ │ │ │ ├── query-init.png │ │ │ │ └── query-result.png │ │ │ └── link │ │ │ │ ├── concepts-intro-1.png │ │ │ │ ├── concepts-intro-2.png │ │ │ │ └── error-request-flow.png │ │ │ ├── caching │ │ │ ├── advanced-topics.mdx │ │ │ ├── cache-configuration.mdx │ │ │ ├── cache-field-behavior.mdx │ │ │ ├── cache-interaction.mdx │ │ │ ├── garbage-collection.mdx │ │ │ ├── memory-management.mdx │ │ │ └── overview.mdx │ │ │ ├── config.json │ │ │ ├── data │ │ │ ├── defer.mdx │ │ │ ├── directives.mdx │ │ │ ├── document-transforms.mdx │ │ │ ├── error-handling.mdx │ │ │ ├── file-uploads.md │ │ │ ├── fragments.md │ │ │ ├── mutations.mdx │ │ │ ├── operation-best-practices.mdx │ │ │ ├── queries.mdx │ │ │ ├── refetching.mdx │ │ │ ├── subscriptions.mdx │ │ │ └── suspense.mdx │ │ │ ├── development-testing │ │ │ ├── client-schema-mocking.mdx │ │ │ ├── developer-tooling.md │ │ │ ├── reducing-bundle-size.mdx │ │ │ ├── schema-driven-testing.mdx │ │ │ ├── static-typing.md │ │ │ └── testing.mdx │ │ │ ├── get-started.mdx │ │ │ ├── img │ │ │ ├── cache-inspector.jpg │ │ │ ├── client-schema.png │ │ │ ├── githunt.png │ │ │ └── spotify-playlists.jpg │ │ │ ├── index.mdx │ │ │ ├── integrations │ │ │ ├── integrations.md │ │ │ ├── react-native.md │ │ │ └── webpack.md │ │ │ ├── local-state │ │ │ ├── client-side-schema.mdx │ │ │ ├── local-resolvers.mdx │ │ │ ├── local-state-management.mdx │ │ │ ├── managing-state-with-field-policies.mdx │ │ │ └── reactive-variables.mdx │ │ │ ├── logo │ │ │ ├── favicon.png │ │ │ ├── icon-apollo-white-200x200.png │ │ │ ├── large.png │ │ │ ├── logo-apollo-space.svg │ │ │ └── square.png │ │ │ ├── migrating │ │ │ ├── apollo-client-3-migration.mdx │ │ │ └── hooks-migration.md │ │ │ ├── networking │ │ │ ├── advanced-http-networking.md │ │ │ ├── authentication.mdx │ │ │ └── basic-http-networking.md │ │ │ ├── pagination │ │ │ ├── core-api.mdx │ │ │ ├── cursor-based.mdx │ │ │ ├── key-args.mdx │ │ │ ├── offset-based.mdx │ │ │ └── overview.mdx │ │ │ ├── performance │ │ │ ├── babel.md │ │ │ ├── optimistic-ui.mdx │ │ │ ├── performance.mdx │ │ │ └── server-side-rendering.mdx │ │ │ ├── template.md │ │ │ └── why-apollo.mdx │ ├── eslint-local-rules │ │ ├── fixtures │ │ │ ├── file.ts │ │ │ ├── react.tsx │ │ │ └── tsconfig.json │ │ ├── index.js │ │ ├── package.json │ │ ├── require-using-disposable.test.ts │ │ ├── require-using-disposable.ts │ │ ├── testSetup.ts │ │ └── tsconfig.json │ ├── integration-tests │ │ ├── .gitignore │ │ ├── api.har │ │ ├── browser-esm │ │ │ ├── html │ │ │ │ ├── jsdeliver-esm.html │ │ │ │ ├── jspm-prepared.html │ │ │ │ └── unpkg-unmangled.html │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ └── tests │ │ │ │ └── playwright │ │ │ │ ├── jsdeliver-esm.test.ts │ │ │ │ ├── jspm-prepared.test.ts │ │ │ │ └── unpkg-unmangled.test.ts │ │ ├── cra4 │ │ │ ├── .env │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── public │ │ │ │ └── index.html │ │ │ ├── src │ │ │ │ ├── App.tsx │ │ │ │ └── index.tsx │ │ │ ├── tests │ │ │ │ └── playwright │ │ │ │ │ └── apollo-client.test.ts │ │ │ └── tsconfig.json │ │ ├── cra5 │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── public │ │ │ │ └── index.html │ │ │ ├── src │ │ │ │ ├── App.tsx │ │ │ │ └── index.tsx │ │ │ ├── tests │ │ │ │ └── playwright │ │ │ │ │ └── apollo-client.test.ts │ │ │ └── tsconfig.json │ │ ├── empty.har │ │ ├── next │ │ │ ├── next-env.d.ts │ │ │ ├── next.config.js │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── src │ │ │ │ ├── app │ │ │ │ │ ├── cc │ │ │ │ │ │ ├── ApolloWrapper.tsx │ │ │ │ │ │ ├── layout.tsx │ │ │ │ │ │ └── page.tsx │ │ │ │ │ ├── client.ts │ │ │ │ │ ├── layout.tsx │ │ │ │ │ └── page.tsx │ │ │ │ ├── libs │ │ │ │ │ ├── apolloClient.ts │ │ │ │ │ └── schemaLink.ts │ │ │ │ └── pages │ │ │ │ │ ├── _app.tsx │ │ │ │ │ ├── pages-no-ssr.tsx │ │ │ │ │ └── pages.tsx │ │ │ ├── tests │ │ │ │ └── playwright │ │ │ │ │ └── apollo-client.test.ts │ │ │ └── tsconfig.json │ │ ├── node-esm │ │ │ ├── package.json │ │ │ ├── test-cjs.cjs │ │ │ └── test-esm.mjs │ │ ├── node-standard │ │ │ ├── package.json │ │ │ ├── test-cjs.js │ │ │ └── test-esm.mjs │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── peerdeps-tsc │ │ │ ├── .gitignore │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── shared │ │ │ ├── fixture.ts │ │ │ ├── package.json │ │ │ └── playwright.config.ts │ │ ├── vite-swc │ │ │ ├── index.html │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── src │ │ │ │ ├── App.tsx │ │ │ │ └── main.tsx │ │ │ ├── tests │ │ │ │ └── playwright │ │ │ │ │ └── apollo-client.test.ts │ │ │ ├── tsconfig.json │ │ │ ├── tsconfig.node.json │ │ │ └── vite.config.ts │ │ └── vite │ │ │ ├── index.html │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── src │ │ │ ├── App.tsx │ │ │ └── main.tsx │ │ │ ├── tests │ │ │ └── playwright │ │ │ │ └── apollo-client.test.ts │ │ │ ├── tsconfig.json │ │ │ ├── tsconfig.node.json │ │ │ └── vite.config.ts │ ├── netlify.toml │ ├── package-lock.json │ ├── package.json │ ├── patches │ │ ├── @testing-library+react-12+12.1.5.patch │ │ ├── eslint-plugin-react-hooks+4.6.2.patch │ │ ├── eslint-plugin-testing-library+6.3.0.patch │ │ ├── pretty-format+29.7.0.patch │ │ └── react-dom-19+19.0.0-rc-378b305958-20240710.patch │ ├── renovate.json │ ├── scripts │ │ ├── codemods │ │ │ ├── ac2-to-ac3 │ │ │ │ ├── README.md │ │ │ │ ├── examples │ │ │ │ │ ├── client-and-cache.ts │ │ │ │ │ ├── link-packages.js │ │ │ │ │ └── react-packages.tsx │ │ │ │ ├── imports.js │ │ │ │ └── package.json │ │ │ └── misc │ │ │ │ └── mockLinkRejection.ts │ │ └── memory │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ └── tests.js │ ├── src │ │ ├── __tests__ │ │ │ ├── ApolloClient.ts │ │ │ ├── __snapshots__ │ │ │ │ ├── ApolloClient.ts.snap │ │ │ │ ├── client.ts.snap │ │ │ │ ├── exports.ts.snap │ │ │ │ ├── graphqlSubscriptions.ts.snap │ │ │ │ └── mutationResults.ts.snap │ │ │ ├── client.ts │ │ │ ├── exports.ts │ │ │ ├── fetchMore.ts │ │ │ ├── graphqlSubscriptions.ts │ │ │ ├── local-state │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── export.ts.snap │ │ │ │ │ └── general.ts.snap │ │ │ │ ├── export.ts │ │ │ │ ├── general.ts │ │ │ │ ├── resolvers.ts │ │ │ │ └── subscriptions.ts │ │ │ ├── mutationResults.ts │ │ │ ├── optimistic.ts │ │ │ ├── refetchQueries.ts │ │ │ ├── resultCacheCleaning.ts │ │ │ └── subscribeToMore.ts │ │ ├── cache │ │ │ ├── core │ │ │ │ ├── __tests__ │ │ │ │ │ └── cache.ts │ │ │ │ ├── cache.ts │ │ │ │ └── types │ │ │ │ │ ├── Cache.ts │ │ │ │ │ ├── DataProxy.ts │ │ │ │ │ └── common.ts │ │ │ ├── index.ts │ │ │ └── inmemory │ │ │ │ ├── __tests__ │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── cache.ts.snap │ │ │ │ │ ├── entityStore.ts.snap │ │ │ │ │ ├── fragmentMatcher.ts.snap │ │ │ │ │ ├── policies.ts.snap │ │ │ │ │ ├── readFromStore.ts.snap │ │ │ │ │ ├── roundtrip.ts.snap │ │ │ │ │ └── writeToStore.ts.snap │ │ │ │ ├── cache.ts │ │ │ │ ├── diffAgainstStore.ts │ │ │ │ ├── entityStore.ts │ │ │ │ ├── fragmentMatcher.ts │ │ │ │ ├── fragmentRegistry.ts │ │ │ │ ├── helpers.ts │ │ │ │ ├── key-extractor.ts │ │ │ │ ├── object-canon.ts │ │ │ │ ├── optimistic.ts │ │ │ │ ├── policies.ts │ │ │ │ ├── readFromStore.ts │ │ │ │ ├── recordingCache.ts │ │ │ │ ├── roundtrip.ts │ │ │ │ └── writeToStore.ts │ │ │ │ ├── entityStore.ts │ │ │ │ ├── fixPolyfills.native.ts │ │ │ │ ├── fixPolyfills.ts │ │ │ │ ├── fragmentRegistry.ts │ │ │ │ ├── helpers.ts │ │ │ │ ├── inMemoryCache.ts │ │ │ │ ├── key-extractor.ts │ │ │ │ ├── object-canon.ts │ │ │ │ ├── policies.ts │ │ │ │ ├── reactiveVars.ts │ │ │ │ ├── readFromStore.ts │ │ │ │ ├── types.ts │ │ │ │ └── writeToStore.ts │ │ ├── config │ │ │ └── jest │ │ │ │ ├── areApolloErrorsEqual.ts │ │ │ │ ├── areGraphQlErrorsEqual.ts │ │ │ │ └── setup.ts │ │ ├── core │ │ │ ├── ApolloClient.ts │ │ │ ├── LocalState.ts │ │ │ ├── ObservableQuery.ts │ │ │ ├── QueryInfo.ts │ │ │ ├── QueryManager.ts │ │ │ ├── __tests__ │ │ │ │ ├── LocalState.ts │ │ │ │ ├── ObservableQuery.ts │ │ │ │ ├── QueryManager │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── links.ts │ │ │ │ │ ├── multiple-results.ts │ │ │ │ │ └── recycler.ts │ │ │ │ ├── equalByQuery.ts │ │ │ │ └── fetchPolicies.ts │ │ │ ├── equalByQuery.ts │ │ │ ├── index.ts │ │ │ ├── networkStatus.ts │ │ │ ├── types.ts │ │ │ └── watchQueryOptions.ts │ │ ├── dev │ │ │ ├── index.ts │ │ │ ├── loadDevMessages.ts │ │ │ ├── loadErrorMessageHandler.ts │ │ │ ├── loadErrorMessages.ts │ │ │ └── setErrorMessageHandler.ts │ │ ├── errors │ │ │ ├── __tests__ │ │ │ │ └── ApolloError.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── invariantErrorCodes.ts │ │ ├── link │ │ │ ├── batch-http │ │ │ │ ├── __tests__ │ │ │ │ │ └── batchHttpLink.ts │ │ │ │ ├── batchHttpLink.ts │ │ │ │ └── index.ts │ │ │ ├── batch │ │ │ │ ├── __tests__ │ │ │ │ │ └── batchLink.ts │ │ │ │ ├── batchLink.ts │ │ │ │ ├── batching.ts │ │ │ │ └── index.ts │ │ │ ├── context │ │ │ │ ├── __tests__ │ │ │ │ │ └── index.ts │ │ │ │ └── index.ts │ │ │ ├── core │ │ │ │ ├── ApolloLink.ts │ │ │ │ ├── __tests__ │ │ │ │ │ └── ApolloLink.ts │ │ │ │ ├── concat.ts │ │ │ │ ├── empty.ts │ │ │ │ ├── execute.ts │ │ │ │ ├── from.ts │ │ │ │ ├── index.ts │ │ │ │ ├── split.ts │ │ │ │ └── types.ts │ │ │ ├── error │ │ │ │ ├── __tests__ │ │ │ │ │ └── index.ts │ │ │ │ └── index.ts │ │ │ ├── http │ │ │ │ ├── HttpLink.ts │ │ │ │ ├── __tests__ │ │ │ │ │ ├── HttpLink.ts │ │ │ │ │ ├── checkFetcher.ts │ │ │ │ │ ├── headerNormalization.ts │ │ │ │ │ ├── helpers.ts │ │ │ │ │ ├── parseAndCheckHttpResponse.ts │ │ │ │ │ ├── responseIterator.ts │ │ │ │ │ ├── responseIteratorNoAsyncIterator.ts │ │ │ │ │ ├── selectHttpOptionsAndBody.ts │ │ │ │ │ ├── selectURI.ts │ │ │ │ │ └── serializeFetchParameter.ts │ │ │ │ ├── checkFetcher.ts │ │ │ │ ├── createHttpLink.ts │ │ │ │ ├── createSignalIfSupported.ts │ │ │ │ ├── index.ts │ │ │ │ ├── iterators │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── async.ts │ │ │ │ │ ├── nodeStream.ts │ │ │ │ │ ├── promise.ts │ │ │ │ │ └── reader.ts │ │ │ │ ├── parseAndCheckHttpResponse.ts │ │ │ │ ├── responseIterator.ts │ │ │ │ ├── rewriteURIForGET.ts │ │ │ │ ├── selectHttpOptionsAndBody.ts │ │ │ │ ├── selectURI.ts │ │ │ │ └── serializeFetchParameter.ts │ │ │ ├── persisted-queries │ │ │ │ ├── __tests__ │ │ │ │ │ ├── persisted-queries.test.ts │ │ │ │ │ └── react.test.tsx │ │ │ │ └── index.ts │ │ │ ├── remove-typename │ │ │ │ ├── __tests__ │ │ │ │ │ └── removeTypenameFromVariables.ts │ │ │ │ ├── index.ts │ │ │ │ └── removeTypenameFromVariables.ts │ │ │ ├── retry │ │ │ │ ├── __tests__ │ │ │ │ │ ├── delayFunction.ts │ │ │ │ │ ├── retryFunction.ts │ │ │ │ │ └── retryLink.ts │ │ │ │ ├── delayFunction.ts │ │ │ │ ├── index.ts │ │ │ │ ├── retryFunction.ts │ │ │ │ └── retryLink.ts │ │ │ ├── schema │ │ │ │ ├── __tests__ │ │ │ │ │ └── schemaLink.ts │ │ │ │ └── index.ts │ │ │ ├── subscriptions │ │ │ │ ├── __tests__ │ │ │ │ │ └── graphqlWsLink.ts │ │ │ │ └── index.ts │ │ │ ├── utils │ │ │ │ ├── __tests__ │ │ │ │ │ ├── filterOperationVariables.ts │ │ │ │ │ ├── fromError.ts │ │ │ │ │ ├── fromPromise.ts │ │ │ │ │ ├── toPromise.ts │ │ │ │ │ └── validateOperation.ts │ │ │ │ ├── createOperation.ts │ │ │ │ ├── filterOperationVariables.ts │ │ │ │ ├── fromError.ts │ │ │ │ ├── fromPromise.ts │ │ │ │ ├── index.ts │ │ │ │ ├── throwServerError.ts │ │ │ │ ├── toPromise.ts │ │ │ │ ├── transformOperation.ts │ │ │ │ └── validateOperation.ts │ │ │ └── ws │ │ │ │ ├── __tests__ │ │ │ │ └── webSocketLink.ts │ │ │ │ └── index.ts │ │ ├── react │ │ │ ├── components │ │ │ │ ├── Mutation.tsx │ │ │ │ ├── Query.tsx │ │ │ │ ├── Subscription.tsx │ │ │ │ ├── __tests__ │ │ │ │ │ ├── client │ │ │ │ │ │ ├── Mutation.test.tsx │ │ │ │ │ │ ├── Query.test.tsx │ │ │ │ │ │ └── Subscription.test.tsx │ │ │ │ │ └── ssr │ │ │ │ │ │ ├── getDataFromTree.test.tsx │ │ │ │ │ │ └── server.test.tsx │ │ │ │ ├── index.ts │ │ │ │ └── types.ts │ │ │ ├── context │ │ │ │ ├── ApolloConsumer.tsx │ │ │ │ ├── ApolloContext.ts │ │ │ │ ├── ApolloProvider.tsx │ │ │ │ ├── __tests__ │ │ │ │ │ ├── ApolloConsumer.test.tsx │ │ │ │ │ └── ApolloProvider.test.tsx │ │ │ │ └── index.ts │ │ │ ├── hoc │ │ │ │ ├── __tests__ │ │ │ │ │ ├── client-option.test.tsx │ │ │ │ │ ├── fragments.test.tsx │ │ │ │ │ ├── mutations │ │ │ │ │ │ ├── index.test.tsx │ │ │ │ │ │ ├── lifecycle.test.tsx │ │ │ │ │ │ ├── queries.test.tsx │ │ │ │ │ │ └── recycled-queries.test.tsx │ │ │ │ │ ├── queries │ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ │ └── lifecycle.test.tsx.snap │ │ │ │ │ │ ├── api.test.tsx │ │ │ │ │ │ ├── errors.test.tsx │ │ │ │ │ │ ├── index.test.tsx │ │ │ │ │ │ ├── lifecycle.test.tsx │ │ │ │ │ │ ├── loading.test.tsx │ │ │ │ │ │ ├── observableQuery.test.tsx │ │ │ │ │ │ ├── polling.test.tsx │ │ │ │ │ │ ├── recomposeWithState.ts │ │ │ │ │ │ ├── reducer.test.tsx │ │ │ │ │ │ ├── skip.test.tsx │ │ │ │ │ │ └── updateQuery.test.tsx │ │ │ │ │ ├── shared-operations.test.tsx │ │ │ │ │ ├── ssr │ │ │ │ │ │ ├── getDataFromTree.test.tsx │ │ │ │ │ │ └── server.test.tsx │ │ │ │ │ ├── statics.test.tsx │ │ │ │ │ └── subscriptions │ │ │ │ │ │ └── subscriptions.test.tsx │ │ │ │ ├── graphql.tsx │ │ │ │ ├── hoc-utils.tsx │ │ │ │ ├── index.ts │ │ │ │ ├── mutation-hoc.tsx │ │ │ │ ├── query-hoc.tsx │ │ │ │ ├── subscription-hoc.tsx │ │ │ │ ├── types.ts │ │ │ │ └── withApollo.tsx │ │ │ ├── hooks │ │ │ │ ├── __tests__ │ │ │ │ │ ├── useApolloClient.test.tsx │ │ │ │ │ ├── useBackgroundQuery.test.tsx │ │ │ │ │ ├── useFragment.test.tsx │ │ │ │ │ ├── useLazyQuery.test.tsx │ │ │ │ │ ├── useLoadableQuery.test.tsx │ │ │ │ │ ├── useMutation.test.tsx │ │ │ │ │ ├── useQuery.test.tsx │ │ │ │ │ ├── useQueryRefHandlers.test.tsx │ │ │ │ │ ├── useReactiveVar.test.tsx │ │ │ │ │ ├── useSubscription.test.tsx │ │ │ │ │ └── useSuspenseQuery.test.tsx │ │ │ │ ├── constants.ts │ │ │ │ ├── index.ts │ │ │ │ ├── internal │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ ├── useDeepMemo.test.ts │ │ │ │ │ │ └── useRenderGuard.test.tsx │ │ │ │ │ ├── __use.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── useDeepMemo.ts │ │ │ │ │ ├── useIsomorphicLayoutEffect.ts │ │ │ │ │ ├── useRenderGuard.ts │ │ │ │ │ └── wrapHook.ts │ │ │ │ ├── useApolloClient.ts │ │ │ │ ├── useBackgroundQuery.ts │ │ │ │ ├── useFragment.ts │ │ │ │ ├── useLazyQuery.ts │ │ │ │ ├── useLoadableQuery.ts │ │ │ │ ├── useMutation.ts │ │ │ │ ├── useQuery.ts │ │ │ │ ├── useQueryRefHandlers.ts │ │ │ │ ├── useReactiveVar.ts │ │ │ │ ├── useReadQuery.ts │ │ │ │ ├── useSubscription.ts │ │ │ │ ├── useSuspenseQuery.ts │ │ │ │ └── useSyncExternalStore.ts │ │ │ ├── index.ts │ │ │ ├── internal │ │ │ │ ├── cache │ │ │ │ │ ├── QueryReference.ts │ │ │ │ │ ├── SuspenseCache.ts │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ └── QueryReference.test.tsx │ │ │ │ │ ├── getSuspenseCache.ts │ │ │ │ │ └── types.ts │ │ │ │ └── index.ts │ │ │ ├── parser │ │ │ │ ├── __tests__ │ │ │ │ │ └── parser.test.ts │ │ │ │ └── index.ts │ │ │ ├── query-preloader │ │ │ │ ├── __tests__ │ │ │ │ │ └── createQueryPreloader.test.tsx │ │ │ │ └── createQueryPreloader.ts │ │ │ ├── ssr │ │ │ │ ├── RenderPromises.ts │ │ │ │ ├── __tests__ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ └── useQuery.test.tsx.snap │ │ │ │ │ ├── useLazyQuery.test.tsx │ │ │ │ │ ├── useQuery.test.tsx │ │ │ │ │ └── useReactiveVar.test.tsx │ │ │ │ ├── getDataFromTree.ts │ │ │ │ ├── index.ts │ │ │ │ └── renderToStringWithData.ts │ │ │ └── types │ │ │ │ ├── types.documentation.ts │ │ │ │ └── types.ts │ │ ├── testing │ │ │ ├── core │ │ │ │ ├── index.ts │ │ │ │ ├── itAsync.ts │ │ │ │ ├── mocking │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ └── mockLink.ts │ │ │ │ │ ├── mockClient.ts │ │ │ │ │ ├── mockFetch.ts │ │ │ │ │ ├── mockLink.ts │ │ │ │ │ ├── mockQueryManager.ts │ │ │ │ │ ├── mockSubscriptionLink.ts │ │ │ │ │ └── mockWatchQuery.ts │ │ │ │ ├── observableToPromise.ts │ │ │ │ ├── subscribeAndCount.ts │ │ │ │ ├── wait.ts │ │ │ │ ├── withConsoleSpy.ts │ │ │ │ └── wrap.ts │ │ │ ├── experimental │ │ │ │ ├── __tests__ │ │ │ │ │ └── createTestSchema.test.tsx │ │ │ │ ├── createSchemaFetch.ts │ │ │ │ ├── createTestSchema.ts │ │ │ │ ├── graphql-tools │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── utils.test.ts │ │ │ │ │ └── utils.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── internal │ │ │ │ ├── ObservableStream.ts │ │ │ │ ├── __tests__ │ │ │ │ │ └── ObservableStream.test.ts │ │ │ │ ├── disposables │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ ├── spyOnConsole.test.ts │ │ │ │ │ │ └── withCleanup.test.ts │ │ │ │ │ ├── disableActWarnings.ts │ │ │ │ │ ├── enableFakeTimers.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── spyOnConsole.ts │ │ │ │ │ └── withCleanup.ts │ │ │ │ ├── index.ts │ │ │ │ ├── renderHelpers.tsx │ │ │ │ └── scenarios │ │ │ │ │ └── index.ts │ │ │ ├── matchers │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.ts │ │ │ │ ├── toBeDisposed.ts │ │ │ │ ├── toBeGarbageCollected.ts │ │ │ │ ├── toHaveSuspenseCacheEntryUsing.ts │ │ │ │ └── toMatchDocument.ts │ │ │ └── react │ │ │ │ ├── MockedProvider.tsx │ │ │ │ └── __tests__ │ │ │ │ ├── MockedProvider.test.tsx │ │ │ │ ├── __snapshots__ │ │ │ │ └── MockedProvider.test.tsx.snap │ │ │ │ └── mockSubscriptionLink.test.tsx │ │ ├── tsconfig.json │ │ ├── utilities │ │ │ ├── caching │ │ │ │ ├── __tests__ │ │ │ │ │ ├── getMemoryInternals.ts │ │ │ │ │ └── sizes.test.ts │ │ │ │ ├── caches.ts │ │ │ │ ├── getMemoryInternals.ts │ │ │ │ ├── index.ts │ │ │ │ └── sizes.ts │ │ │ ├── common │ │ │ │ ├── __tests__ │ │ │ │ │ ├── canUse.ts │ │ │ │ │ ├── canonicalStringify.ts │ │ │ │ │ ├── cloneDeep.ts │ │ │ │ │ ├── compact.ts │ │ │ │ │ ├── maybeDeepFeeze.ts │ │ │ │ │ ├── mergeDeep.ts │ │ │ │ │ ├── omitDeep.ts │ │ │ │ │ └── stripTypename.ts │ │ │ │ ├── arrays.ts │ │ │ │ ├── canUse.ts │ │ │ │ ├── canonicalStringify.ts │ │ │ │ ├── cloneDeep.ts │ │ │ │ ├── compact.ts │ │ │ │ ├── errorHandling.ts │ │ │ │ ├── incrementalResult.ts │ │ │ │ ├── makeUniqueId.ts │ │ │ │ ├── maybeDeepFreeze.ts │ │ │ │ ├── mergeDeep.ts │ │ │ │ ├── mergeOptions.ts │ │ │ │ ├── objects.ts │ │ │ │ ├── omitDeep.ts │ │ │ │ ├── stringifyForDisplay.ts │ │ │ │ └── stripTypename.ts │ │ │ ├── globals │ │ │ │ ├── __tests__ │ │ │ │ │ └── invariantWrappers.test.ts │ │ │ │ ├── global.ts │ │ │ │ ├── index.ts │ │ │ │ ├── invariantWrappers.ts │ │ │ │ └── maybe.ts │ │ │ ├── graphql │ │ │ │ ├── DocumentTransform.ts │ │ │ │ ├── __tests__ │ │ │ │ │ ├── DocumentTransform.ts │ │ │ │ │ ├── directives.ts │ │ │ │ │ ├── fragments.ts │ │ │ │ │ ├── getFromAST.ts │ │ │ │ │ ├── storeUtils.ts │ │ │ │ │ └── transform.ts │ │ │ │ ├── directives.ts │ │ │ │ ├── fragments.ts │ │ │ │ ├── getFromAST.ts │ │ │ │ ├── operations.ts │ │ │ │ ├── print.ts │ │ │ │ ├── storeUtils.ts │ │ │ │ └── transform.ts │ │ │ ├── index.ts │ │ │ ├── observables │ │ │ │ ├── Concast.ts │ │ │ │ ├── Observable.ts │ │ │ │ ├── __tests__ │ │ │ │ │ ├── Concast.ts │ │ │ │ │ ├── Observable.ts │ │ │ │ │ ├── asyncMap.ts │ │ │ │ │ └── subclassing.ts │ │ │ │ ├── asyncMap.ts │ │ │ │ ├── iteration.ts │ │ │ │ └── subclassing.ts │ │ │ ├── policies │ │ │ │ ├── __tests__ │ │ │ │ │ └── relayStylePagination.test.ts │ │ │ │ └── pagination.ts │ │ │ ├── promises │ │ │ │ └── decoration.ts │ │ │ ├── subscriptions │ │ │ │ ├── relay │ │ │ │ │ └── index.ts │ │ │ │ ├── shared.ts │ │ │ │ └── urql │ │ │ │ │ └── index.ts │ │ │ └── types │ │ │ │ ├── DeepOmit.ts │ │ │ │ ├── DeepPartial.ts │ │ │ │ ├── IsStrictlyAny.ts │ │ │ │ ├── OnlyRequiredProperties.ts │ │ │ │ ├── Primitive.ts │ │ │ │ └── TODO.ts │ │ └── version.ts │ ├── tsconfig.json │ ├── tsconfig.tests.json │ └── tsdoc.json └── trpc │ ├── .dockerignore │ ├── .github │ ├── CODEOWNERS │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE │ │ ├── 1.bug_report.yml │ │ ├── 2.feature_request.yml │ │ ├── 3.docs.yml │ │ └── config.yml │ ├── labeler.yml │ ├── pull_request_template.md │ ├── renovate.json │ ├── setup │ │ └── action.yml │ └── workflows │ │ ├── codeql-analysis.yml │ │ ├── dependabot-approve.yml │ │ ├── labeler.yml │ │ ├── lint.yml │ │ ├── lock-issues.yml │ │ ├── main.yml │ │ ├── release-next.yml │ │ ├── release-tmp.yml │ │ ├── release.yml │ │ └── subtree.yml │ ├── .gitignore │ ├── .kodiak.toml │ ├── .npmrc │ ├── .nvmrc │ ├── .prettierignore │ ├── .tool-versions │ ├── .ts-prunerc │ ├── .vscode │ ├── extensions.json │ └── settings.json │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── SECURITY.md │ ├── codecov.yml │ ├── eslint.config.js │ ├── examples │ ├── .experimental │ │ └── next-app-dir │ │ │ ├── .env │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── next.config.ts │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── src │ │ │ ├── app │ │ │ │ ├── api │ │ │ │ │ ├── auth │ │ │ │ │ │ └── [...nextauth] │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ └── trpc │ │ │ │ │ │ ├── [trpc] │ │ │ │ │ │ └── route.ts │ │ │ │ │ │ └── revalidate │ │ │ │ │ │ └── route.ts │ │ │ │ ├── client │ │ │ │ │ ├── ClientGreeting.tsx │ │ │ │ │ └── page.tsx │ │ │ │ ├── layout.tsx │ │ │ │ ├── page.tsx │ │ │ │ ├── post-example │ │ │ │ │ └── page.tsx │ │ │ │ ├── posts │ │ │ │ │ ├── AddPostForm.tsx │ │ │ │ │ ├── [id] │ │ │ │ │ │ └── page.tsx │ │ │ │ │ ├── _data.schema.ts │ │ │ │ │ ├── _data.ts │ │ │ │ │ ├── _lib │ │ │ │ │ │ ├── Form.tsx │ │ │ │ │ │ ├── db.ts │ │ │ │ │ │ └── trpc.ts │ │ │ │ │ ├── layout.tsx │ │ │ │ │ └── page.tsx │ │ │ │ ├── rsc-links │ │ │ │ │ ├── ServerInvokedGreeting.tsx │ │ │ │ │ └── page.tsx │ │ │ │ ├── rsc-rq-prefetch │ │ │ │ │ ├── layout.tsx │ │ │ │ │ ├── page.tsx │ │ │ │ │ └── post.tsx │ │ │ │ └── server-action │ │ │ │ │ ├── FormWithUseActionExample.tsx │ │ │ │ │ ├── RawExample.tsx │ │ │ │ │ ├── RawFormExample.tsx │ │ │ │ │ ├── ReactHookFormExample.action.tsx │ │ │ │ │ ├── ReactHookFormExample.schema.tsx │ │ │ │ │ ├── ReactHookFormExample.tsx │ │ │ │ │ ├── ReactHookFormFactoryExample.lib.tsx │ │ │ │ │ ├── ReactHookFormFactoryExample.tsx │ │ │ │ │ ├── UseActionExample.tsx │ │ │ │ │ ├── _actions.tsx │ │ │ │ │ └── page.tsx │ │ │ ├── auth.ts │ │ │ ├── server │ │ │ │ ├── context.ts │ │ │ │ ├── routers │ │ │ │ │ └── _app.ts │ │ │ │ └── trpc.ts │ │ │ └── trpc │ │ │ │ ├── client.ts │ │ │ │ ├── package.json │ │ │ │ ├── rq-client.tsx │ │ │ │ ├── rq-server.ts │ │ │ │ ├── server-invoker.ts │ │ │ │ └── shared.ts │ │ │ ├── test │ │ │ ├── client.test.ts │ │ │ └── server-cache.test.ts │ │ │ └── tsconfig.json │ ├── .railway │ │ ├── next-prisma-websockets-starter │ │ │ └── railway.json │ │ └── next-sse-chat │ │ │ ├── Dockerfile │ │ │ └── railway.json │ ├── .test │ │ ├── diagnostics-big-router │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── next-env.d.ts │ │ │ ├── next.config.ts │ │ │ ├── package.json │ │ │ ├── scripts │ │ │ │ ├── codegen-base.ts │ │ │ │ └── codegen.ts │ │ │ ├── src │ │ │ │ ├── server │ │ │ │ │ ├── context.ts │ │ │ │ │ └── trpc.ts │ │ │ │ └── utils │ │ │ │ │ └── trpc.ts │ │ │ └── tsconfig.json │ │ ├── internal-types-export │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── client.ts │ │ │ │ └── server.ts │ │ │ └── tsconfig.json │ │ ├── ssg-infinite-serialization │ │ │ ├── README.md │ │ │ ├── next-env.d.ts │ │ │ ├── next.config.ts │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── src │ │ │ │ ├── pages │ │ │ │ │ ├── _app.tsx │ │ │ │ │ ├── api │ │ │ │ │ │ └── trpc │ │ │ │ │ │ │ └── [trpc].ts │ │ │ │ │ └── index.tsx │ │ │ │ ├── server │ │ │ │ │ ├── routers │ │ │ │ │ │ └── _app.ts │ │ │ │ │ └── trpc.ts │ │ │ │ └── utils │ │ │ │ │ └── trpc.ts │ │ │ ├── test │ │ │ │ └── smoke.test.ts │ │ │ └── tsconfig.json │ │ └── ssg │ │ │ ├── README.md │ │ │ ├── next-env.d.ts │ │ │ ├── next.config.ts │ │ │ ├── package.json │ │ │ ├── playwright.config.ts │ │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── _app.tsx │ │ │ │ ├── api │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc].ts │ │ │ │ └── index.tsx │ │ │ ├── server │ │ │ │ ├── routers │ │ │ │ │ └── _app.ts │ │ │ │ └── trpc.ts │ │ │ └── utils │ │ │ │ └── trpc.ts │ │ │ ├── test │ │ │ └── smoke.test.ts │ │ │ └── tsconfig.json │ ├── bun │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── client.ts │ │ │ ├── index.ts │ │ │ └── router.ts │ │ └── tsconfig.json │ ├── cloudflare-workers │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── client.ts │ │ │ ├── index.ts │ │ │ └── router.ts │ │ ├── tsconfig.json │ │ └── wrangler.toml │ ├── deno-deploy │ │ ├── README.md │ │ ├── deno.json │ │ └── src │ │ │ ├── client.ts │ │ │ ├── index.ts │ │ │ └── router.ts │ ├── express-minimal │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── client.ts │ │ │ ├── router.ts │ │ │ └── server.ts │ │ └── tsconfig.json │ ├── express-server │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── client.ts │ │ │ └── server.ts │ │ └── tsconfig.json │ ├── fastify-server │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── sandbox.config.json │ │ ├── src │ │ │ ├── client │ │ │ │ ├── index.ts │ │ │ │ └── polyfill.ts │ │ │ ├── config.ts │ │ │ └── server │ │ │ │ ├── index.ts │ │ │ │ ├── router │ │ │ │ ├── context.ts │ │ │ │ ├── index.ts │ │ │ │ ├── routers │ │ │ │ │ ├── api.ts │ │ │ │ │ ├── posts.ts │ │ │ │ │ └── sub.ts │ │ │ │ └── trpc.ts │ │ │ │ └── server.ts │ │ └── tsconfig.json │ ├── kitchen-sink │ │ └── README.md │ ├── lambda-api-gateway │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── serverless.yml │ │ ├── src │ │ │ ├── client.ts │ │ │ ├── payloadFormatVersionClient.ts │ │ │ └── server.ts │ │ └── tsconfig.json │ ├── minimal-content-types │ │ ├── README.md │ │ ├── client │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── App.tsx │ │ │ │ ├── SendFileButton.tsx │ │ │ │ ├── SendMultipartFormDataButton.tsx │ │ │ │ ├── main.tsx │ │ │ │ ├── utils │ │ │ │ │ └── trpc.ts │ │ │ │ └── vite-env.d.ts │ │ │ ├── tsconfig.json │ │ │ └── vite.config.ts │ │ ├── package.json │ │ ├── playwright.config.ts │ │ ├── server │ │ │ ├── index.ts │ │ │ ├── package.json │ │ │ └── tsconfig.json │ │ └── test │ │ │ └── smoke.test.ts │ ├── minimal-react │ │ ├── README.md │ │ ├── client │ │ │ ├── .gitignore │ │ │ ├── index.html │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── App.tsx │ │ │ │ ├── Greeting.tsx │ │ │ │ ├── main.tsx │ │ │ │ ├── utils │ │ │ │ │ └── trpc.ts │ │ │ │ └── vite-env.d.ts │ │ │ ├── tsconfig.json │ │ │ └── vite.config.ts │ │ ├── package.json │ │ ├── playwright.config.ts │ │ ├── server │ │ │ ├── index.ts │ │ │ ├── package.json │ │ │ └── tsconfig.json │ │ └── test │ │ │ └── smoke.test.ts │ ├── minimal │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── client │ │ │ │ └── index.ts │ │ │ └── server │ │ │ │ ├── db.ts │ │ │ │ ├── index.ts │ │ │ │ └── trpc.ts │ │ └── tsconfig.json │ ├── next-big-router │ │ ├── .gitignore │ │ ├── README.md │ │ ├── next-env.d.ts │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── scripts │ │ │ ├── codegen-base.ts │ │ │ └── codegen.ts │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── _app.tsx │ │ │ │ ├── api │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc].ts │ │ │ │ └── index.tsx │ │ │ ├── server │ │ │ │ ├── context.ts │ │ │ │ └── trpc.ts │ │ │ └── utils │ │ │ │ └── trpc.ts │ │ └── tsconfig.json │ ├── next-edge-runtime │ │ ├── README.md │ │ ├── next-env.d.ts │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── _app.tsx │ │ │ │ ├── api │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc].ts │ │ │ │ └── index.tsx │ │ │ ├── server │ │ │ │ └── trpc.ts │ │ │ └── utils │ │ │ │ └── trpc.ts │ │ └── tsconfig.json │ ├── next-formdata │ │ ├── .gitignore │ │ ├── README.md │ │ ├── next-env.d.ts │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── _app.tsx │ │ │ │ ├── api │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc].ts │ │ │ │ ├── index.tsx │ │ │ │ ├── react-hook-form.tsx │ │ │ │ └── vanilla.tsx │ │ │ ├── server │ │ │ │ ├── routers │ │ │ │ │ ├── room.ts │ │ │ │ │ └── viewer.ts │ │ │ │ └── trpc.ts │ │ │ └── utils │ │ │ │ ├── schemas.ts │ │ │ │ ├── trpc.ts │ │ │ │ └── writeFileToDisk.ts │ │ └── tsconfig.json │ ├── next-minimal-starter │ │ ├── README.md │ │ ├── next-env.d.ts │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── _app.tsx │ │ │ │ ├── api │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc].ts │ │ │ │ └── index.tsx │ │ │ ├── server │ │ │ │ └── trpc.ts │ │ │ └── utils │ │ │ │ └── trpc.ts │ │ └── tsconfig.json │ ├── next-prisma-starter │ │ ├── .env │ │ ├── .github │ │ │ ├── FUNDING.yml │ │ │ ├── dependabot.yml │ │ │ └── workflows │ │ │ │ └── main.yml │ │ ├── .gitignore │ │ ├── .npmrc │ │ ├── .vscode │ │ │ ├── extensions.json │ │ │ └── settings.json │ │ ├── README.md │ │ ├── eslint.config.mjs │ │ ├── next-env.d.ts │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── playwright.config.ts │ │ ├── playwright │ │ │ └── smoke.test.ts │ │ ├── postcss.config.js │ │ ├── prisma │ │ │ ├── migrations │ │ │ │ ├── 20211019164222_init │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20220307124425_non_unique_timestamps │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20220918091608_pagination │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20220918134120_revert │ │ │ │ │ └── migration.sql │ │ │ │ └── migration_lock.toml │ │ │ ├── schema.prisma │ │ │ └── seed.ts │ │ ├── public │ │ │ ├── favicon.ico │ │ │ └── vercel.svg │ │ ├── sandbox.config.json │ │ ├── src │ │ │ ├── components │ │ │ │ └── DefaultLayout.tsx │ │ │ ├── pages │ │ │ │ ├── 404.tsx │ │ │ │ ├── _app.tsx │ │ │ │ ├── api │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc].ts │ │ │ │ ├── index.tsx │ │ │ │ └── post │ │ │ │ │ └── [id].tsx │ │ │ ├── server │ │ │ │ ├── context.ts │ │ │ │ ├── env.ts │ │ │ │ ├── prisma.ts │ │ │ │ ├── routers │ │ │ │ │ ├── _app.ts │ │ │ │ │ ├── post.test.ts │ │ │ │ │ └── post.ts │ │ │ │ └── trpc.ts │ │ │ ├── styles │ │ │ │ └── globals.css │ │ │ └── utils │ │ │ │ ├── transformer.ts │ │ │ │ └── trpc.ts │ │ ├── tailwind.config.ts │ │ ├── tsconfig.json │ │ └── vitest.config.ts │ ├── next-prisma-todomvc │ │ ├── .env │ │ ├── .gitignore │ │ ├── README.md │ │ ├── next-i18next.config.js │ │ ├── next.config.js │ │ ├── package.json │ │ ├── playwright.config.ts │ │ ├── prisma │ │ │ ├── migrations │ │ │ │ ├── 20210304121245_ │ │ │ │ │ └── migration.sql │ │ │ │ └── migration_lock.toml │ │ │ └── schema.prisma │ │ ├── public │ │ │ ├── favicon.ico │ │ │ └── locales │ │ │ │ ├── en │ │ │ │ └── common.json │ │ │ │ └── sv │ │ │ │ └── common.json │ │ ├── src │ │ │ ├── components │ │ │ │ └── footer.tsx │ │ │ ├── pages │ │ │ │ ├── [filter].tsx │ │ │ │ ├── _app.tsx │ │ │ │ └── api │ │ │ │ │ └── trpc │ │ │ │ │ └── [trpc].ts │ │ │ ├── server │ │ │ │ ├── context.ts │ │ │ │ ├── prisma.ts │ │ │ │ ├── routers │ │ │ │ │ ├── _app.ts │ │ │ │ │ └── todo.ts │ │ │ │ ├── ssg-init.ts │ │ │ │ └── trpc.ts │ │ │ └── utils │ │ │ │ ├── trpc.ts │ │ │ │ ├── use-click-outside.tsx │ │ │ │ └── use-locale.tsx │ │ ├── test │ │ │ └── playwright.test.ts │ │ ├── tsconfig.json │ │ └── vercel.json │ ├── next-prisma-websockets-starter │ │ ├── .env │ │ ├── .github │ │ │ ├── FUNDING.yml │ │ │ ├── dependabot.yml │ │ │ └── workflows │ │ │ │ ├── codeql-analysis.yml │ │ │ │ └── main.yml │ │ ├── .gitignore │ │ ├── .npmrc │ │ ├── .vscode │ │ │ ├── extensions.json │ │ │ └── settings.json │ │ ├── README.md │ │ ├── docker-compose.yaml │ │ ├── eslint.config.mjs │ │ ├── next-env.d.ts │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── playwright.config.ts │ │ ├── postcss.config.js │ │ ├── prisma │ │ │ ├── migrations │ │ │ │ ├── 20210704013430_ │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20210704022645_name │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20210704022928_dates │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20210718182836_poster_source │ │ │ │ │ └── migration.sql │ │ │ │ ├── 20211027034151_ │ │ │ │ │ └── migration.sql │ │ │ │ └── migration_lock.toml │ │ │ ├── schema.prisma │ │ │ └── seed.ts │ │ ├── public │ │ │ ├── favicon.ico │ │ │ └── vercel.svg │ │ ├── sandbox.config.json │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── _app.tsx │ │ │ │ ├── about.tsx │ │ │ │ ├── api │ │ │ │ │ ├── auth │ │ │ │ │ │ └── [...nextauth].ts │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc].ts │ │ │ │ └── index.tsx │ │ │ ├── server │ │ │ │ ├── context.ts │ │ │ │ ├── prisma.ts │ │ │ │ ├── prodServer.ts │ │ │ │ ├── routers │ │ │ │ │ ├── _app.ts │ │ │ │ │ └── post.ts │ │ │ │ ├── trpc.ts │ │ │ │ └── wssDevServer.ts │ │ │ ├── styles │ │ │ │ └── global.css │ │ │ └── utils │ │ │ │ └── trpc.ts │ │ ├── tailwind.config.ts │ │ ├── test │ │ │ └── playwright.test.ts │ │ ├── tsconfig.json │ │ └── tsconfig.server.json │ ├── next-sse-chat │ │ ├── .env.example │ │ ├── .gitignore │ │ ├── README.md │ │ ├── docker-compose.yaml │ │ ├── drizzle.config.ts │ │ ├── next.config.ts │ │ ├── package.json │ │ ├── postcss.config.js │ │ ├── src │ │ │ ├── app │ │ │ │ ├── api │ │ │ │ │ ├── auth │ │ │ │ │ │ └── [...nextauth] │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ └── trpc │ │ │ │ │ │ └── [trpc] │ │ │ │ │ │ └── route.ts │ │ │ │ ├── channels │ │ │ │ │ ├── [channelId] │ │ │ │ │ │ ├── chat.tsx │ │ │ │ │ │ ├── hooks.ts │ │ │ │ │ │ ├── layout.tsx │ │ │ │ │ │ ├── page.tsx │ │ │ │ │ │ └── utils.ts │ │ │ │ │ └── create-channel.tsx │ │ │ │ ├── globals.css │ │ │ │ ├── layout.tsx │ │ │ │ ├── page.tsx │ │ │ │ └── providers.tsx │ │ │ ├── components │ │ │ │ ├── avatar.tsx │ │ │ │ ├── button.tsx │ │ │ │ ├── dialog.tsx │ │ │ │ └── input.tsx │ │ │ ├── lib │ │ │ │ ├── query-client.ts │ │ │ │ └── trpc.ts │ │ │ └── server │ │ │ │ ├── auth.tsx │ │ │ │ ├── context.ts │ │ │ │ ├── db │ │ │ │ ├── client.ts │ │ │ │ ├── migrations │ │ │ │ │ ├── 0000_lyrical_khan.sql │ │ │ │ │ ├── 0001_wet_tarantula.sql │ │ │ │ │ └── meta │ │ │ │ │ │ ├── 0000_snapshot.json │ │ │ │ │ │ ├── 0001_snapshot.json │ │ │ │ │ │ └── _journal.json │ │ │ │ └── schema.ts │ │ │ │ ├── routers │ │ │ │ ├── _app.ts │ │ │ │ ├── channel.ts │ │ │ │ └── post.ts │ │ │ │ └── trpc.ts │ │ ├── tailwind.config.ts │ │ └── tsconfig.json │ ├── soa │ │ ├── README.md │ │ ├── client │ │ │ ├── client.ts │ │ │ └── index.ts │ │ ├── faux-gateway │ │ │ └── index.ts │ │ ├── package.json │ │ ├── server-a │ │ │ ├── index.ts │ │ │ └── router.ts │ │ ├── server-b │ │ │ ├── index.ts │ │ │ └── router.ts │ │ ├── server-lib │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── standalone-server │ │ ├── README.md │ │ ├── package.json │ │ ├── sandbox.config.json │ │ ├── src │ │ │ ├── client.ts │ │ │ └── server.ts │ │ └── tsconfig.json │ ├── tanstack-start │ │ ├── README.md │ │ ├── app.config.ts │ │ ├── app │ │ │ ├── api.ts │ │ │ ├── app.css │ │ │ ├── client.tsx │ │ │ ├── components │ │ │ │ ├── DefaultCatchBoundary.tsx │ │ │ │ └── NotFound.tsx │ │ │ ├── routeTree.gen.ts │ │ │ ├── router.tsx │ │ │ ├── routes │ │ │ │ ├── __root.tsx │ │ │ │ ├── api │ │ │ │ │ └── trpc.$.ts │ │ │ │ ├── index.tsx │ │ │ │ ├── posts.$postId.tsx │ │ │ │ ├── posts.index.tsx │ │ │ │ ├── posts.tsx │ │ │ │ ├── posts_.$postId.deep.tsx │ │ │ │ └── redirect.tsx │ │ │ ├── ssr.tsx │ │ │ └── trpc │ │ │ │ ├── init.ts │ │ │ │ ├── react.tsx │ │ │ │ └── router.ts │ │ ├── eslint.config.js │ │ ├── package.json │ │ ├── playwright.config.ts │ │ ├── postcss.config.js │ │ ├── tailwind.config.ts │ │ ├── tests │ │ │ └── app.spec.ts │ │ └── tsconfig.json │ ├── trpc-chrome │ │ └── README.md │ ├── trpc-openapi │ │ └── README.md │ └── vercel-edge-runtime │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ ├── client.ts │ │ ├── index.ts │ │ └── router.ts │ │ └── tsconfig.json │ ├── lerna.json │ ├── package.json │ ├── packages │ ├── client │ │ ├── README.md │ │ ├── entrypoints.script.ts │ │ ├── package.json │ │ ├── rollup.config.ts │ │ ├── src │ │ │ ├── TRPCClientError.ts │ │ │ ├── createTRPCClient.ts │ │ │ ├── createTRPCUntypedClient.ts │ │ │ ├── getFetch.ts │ │ │ ├── index.ts │ │ │ ├── internals │ │ │ │ ├── TRPCUntypedClient.ts │ │ │ │ ├── dataLoader.ts │ │ │ │ ├── signals.ts │ │ │ │ ├── transformer.ts │ │ │ │ ├── types.test.ts │ │ │ │ └── types.ts │ │ │ ├── links.ts │ │ │ ├── links │ │ │ │ ├── HTTPBatchLinkOptions.ts │ │ │ │ ├── httpBatchLink.ts │ │ │ │ ├── httpBatchStreamLink.ts │ │ │ │ ├── httpLink.ts │ │ │ │ ├── httpSubscriptionLink.ts │ │ │ │ ├── internals │ │ │ │ │ ├── contentTypes.ts │ │ │ │ │ ├── createChain.test.ts │ │ │ │ │ ├── createChain.ts │ │ │ │ │ ├── dedupeLink.test.ts │ │ │ │ │ ├── dedupeLink.ts │ │ │ │ │ ├── httpUtils.ts │ │ │ │ │ ├── retryLink.ts │ │ │ │ │ ├── subscriptions.ts │ │ │ │ │ └── urlWithConnectionParams.ts │ │ │ │ ├── loggerLink.ts │ │ │ │ ├── splitLink.test.ts │ │ │ │ ├── splitLink.ts │ │ │ │ ├── types.ts │ │ │ │ └── wsLink.ts │ │ │ └── unstable-internals.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ ├── turbo.json │ │ └── vitest.config.ts │ ├── next │ │ ├── README.md │ │ ├── entrypoints.script.ts │ │ ├── package.json │ │ ├── rollup.config.ts │ │ ├── src │ │ │ ├── app-dir │ │ │ │ ├── client.test.tsx │ │ │ │ ├── client.ts │ │ │ │ ├── create-action-hook.tsx │ │ │ │ ├── links │ │ │ │ │ ├── nextCache.ts │ │ │ │ │ └── nextHttp.ts │ │ │ │ ├── server.ts │ │ │ │ ├── shared.ts │ │ │ │ └── types.ts │ │ │ ├── createTRPCNext.tsx │ │ │ ├── index.ts │ │ │ ├── ssrPrepass.ts │ │ │ └── withTRPC.tsx │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ ├── tsconfig.watch.json │ │ ├── turbo.json │ │ └── vitest.config.ts │ ├── react-query │ │ ├── README.md │ │ ├── entrypoints.script.ts │ │ ├── package.json │ │ ├── rollup.config.ts │ │ ├── src │ │ │ ├── createTRPCQueryUtils.tsx │ │ │ ├── createTRPCReact.tsx │ │ │ ├── index.ts │ │ │ ├── internals │ │ │ │ ├── context.tsx │ │ │ │ ├── getClientArgs.ts │ │ │ │ ├── getQueryKey.test.ts │ │ │ │ ├── getQueryKey.ts │ │ │ │ ├── trpcResult.ts │ │ │ │ └── useQueries.ts │ │ │ ├── rsc.tsx │ │ │ ├── server │ │ │ │ ├── index.ts │ │ │ │ └── ssgProxy.ts │ │ │ ├── shared │ │ │ │ ├── hooks │ │ │ │ │ ├── createHooksInternal.tsx │ │ │ │ │ ├── createRootHooks.tsx │ │ │ │ │ └── types.ts │ │ │ │ ├── index.ts │ │ │ │ ├── polymorphism │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── mutationLike.ts │ │ │ │ │ ├── queryLike.ts │ │ │ │ │ ├── routerLike.ts │ │ │ │ │ └── utilsLike.ts │ │ │ │ ├── proxy │ │ │ │ │ ├── decorationProxy.ts │ │ │ │ │ ├── useQueriesProxy.ts │ │ │ │ │ └── utilsProxy.ts │ │ │ │ ├── queryClient.ts │ │ │ │ └── types.ts │ │ │ └── utils │ │ │ │ ├── createUtilityFunctions.ts │ │ │ │ └── inferReactQueryProcedure.ts │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ ├── turbo.json │ │ └── vitest.config.ts │ ├── server │ │ ├── README.md │ │ ├── entrypoints.script.ts │ │ ├── package.json │ │ ├── rollup.config.ts │ │ ├── src │ │ │ ├── @trpc │ │ │ │ └── server │ │ │ │ │ ├── http.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── rpc.ts │ │ │ ├── adapters │ │ │ │ ├── aws-lambda │ │ │ │ │ ├── getPlanner.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── express.ts │ │ │ │ ├── fastify │ │ │ │ │ ├── fastifyRequestHandler.ts │ │ │ │ │ ├── fastifyTRPCPlugin.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── fetch │ │ │ │ │ ├── fetchRequestHandler.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── types.ts │ │ │ │ ├── next-app-dir.test.ts │ │ │ │ ├── next-app-dir.ts │ │ │ │ ├── next-app-dir │ │ │ │ │ ├── nextAppDirCaller.ts │ │ │ │ │ ├── notFound.ts │ │ │ │ │ ├── redirect.ts │ │ │ │ │ └── rethrowNextErrors.ts │ │ │ │ ├── next.ts │ │ │ │ ├── node-http │ │ │ │ │ ├── incomingMessageToRequest.test.ts │ │ │ │ │ ├── incomingMessageToRequest.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── nodeHTTPRequestHandler.ts │ │ │ │ │ └── types.ts │ │ │ │ ├── standalone.ts │ │ │ │ └── ws.ts │ │ │ ├── http.ts │ │ │ ├── index.ts │ │ │ ├── observable │ │ │ │ ├── behaviorSubject.test.ts │ │ │ │ ├── behaviorSubject.ts │ │ │ │ ├── index.ts │ │ │ │ ├── observable.test.ts │ │ │ │ ├── observable.ts │ │ │ │ ├── operators.test.ts │ │ │ │ ├── operators.ts │ │ │ │ └── types.ts │ │ │ ├── rpc.ts │ │ │ ├── shared.ts │ │ │ ├── unstable-core-do-not-import.ts │ │ │ ├── unstable-core-do-not-import │ │ │ │ ├── clientish │ │ │ │ │ ├── inference.test.ts │ │ │ │ │ ├── inference.ts │ │ │ │ │ ├── inferrable.ts │ │ │ │ │ └── serialize.ts │ │ │ │ ├── createProxy.test.ts │ │ │ │ ├── createProxy.ts │ │ │ │ ├── error │ │ │ │ │ ├── TRPCError.ts │ │ │ │ │ ├── formatter.ts │ │ │ │ │ └── getErrorShape.ts │ │ │ │ ├── http │ │ │ │ │ ├── batchStreamFormatter.test.ts │ │ │ │ │ ├── batchStreamFormatter.ts │ │ │ │ │ ├── contentType.ts │ │ │ │ │ ├── contentTypeParsers.ts │ │ │ │ │ ├── formDataToObject.test.ts │ │ │ │ │ ├── formDataToObject.ts │ │ │ │ │ ├── getHTTPStatusCode.ts │ │ │ │ │ ├── parseConnectionParams.ts │ │ │ │ │ ├── resolveResponse.ts │ │ │ │ │ ├── toURL.ts │ │ │ │ │ └── types.ts │ │ │ │ ├── initTRPC.test.ts │ │ │ │ ├── initTRPC.ts │ │ │ │ ├── middleware.ts │ │ │ │ ├── parser.ts │ │ │ │ ├── procedure.ts │ │ │ │ ├── procedureBuilder.test.ts │ │ │ │ ├── procedureBuilder.ts │ │ │ │ ├── rootConfig.ts │ │ │ │ ├── router.mergeRouters.test.ts │ │ │ │ ├── router.test.ts │ │ │ │ ├── router.ts │ │ │ │ ├── rpc │ │ │ │ │ ├── codes.ts │ │ │ │ │ ├── envelopes.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── parseTRPCMessage.ts │ │ │ │ ├── stream │ │ │ │ │ ├── jsonl.test.ts │ │ │ │ │ ├── jsonl.ts │ │ │ │ │ ├── sse.test.ts │ │ │ │ │ ├── sse.ts │ │ │ │ │ ├── sse.types.ts │ │ │ │ │ ├── tracked.ts │ │ │ │ │ └── utils │ │ │ │ │ │ ├── asyncIterable.ts │ │ │ │ │ │ ├── createDeferred.ts │ │ │ │ │ │ ├── createReadableStream.ts │ │ │ │ │ │ ├── createServer.ts │ │ │ │ │ │ ├── promiseTimer.ts │ │ │ │ │ │ └── withPing.ts │ │ │ │ ├── transformer.ts │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ └── vendor │ │ │ │ └── unpromise │ │ │ │ ├── ATTRIBUTION.txt │ │ │ │ ├── LICENSE │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ └── unpromise.ts │ │ ├── tsconfig.benchmark.json │ │ ├── tsconfig.build.json │ │ ├── tsconfig.json │ │ ├── turbo.json │ │ └── vitest.config.ts │ └── tests │ │ ├── README.md │ │ ├── package.json │ │ ├── server │ │ ├── TRPCError.test.ts │ │ ├── ___testHelpers.ts │ │ ├── __queryClient.ts │ │ ├── abortQuery.test.ts │ │ ├── adapters │ │ │ ├── __router.ts │ │ │ ├── awsLambda.test.tsx │ │ │ ├── express.test.tsx │ │ │ ├── fastify.test.ts │ │ │ ├── fetch.test.ts │ │ │ ├── lambda.utils.ts │ │ │ ├── next.test.ts │ │ │ └── standalone.test.ts │ │ ├── batching.test.ts │ │ ├── callRouter.test.ts │ │ ├── caller.test.ts │ │ ├── children.test.ts │ │ ├── clientInternals.test.ts │ │ ├── createCaller.test.ts │ │ ├── createClient.test.ts │ │ ├── createUntypedClient.test.ts │ │ ├── dataloader.test.ts │ │ ├── errorFormatting.test.ts │ │ ├── errors.test.ts │ │ ├── getRawInput.test.ts │ │ ├── getUntypedClient.test.ts │ │ ├── headers.test.tsx │ │ ├── httpSubscriptionLink.headers.retryLink.test.ts │ │ ├── httpSubscriptionLink.memory.test.ts │ │ ├── httpSubscriptionLink.test.ts │ │ ├── index.test.ts │ │ ├── inferenceHelpers.test.ts │ │ ├── input.test.ts │ │ ├── isDev.test.ts │ │ ├── jsonify.test.ts │ │ ├── links.test.ts │ │ ├── meta.test.ts │ │ ├── methodOverride.test.ts │ │ ├── middlewares.test.ts │ │ ├── outputParser.test.ts │ │ ├── rawFetch.test.tsx │ │ ├── react │ │ │ ├── __reactHelpers.tsx │ │ │ ├── __testHelpers.tsx │ │ │ ├── abortOnUnmount.test.tsx │ │ │ ├── bigBoi.test.tsx │ │ │ ├── createClient.test.tsx │ │ │ ├── createQueryUtils.test.ts │ │ │ ├── dehydrate.test.tsx │ │ │ ├── ensureQueryData.test.tsx │ │ │ ├── errors.test.tsx │ │ │ ├── formData.test.tsx │ │ │ ├── formatError.test.tsx │ │ │ ├── getQueryKey.test.tsx │ │ │ ├── invalidateQueries.test.tsx │ │ │ ├── invalidateRouters.test.tsx │ │ │ ├── multiple-trpc-providers.test.tsx │ │ │ ├── mutationkey.test.tsx │ │ │ ├── octetStreams.test.tsx │ │ │ ├── offline.test.tsx │ │ │ ├── overrides.test.tsx │ │ │ ├── polymorphism.common.tsx │ │ │ ├── polymorphism.factory.tsx │ │ │ ├── polymorphism.subtyped-factory.tsx │ │ │ ├── polymorphism.test.tsx │ │ │ ├── prefetchQuery.test.tsx │ │ │ ├── queryClientDefaults.test.tsx │ │ │ ├── queryOptions.test.tsx │ │ │ ├── regression │ │ │ │ ├── issue-1645-setErrorStatusSSR.test.tsx │ │ │ │ ├── issue-3461-reserved-properties.test.tsx │ │ │ │ ├── issue-4486-initialData-types.test.tsx │ │ │ │ ├── issue-4519-invalid-select-as-transform.test.tsx │ │ │ │ └── issue-5808-proxy-in-dep-array.test.tsx │ │ │ ├── rsc-prefetch.test.tsx │ │ │ ├── setInfiniteQueryData.test.tsx │ │ │ ├── setQueriesData.test.tsx │ │ │ ├── setQueryData.test.tsx │ │ │ ├── ssg.test.ts │ │ │ ├── ssgExternal.test.ts │ │ │ ├── trpc-options.test.tsx │ │ │ ├── useInfiniteQuery.test.tsx │ │ │ ├── useMutation.test.tsx │ │ │ ├── useQueries.test.tsx │ │ │ ├── useQuery.test.tsx │ │ │ ├── useSubscription.test.tsx │ │ │ ├── useSuspenseInfiniteQuery.test.tsx │ │ │ ├── useSuspenseQueries.test.tsx │ │ │ ├── useSuspenseQuery.test.tsx │ │ │ ├── useUtils.test.tsx │ │ │ └── withTRPC.test.tsx │ │ ├── regression │ │ │ ├── issue-2506-headers-throwing.test.ts │ │ │ ├── issue-2540-undefined-mutation.test.ts │ │ │ ├── issue-2842-createSSGHelpers-promise.test.ts │ │ │ ├── issue-2856-middleware-infer.test.ts │ │ │ ├── issue-2942-useInfiniteQuery-setData.test.tsx │ │ │ ├── issue-2996-defined-data.test.tsx │ │ │ ├── issue-3085-bad-responses.test.ts │ │ │ ├── issue-3351-TRPCError.test.ts │ │ │ ├── issue-3359-http-status-413-payload-too-large.test.ts │ │ │ ├── issue-3453-meta-interface.test.ts │ │ │ ├── issue-3455-56-invalidate-queries.test.tsx │ │ │ ├── issue-4049-stripped-undefined.test.tsx │ │ │ ├── issue-4130-ssr-different-transformers.test.tsx │ │ │ ├── issue-4217-throw-non-errors.test.ts │ │ │ ├── issue-4321-context-union-inference.test.ts │ │ │ ├── issue-4360-useInfiniteQuery-placeHolderData.test.tsx │ │ │ ├── issue-4527-nested-middleware-root-context.test.ts │ │ │ ├── issue-4645-inferProcedureOutput.test.ts │ │ │ ├── issue-4673-url-encoded-batching.test.ts │ │ │ ├── issue-4783-charset.test.ts │ │ │ ├── issue-4794-error-bad-access.test.ts │ │ │ ├── issue-4947-merged-middleware-inputs.test.ts │ │ │ ├── issue-4985-serialize-type.test.ts │ │ │ ├── issue-5020-inference-middleware.test.ts │ │ │ ├── issue-5034-input-with-index-signature.test.ts │ │ │ ├── issue-5037-context-inference.test.ts │ │ │ ├── issue-5056-input-parser-standalone-mw-inference.test.ts │ │ │ ├── issue-5075-complex-zod-serialized-inference.test.ts │ │ │ ├── issue-5197-output-with-index-signature-and-record.test.ts │ │ │ ├── issue-5297-description-key-on-input-turns-to-void.test.ts │ │ │ ├── issue-5357-input-always-required.test.tsx │ │ │ ├── issue-5945-stream-null.test.ts │ │ │ └── serializable-inference.test.tsx │ │ ├── responseMeta.test.ts │ │ ├── routerMeta.test.ts │ │ ├── smoke.test.ts │ │ ├── streaming.test.ts │ │ ├── transformer.test.ts │ │ ├── validators.test.ts │ │ ├── websockets.memory.test.ts │ │ ├── websockets.test.ts │ │ └── zAsyncGenerator.ts │ │ ├── setupTests.ts │ │ ├── showcase │ │ ├── dataloader.test.ts │ │ ├── tinyrpc.test.ts │ │ └── tinyrpc.ts │ │ ├── tsconfig.json │ │ └── vitest.config.ts │ ├── pnpm-lock.yaml │ ├── pnpm-workspace.yaml │ ├── prettier.config.js │ ├── scripts │ ├── analyzeSizeChange.ts │ ├── entrypoints.ts │ ├── generateBigBoi.ts │ ├── getRollupConfig.ts │ └── version.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── turbo.json │ ├── vitest.config.ts │ ├── vitest.workspace.json │ └── www │ ├── .gitignore │ ├── .npmrc │ ├── README.md │ ├── babel.config.js │ ├── blog │ ├── 2021-05-05-hello-world.mdx │ ├── 2022-11-21-announcing-trpc-10.mdx │ ├── 2023-01-14-typescript-performance-lessons.mdx │ ├── 2023-01-17-tinyrpc-client.mdx │ ├── 2024-05-23-trpc-actions.mdx │ └── authors.yml │ ├── docs │ ├── .gitignore │ ├── client │ │ ├── cors.md │ │ ├── headers.md │ │ ├── links │ │ │ ├── httpBatchLink.md │ │ │ ├── httpBatchStreamLink.md │ │ │ ├── httpLink.md │ │ │ ├── httpSubscriptionLink.md │ │ │ ├── loggerLink.md │ │ │ ├── overview.md │ │ │ ├── retryLink.md │ │ │ ├── splitLink.mdx │ │ │ └── wsLink.md │ │ ├── nextjs │ │ │ ├── aborting-procedures.md │ │ │ ├── introduction.mdx │ │ │ ├── server-side-helpers.md │ │ │ ├── setup.mdx │ │ │ ├── ssg.md │ │ │ ├── ssr.md │ │ │ └── starter-projects.md │ │ ├── overview.md │ │ ├── react │ │ │ ├── aborting-procedures.md │ │ │ ├── createTRPCQueryUtils.md │ │ │ ├── disabling-queries.md │ │ │ ├── getQueryKey.md │ │ │ ├── infer-types.md │ │ │ ├── introduction.mdx │ │ │ ├── server-components.mdx │ │ │ ├── setup.mdx │ │ │ ├── suspense.md │ │ │ ├── useInfiniteQuery.md │ │ │ ├── useMutation.md │ │ │ ├── useQueries.md │ │ │ ├── useQuery.md │ │ │ ├── useSubscription.md │ │ │ └── useUtils.mdx │ │ └── vanilla │ │ │ ├── aborting-procedures.md │ │ │ ├── infer-types.md │ │ │ ├── introduction.md │ │ │ └── setup.mdx │ ├── community │ │ ├── awesome-trpc.mdx │ │ ├── contributing.mdx │ │ ├── love.mdx │ │ └── sponsors.mdx │ ├── further │ │ ├── faq.mdx │ │ ├── further-reading.md │ │ └── rpc.md │ ├── landing-intro │ │ ├── Step1.md │ │ ├── Step2.md │ │ └── Step3.md │ ├── main │ │ ├── concepts.mdx │ │ ├── example-apps.mdx │ │ ├── getting-started.mdx │ │ ├── introduction.mdx │ │ ├── quickstart.mdx │ │ └── videos-and-community-resources.mdx │ ├── migration │ │ └── migrate-from-v10-to-v11.mdx │ ├── partials │ │ └── _import-approuter.mdx │ └── server │ │ ├── adapters-intro.md │ │ ├── adapters │ │ ├── aws-lambda.md │ │ ├── express.md │ │ ├── fastify.md │ │ ├── fetch.mdx │ │ ├── nextjs.md │ │ └── standalone.md │ │ ├── authorization.md │ │ ├── caching.md │ │ ├── context.md │ │ ├── data-transformers.md │ │ ├── error-formatting.md │ │ ├── error-handling.md │ │ ├── merging-routers.md │ │ ├── metadata.md │ │ ├── middlewares.md │ │ ├── procedures.md │ │ ├── routers.md │ │ ├── server-side-calls.md │ │ ├── subscriptions.md │ │ ├── validators.md │ │ └── websockets.md │ ├── docusaurus.config.js │ ├── docusaurus.preferredTheme.js │ ├── docusaurus.twitterReload.js │ ├── docusaurus.typedoc.js │ ├── global.d.ts │ ├── mdxToJsx.js │ ├── min-light-with-diff.json │ ├── og-image │ ├── .gitignore │ ├── README.md │ ├── next-env.d.ts │ ├── next.config.js │ ├── package.json │ ├── pages │ │ ├── api │ │ │ ├── _ref │ │ │ │ ├── dynamic-image.tsx │ │ │ │ ├── emoji.tsx │ │ │ │ ├── image-svg.tsx │ │ │ │ ├── language.tsx │ │ │ │ ├── param.tsx │ │ │ │ ├── static.tsx │ │ │ │ ├── tailwind.tsx │ │ │ │ └── vercel.tsx │ │ │ ├── blog.tsx │ │ │ ├── docs.tsx │ │ │ ├── font.ts │ │ │ └── landing.tsx │ │ └── index.tsx │ ├── public │ │ ├── favicon.ico │ │ └── pattern.svg │ ├── tsconfig.json │ └── utils │ │ ├── env.js │ │ ├── fetchFont.ts │ │ └── zodParams.ts │ ├── package.json │ ├── shikiTwoslash.config.js │ ├── sidebars.js │ ├── src │ ├── animations │ │ └── popIn.ts │ ├── components │ │ ├── ArticleCard.tsx │ │ ├── Button.tsx │ │ ├── CompaniesUsing.script.ts │ │ ├── CompaniesUsing.tsx │ │ ├── ConceptsChart.tsx │ │ ├── Features.tsx │ │ ├── GithubSponsorButton.tsx │ │ ├── GithubStarsButton.tsx │ │ ├── Iframe.tsx │ │ ├── InstallSnippet.tsx │ │ ├── Preview.tsx │ │ ├── QuickIntro.tsx │ │ ├── SectionTitle.tsx │ │ ├── TwitterWall │ │ │ ├── index.tsx │ │ │ ├── script.output.ts │ │ │ ├── script.ts │ │ │ └── tweetsOld.ts │ │ ├── YouTubeEmbed.tsx │ │ └── sponsors │ │ │ ├── .gitignore │ │ │ ├── SponsorBubbles.jsx │ │ │ ├── TopSponsors.tsx │ │ │ ├── script.output.ts │ │ │ ├── script.pull.ts │ │ │ ├── script.push.ts │ │ │ └── script.types.ts │ ├── css │ │ └── custom.css │ ├── pages │ │ ├── index.tsx │ │ ├── media.tsx │ │ └── pricing.tsx │ ├── theme │ │ ├── BlogPostPage │ │ │ └── Metadata │ │ │ │ └── index.tsx │ │ ├── CodeBlock │ │ │ ├── index.jsx │ │ │ └── styles.css │ │ ├── DocItem │ │ │ └── Metadata │ │ │ │ └── index.tsx │ │ ├── DocVersionBanner │ │ │ └── index.tsx │ │ └── Navbar │ │ │ └── Logo │ │ │ └── index.jsx │ └── utils │ │ ├── cn.ts │ │ ├── env.js │ │ ├── handleSmoothScrollToSection.ts │ │ ├── searchParams.ts │ │ └── useEnv.ts │ ├── static │ ├── .nojekyll │ ├── img │ │ ├── favicon.ico │ │ ├── links-diagram.svg │ │ ├── logo-text-black.svg │ │ ├── logo-text-white.svg │ │ ├── logo.svg │ │ ├── powered-by-vercel.svg │ │ └── split-link-diagram.svg │ └── logos │ │ ├── Algora.svg │ │ ├── Cal.com.svg │ │ ├── Documenso.png │ │ ├── Google.svg │ │ ├── Interval.svg │ │ ├── Netflix.svg │ │ ├── Newfront.svg │ │ ├── PayPal.svg │ │ ├── Ping.gg.svg │ │ └── Pleo.svg │ ├── tailwind.config.ts │ ├── tsconfig.json │ ├── types.d.ts │ ├── unversioned │ ├── _contributing.mdx │ ├── _love.mdx │ └── _sponsors.mdx │ ├── vercel.json │ ├── versioned_docs │ ├── version-10.x │ │ ├── .gitignore │ │ ├── client │ │ │ ├── cors.md │ │ │ ├── headers.md │ │ │ ├── links │ │ │ │ ├── httpBatchLink.md │ │ │ │ ├── httpBatchStreamLink.md │ │ │ │ ├── httpLink.md │ │ │ │ ├── loggerLink.md │ │ │ │ ├── overview.md │ │ │ │ ├── splitLink.mdx │ │ │ │ └── wsLink.md │ │ │ ├── nextjs │ │ │ │ ├── aborting-procedures.md │ │ │ │ ├── introduction.mdx │ │ │ │ ├── server-side-helpers.md │ │ │ │ ├── setup.mdx │ │ │ │ ├── ssg.md │ │ │ │ ├── ssr.md │ │ │ │ └── starter-projects.md │ │ │ ├── overview.md │ │ │ ├── react │ │ │ │ ├── aborting-procedures.md │ │ │ │ ├── getQueryKey.md │ │ │ │ ├── infer-types.md │ │ │ │ ├── introduction.mdx │ │ │ │ ├── setup.mdx │ │ │ │ ├── suspense.md │ │ │ │ ├── useInfiniteQuery.md │ │ │ │ ├── useMutation.md │ │ │ │ ├── useQueries.md │ │ │ │ ├── useQuery.md │ │ │ │ └── useUtils.mdx │ │ │ └── vanilla │ │ │ │ ├── aborting-procedures.md │ │ │ │ ├── infer-types.md │ │ │ │ ├── introduction.md │ │ │ │ └── setup.mdx │ │ ├── community │ │ │ ├── awesome-trpc.mdx │ │ │ ├── contributing.mdx │ │ │ ├── love.mdx │ │ │ └── sponsors.mdx │ │ ├── further │ │ │ ├── faq.mdx │ │ │ ├── further-reading.md │ │ │ ├── rpc.md │ │ │ └── subscriptions.md │ │ ├── landing-intro │ │ │ ├── Step1.md │ │ │ ├── Step2.md │ │ │ └── Step3.md │ │ ├── main │ │ │ ├── concepts.mdx │ │ │ ├── example-apps.mdx │ │ │ ├── getting-started.mdx │ │ │ ├── introduction.mdx │ │ │ ├── quickstart.mdx │ │ │ └── videos-and-community-resources.mdx │ │ ├── migration │ │ │ └── migrate-from-v9-to-v10.mdx │ │ ├── partials │ │ │ └── _import-approuter.mdx │ │ └── server │ │ │ ├── adapters-intro.md │ │ │ ├── adapters │ │ │ ├── aws-lambda.md │ │ │ ├── express.md │ │ │ ├── fastify.md │ │ │ ├── fetch.mdx │ │ │ ├── nextjs.md │ │ │ └── standalone.md │ │ │ ├── authorization.md │ │ │ ├── caching.md │ │ │ ├── context.md │ │ │ ├── data-transformers.md │ │ │ ├── error-formatting.md │ │ │ ├── error-handling.md │ │ │ ├── merging-routers.md │ │ │ ├── metadata.md │ │ │ ├── middlewares.md │ │ │ ├── procedures.md │ │ │ ├── routers.md │ │ │ ├── server-side-calls.md │ │ │ └── validators.md │ └── version-9.x │ │ ├── client │ │ ├── cors.md │ │ ├── header.md │ │ ├── links.md │ │ └── vanilla.md │ │ ├── further │ │ ├── further-reading.md │ │ ├── rpc.md │ │ └── subscriptions.md │ │ ├── main │ │ ├── awesome-trpc.mdx │ │ ├── contributing.mdx │ │ ├── example-apps.md │ │ ├── introduction.mdx │ │ ├── love.mdx │ │ ├── quickstart.mdx │ │ └── sponsors.mdx │ │ ├── nextjs │ │ ├── introduction.md │ │ ├── ssg-helpers.md │ │ ├── ssg.md │ │ ├── ssr.md │ │ └── starter-projects.md │ │ ├── reactjs │ │ ├── introduction.md │ │ ├── invalidateQueries.md │ │ ├── useInfiniteQuery.md │ │ ├── useMutation.md │ │ └── useQuery.md │ │ └── server │ │ ├── authorization.md │ │ ├── aws-lambda.md │ │ ├── caching.md │ │ ├── context.md │ │ ├── data-transformers.md │ │ ├── error-formatting.md │ │ ├── error-handling.md │ │ ├── express.md │ │ ├── fastify.md │ │ ├── infer-types.md │ │ ├── merging-routers.md │ │ ├── metadata.md │ │ ├── middlewares.md │ │ ├── output-validation.md │ │ └── router.md │ ├── versioned_sidebars │ ├── version-10.x-sidebars.json │ └── version-9.x-sidebars.json │ └── versions.json ├── package-lock.json ├── package.json └── vitest.workspace.ts /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | *.temp.json -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Build Chapter 2 HTML DOM Example", 6 | "type": "typescript", 7 | "tsconfig": "chapters/chapter-2_Core_Principles_and_use_cases/src/DOM/tsconfig.json", // Adjust path if needed 8 | "problemMatcher": "$tsc" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter01_Getting_Started_With_Typescript_5/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/degToRad.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var degToRad = function (degree) { return (degree * Math.PI) / 180; }; 4 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/interfaces.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/isArray.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function isArray(arg) { 4 | // Unknown argument, return narrowed type 5 | return Array.isArray(arg); 6 | } 7 | var myList = { item1: "apple", item2: "orange" }; 8 | console.log(isArray(myList)); 9 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/isObject.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.isObject = void 0; 4 | var isObject = function (value) { 5 | // Type guard using type assertion 6 | return typeof value === "object" && value !== null && !Array.isArray(value); 7 | }; 8 | exports.isObject = isObject; 9 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/javascript-vs-typescript.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // @ts-ignore 4 | function calculateArea(length, width) { 5 | return length * width; 6 | } 7 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/mul.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function mul(a, b) { 4 | return a * b; 5 | } 6 | exports.default = mul; 7 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/noUnusedLocals.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function greet() { 4 | var name = "Alice"; // Used 5 | var message; // Unused (error with noUnusedLocals) 6 | message = "Hello, " + name + "!"; 7 | return message; 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/refactoring.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function find(arr, predicate) { 4 | for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) { 5 | var item = arr_1[_i]; 6 | if (predicate(item)) { 7 | return item; 8 | } 9 | } 10 | return undefined; 11 | } 12 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/typeInference.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var numbers = []; 4 | numbers.push(1); 5 | numbers.push("two"); 6 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/dist/types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var user = { 4 | name: "Theo", 5 | age: 20, 6 | }; 7 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/aggregations.ts: -------------------------------------------------------------------------------- 1 | class QueryBuilder {} 2 | 3 | class EmptyQueryBuilder extends QueryBuilder {} 4 | 5 | interface SearchParams { 6 | qb?: QueryBuilder 7 | 8 | path: string 9 | } 10 | 11 | class SearchService { 12 | queryBuilder?: QueryBuilder 13 | 14 | path: string 15 | 16 | constructor({ qb = new EmptyQueryBuilder(), path }: SearchParams) { 17 | this.queryBuilder = qb 18 | 19 | this.path = path 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/associations.ts: -------------------------------------------------------------------------------- 1 | interface Id { 2 | id: T 3 | } 4 | class Author { 5 | constructor( 6 | private id: string, 7 | private name: string, 8 | ) {} 9 | } 10 | 11 | class Blog implements Id { 12 | id: string 13 | 14 | author: Author 15 | 16 | constructor(id: string, author: Author) { 17 | this.id = id 18 | 19 | this.author = author 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/degToRad.ts: -------------------------------------------------------------------------------- 1 | const degToRad = (degree: any): number => (degree * Math.PI) / 180 2 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/index.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/inheritance.ts: -------------------------------------------------------------------------------- 1 | class BaseClient { 2 | constructor(protected baseUrl: string) { 3 | this.baseUrl = baseUrl 4 | } 5 | 6 | protected getBaseUrl(): string { 7 | return this.baseUrl 8 | } 9 | } 10 | 11 | class UsersApiClient extends BaseClient { 12 | constructor(baseUrl: string) { 13 | super(baseUrl) 14 | } 15 | 16 | getUsers(): void { 17 | console.log(`Fetching users from ${this.getBaseUrl()}/users`) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/inputOutput.ts: -------------------------------------------------------------------------------- 1 | const stdin = process.stdin, 2 | stdout = process.stdout 3 | 4 | stdin.resume() 5 | stdin.setEncoding("utf8") 6 | const input: string[] = [] 7 | stdin.on("data", (data) => { 8 | input.push(data.toString()) 9 | }) 10 | 11 | stdin.on("end", () => { 12 | stdout.write(input.join("")) 13 | }) 14 | 15 | stdin.on("close", function () { 16 | process.exit(0) 17 | }) 18 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface Comparable { 2 | compareTo(other: Comparable): -1 | 0 | 1 3 | } 4 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/isArray.ts: -------------------------------------------------------------------------------- 1 | function isArray(arg: unknown): arg is readonly unknown[] { 2 | // Unknown argument, return narrowed type 3 | return Array.isArray(arg) 4 | } 5 | 6 | const myList = { item1: "apple", item2: "orange" } 7 | console.log(isArray(myList)) 8 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/isObject.js: -------------------------------------------------------------------------------- 1 | export const isObject = (o) => { 2 | return o === Object(o) && !Array.isArray(o) && typeof o !== "function" 3 | } 4 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/isObject.ts: -------------------------------------------------------------------------------- 1 | export const isObject = (value: unknown): value is object => { 2 | // Type guard using type assertion 3 | return typeof value === "object" && value !== null && !Array.isArray(value) 4 | } 5 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/javascript-vs-typescript.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | function calculateArea(length, width) { 3 | return length * width 4 | } 5 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/maybeNumber.ts: -------------------------------------------------------------------------------- 1 | // With strictNullChecks: error 2 | let maybeNumber: number | null = null 3 | // let value = maybeNumber * 10 4 | 5 | // Workaround: type guard or nullish coalescing operator 6 | let value2 7 | if (maybeNumber !== null) { 8 | value2 = maybeNumber * 10 9 | } else { 10 | value2 = 0 11 | } 12 | 13 | let value3 = maybeNumber ?? 0 14 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/mul.test.ts: -------------------------------------------------------------------------------- 1 | import mul from "./mul" 2 | import { test, expect } from "vitest" 3 | 4 | test("multiplies 2 and 3 to give 6", () => { 5 | expect(mul(2, 3)).toBe(6) 6 | }) 7 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/mul.ts: -------------------------------------------------------------------------------- 1 | function mul(a: number, b: number): number { 2 | return a * b 3 | } 4 | 5 | export default mul 6 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/noInfer.ts: -------------------------------------------------------------------------------- 1 | class Animal { 2 | sleep() {} 3 | } 4 | class Cat extends Animal { 5 | miaw() {} 6 | } 7 | 8 | // function petAnimal(value: T, getDefault: () => NoInfer): T { 9 | function petAnimal(value: T, getDefault: () => T): T { 10 | // ... function logic ... 11 | 12 | return value || getDefault() 13 | } 14 | 15 | // This would compile without errors 16 | petAnimal(new Cat(), () => new Animal()) 17 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/noUnusedLocals.ts: -------------------------------------------------------------------------------- 1 | function greet() { 2 | const name = "Alice" // Used 3 | let message // Unused (error with noUnusedLocals) 4 | message = "Hello, " + name + "!" 5 | return message 6 | } 7 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/refactoring.ts: -------------------------------------------------------------------------------- 1 | type Predicate = (item: T) => boolean 2 | 3 | function find(arr: T[], predicate: Predicate) { 4 | for (let item of arr) { 5 | if (predicate(item)) { 6 | return item 7 | } 8 | } 9 | 10 | return undefined 11 | } 12 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/shape.ts: -------------------------------------------------------------------------------- 1 | abstract class Shape { 2 | abstract getArea(): number 3 | 4 | constructor(public color: string) {} 5 | } 6 | 7 | class Square extends Shape { 8 | constructor( 9 | private sideLength: number, 10 | color: string, 11 | ) { 12 | super(color) 13 | 14 | this.sideLength = sideLength 15 | } 16 | 17 | getArea(): number { 18 | return this.sideLength * this.sideLength 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/typeInference.ts: -------------------------------------------------------------------------------- 1 | const numbers = [] 2 | numbers.push(1) 3 | numbers.push("two") 4 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/types.ts: -------------------------------------------------------------------------------- 1 | type A = "A" 2 | type B = "B" 3 | type C = A | B 4 | 5 | type User = { 6 | name: string 7 | } 8 | 9 | type ExtendedUser = User & { 10 | age: number 11 | } // ExtendedUser requires both name (from User) and age 12 | 13 | let user: ExtendedUser = { 14 | name: "Theo", 15 | age: 20, 16 | } 17 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/src/visibility.ts: -------------------------------------------------------------------------------- 1 | class SSHUser { 2 | constructor( 3 | private privateKey: string, 4 | 5 | public publicKey: string, 6 | ) { 7 | this.privateKey = privateKey 8 | 9 | this.publicKey = publicKey 10 | } 11 | 12 | public getBase64(): string { 13 | return Buffer.from(this.publicKey).toString("base64") 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /chapters/chapter01_Getting_Started_With_Typescript_5/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: {}, 5 | }) 6 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter02_Core_Principles_and_use_cases/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/dist/branded.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var data = { x: 1, y: 2, z: 3 }; 4 | function accept(p) { } 5 | accept(data); 6 | function accept2(p) { } 7 | // accept2(data) 8 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/dist/conditional.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/dist/infer.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/dist/keyof.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var updateEmailAction = { 4 | key: "email", // Autocomplete suggests all keys from SignupFormState 5 | value: "new_email@example.com", 6 | }; 7 | var updateNameAction = { 8 | key: "name", 9 | value: "John Doe", 10 | }; 11 | updateEmailAction.key; 12 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/dist/mapped.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var user1 = { name: "Alice" }; 4 | var user2 = { name: "Bob", avatar: "avatar.png" }; 5 | var product1 = { 6 | "product id": "123", 7 | "product price": "456", 8 | }; 9 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/dist/omit.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/dist/records.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function stats(data) { 4 | var stats = {}; 5 | data.forEach(function (item) { 6 | var name = item.name; 7 | stats[name] = { free: item.totalFree, used: item.totalUsed, size: item.totalSize }; 8 | }); 9 | return stats; 10 | } 11 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/DOM/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Document 5 | 6 | 7 |
8 | Typescript 5 Design Patterns 9 |
10 |

11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/DOM/index.ts: -------------------------------------------------------------------------------- 1 | const p = document.getElementsByClassName("paragraph")[0] 2 | 3 | const spanArea = document.createElement("span") 4 | 5 | spanArea.textContent = "This is a text we added dynamically" 6 | 7 | p?.appendChild(spanArea) 8 | 9 | const actionButton = document.querySelector("button") 10 | 11 | actionButton?.addEventListener("click", () => { 12 | window.alert("You Clicked the Submit Button") 13 | }) 14 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/bun/server.ts: -------------------------------------------------------------------------------- 1 | const server = Bun.serve({ 2 | port: 3000, 3 | fetch(request) { 4 | return new Response("Hello World!") 5 | }, 6 | }) 7 | 8 | console.log(`Listening on localhost:${server.port}`) 9 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/deno/server.ts: -------------------------------------------------------------------------------- 1 | const port = 8080 2 | 3 | const handler = async (req: Request) => { 4 | const body = "Hello, World!" 5 | return new Response(body, { status: 200 }) 6 | } 7 | 8 | Deno.serve({ port }, handler) 9 | 10 | console.log(`HTTP server listening on port ${port}`) 11 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/express/server.ts: -------------------------------------------------------------------------------- 1 | import express from "express" 2 | import { json } from "body-parser" 3 | 4 | const app = express() 5 | const port = process.env.PORT || 3000 6 | 7 | app.use(json()) 8 | 9 | app.get("/health", (req, res) => { 10 | res.send("OK!") 11 | }) 12 | 13 | app.listen(port, () => console.log(`Server listening on port ${port}`)) 14 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/infer.ts: -------------------------------------------------------------------------------- 1 | // Define a box type that can hold any type of value 2 | interface Box { 3 | value: T 4 | } 5 | 6 | // Define a type to unpack a box and reveal its value type 7 | type UnpackBox = A extends Box ? E : A 8 | 9 | // Example usage: 10 | type intStash = UnpackBox<{ value: 10 }> // type is number 11 | type stringStash = UnpackBox<{ value: "123" }> // type is string 12 | type booleanStash = UnpackBox // type is boolean 13 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/nest/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from "@nestjs/common" 2 | 3 | @Controller() 4 | export class AppController { 5 | @Get("/health") 6 | getHealth() { 7 | return "OK!" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/nest/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common" 2 | import { AppController } from "./app.controller" 3 | 4 | @Module({ 5 | imports: [], 6 | controllers: [AppController], 7 | }) 8 | export class AppModule {} 9 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/nest/main.ts: -------------------------------------------------------------------------------- 1 | import { ValidationPipe } from "@nestjs/common" 2 | import { NestFactory } from "@nestjs/core" 3 | import { AppModule } from "./app.module" 4 | 5 | async function bootstrap() { 6 | const app = await NestFactory.create(AppModule) 7 | app.useGlobalPipes(new ValidationPipe()) 8 | 9 | await app.listen(3000) 10 | console.log(`Application is running on: ${await app.getUrl()}`) 11 | } 12 | bootstrap() 13 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/omit.ts: -------------------------------------------------------------------------------- 1 | interface User { 2 | name: string 3 | email: string 4 | password: string 5 | confirmPassword: string 6 | bio?: string // Optional user bio 7 | location?: string // Optional user location 8 | } 9 | 10 | // Expected form data 11 | type UserInput = Pick 12 | // Excludes unnecessary properties 13 | type ProcessedUserData = Omit 14 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React + TS 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/src/App.tsx: -------------------------------------------------------------------------------- 1 | import "./App.css" 2 | import Greeting from "./components/Greetings" 3 | 4 | function App() { 5 | return ( 6 | <> 7 |
8 | 9 |
10 |

Vite + React + TypeScript

11 | 12 | ) 13 | } 14 | 15 | export default App 16 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/src/components/Button.tsx: -------------------------------------------------------------------------------- 1 | import { PropsWithChildren } from "react" 2 | 3 | export type ButtonProps = { 4 | onClick: (e: React.MouseEvent) => void 5 | } 6 | 7 | const Button: React.FC> = ({ children, onClick }) => { 8 | return 9 | } 10 | export default Button 11 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/src/components/Greetings.tsx: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | interface GreetingProps { 4 | name: string 5 | } 6 | 7 | const Greeting: React.FC = ({ name = "World" }) => { 8 | return

Hello, {name}!

9 | } 10 | 11 | export default Greeting 12 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/src/components/Greetings2.tsx: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | interface GreetingProps { 4 | name: string 5 | } 6 | 7 | const Greeting2 = (props: GreetingProps) => { 8 | const { name = "World" } = props // Destructuring for concise access 9 | return

Hello, {name}!

10 | } 11 | 12 | export default Greeting2 13 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom/client' 3 | import App from './App.tsx' 4 | import './index.css' 5 | 6 | ReactDOM.createRoot(document.getElementById('root')!).render( 7 | 8 | 9 | , 10 | ) 11 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true, 8 | "strict": true 9 | }, 10 | "include": ["vite.config.ts"] 11 | } 12 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/react/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/vite/dist/vite-example.js: -------------------------------------------------------------------------------- 1 | const c = (o, t) => o * t; 2 | export { 3 | c as mul 4 | }; 5 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/vite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vite-example", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "devDependencies": { 12 | "ts-node": "^10.9.2", 13 | "typescript": "^5.4.5", 14 | "vite": "^5.2.11" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/vite/src/main.ts: -------------------------------------------------------------------------------- 1 | export const mul = (a: number, b: number) => a * b 2 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/src/vite/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite" 2 | import { resolve } from "path" 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | build: { lib: { entry: resolve(__dirname, "src/main.ts"), formats: ["es"] } }, 7 | resolve: { alias: { src: resolve("src/") } }, 8 | }) 9 | -------------------------------------------------------------------------------- /chapters/chapter02_Core_Principles_and_use_cases/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: {}, 5 | }) 6 | -------------------------------------------------------------------------------- /chapters/chapter03_Creational_Design_Patterns/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter03_Creational_Design_Patterns/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter03_Creational_Design_Patterns/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter03_Creational_Design_Patterns/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter03_Creational_Design_Patterns/src/singleton.test.ts: -------------------------------------------------------------------------------- 1 | import { Singleton } from './singleton.js'; 2 | import { test, expect, describe } from 'vitest' 3 | 4 | describe('Singleton', () => { 5 | test('getInstance returns the same instance', () => { 6 | const instance1 = Singleton.getInstance(); 7 | const instance2 = Singleton.getInstance(); 8 | 9 | expect(instance1).toBe(instance2); 10 | }); 11 | }); -------------------------------------------------------------------------------- /chapters/chapter03_Creational_Design_Patterns/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: {}, 5 | }) 6 | -------------------------------------------------------------------------------- /chapters/chapter04_Structural_Design_Patterns/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter04_Structural_Design_Patterns/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter04_Structural_Design_Patterns/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter04_Structural_Design_Patterns/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter04_Structural_Design_Patterns/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter04_Structural_Design_Patterns/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter05_Behavioral_Design_Patterns_Communication/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter05_Behavioral_Design_Patterns_Communication/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter05_Behavioral_Design_Patterns_Communication/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter05_Behavioral_Design_Patterns_Communication/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter05_Behavioral_Design_Patterns_Communication/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter05_Behavioral_Design_Patterns_Communication/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter06_Behavioral_Design_Patterns_State/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter06_Behavioral_Design_Patterns_State/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter06_Behavioral_Design_Patterns_State/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter06_Behavioral_Design_Patterns_State/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter06_Behavioral_Design_Patterns_State/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter06_Behavioral_Design_Patterns_State/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter07_Functional_Programming_Concepts/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/dist/impure-functions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function add(a, b) { 4 | return a + b; 5 | } 6 | console.log(add(2, 3)); // Always outputs 5 7 | console.log(add(2, 3)); // Always outputs 5 8 | -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/dist/io-actions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const getCurrentTime = () => new Date().toISOString(); 4 | const logMessage = (message) => () => console.log(message); 5 | const time = getCurrentTime(); 6 | console.log(time); 7 | logMessage("Hello, World!")(); 8 | -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/src/impure-functions.ts: -------------------------------------------------------------------------------- 1 | function add(a: number, b: number): number { 2 | return a + b 3 | } 4 | 5 | console.log(add(2, 3)) // Always outputs 5 6 | console.log(add(2, 3)) // Always outputs 5 7 | 8 | -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/src/io-actions.ts: -------------------------------------------------------------------------------- 1 | export interface IO
{ 2 | (): A; 3 | } 4 | 5 | const getCurrentTime: IO = () => new Date().toISOString(); 6 | const logMessage = (message: string): IO => () => console.log(message); 7 | 8 | const time = getCurrentTime(); 9 | console.log(time); 10 | 11 | logMessage("Hello, World!")(); -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/src/pure-functions.ts: -------------------------------------------------------------------------------- 1 | let count = 0 2 | function incrementAndLog(value: number): number { 3 | count++ // Modifies external state 4 | console.log(`Count is now ${count}`) // Side effect: logging 5 | return value + 1 6 | } 7 | console.log(incrementAndLog(5)) // Outputs: Count is now 1, 6 8 | console.log(incrementAndLog(5)) // Outputs: Count is now 2, 6 9 | 10 | function toZero(num: number): 0 { 11 | return 0 12 | } 13 | -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter07_Functional_Programming_Concepts/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter08_Reactive_Programming_concepts/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter08_Reactive_Programming_concepts/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter08_Reactive_Programming_concepts/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter08_Reactive_Programming_concepts/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter08_Reactive_Programming_concepts/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter08_Reactive_Programming_concepts/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter09_Best_practices/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter09_Best_practices/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter09_Best_practices/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter09_Best_practices/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter09_Best_practices/dist/utilities.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // Usage 4 | const nested = { 5 | a: { b: { c: 42 } }, 6 | }; 7 | // Usage 8 | const calc = { 9 | value: 0, 10 | add(n) { 11 | this.value += n; 12 | }, 13 | subtract(n) { 14 | this.value -= n; 15 | }, 16 | }; 17 | calc.value = 10; // This is now allowed 18 | -------------------------------------------------------------------------------- /chapters/chapter09_Best_practices/dist/utilties.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // Usage 4 | const nested = { 5 | a: { b: { c: 42 } }, 6 | }; 7 | // Usage 8 | const calc = { 9 | value: 0, 10 | add(n) { 11 | this.value += n; 12 | }, 13 | subtract(n) { 14 | this.value -= n; 15 | }, 16 | }; 17 | calc.value = 10; // This is now allowed 18 | -------------------------------------------------------------------------------- /chapters/chapter09_Best_practices/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter09_Best_practices/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter10_Anti_patterns/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter10_Anti_patterns/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter10_Anti_patterns/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter10_Anti_patterns/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter10_Anti_patterns/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter10_Anti_patterns/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/apollo/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter11-Open_source_patterns/apollo/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/apollo/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/apollo/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/apollo/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/apollo/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/trpc/.eslintrc.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/chapters/chapter11-Open_source_patterns/trpc/.eslintrc.json -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/trpc/.prettierignore: -------------------------------------------------------------------------------- 1 | .history 2 | .vscode 3 | coverage 4 | dist 5 | node_modules -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/trpc/.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "all", 3 | "tabWidth": 2, 4 | "printWidth": 120, 5 | "semi": false, 6 | "singleQuote": false, 7 | "bracketSpacing": true 8 | } 9 | -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/trpc/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { defineProject } from "vitest/config" 2 | 3 | export default defineProject({ 4 | test: { 5 | setupFiles: ['./vitest.setup.js'], 6 | }, 7 | }) 8 | -------------------------------------------------------------------------------- /chapters/chapter11-Open_source_patterns/trpc/vitest.setup.js: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest'; 2 | import * as matchers from 'jest-extended'; 3 | 4 | expect.extend(matchers); -------------------------------------------------------------------------------- /external-repos/apollo-client/.attw.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignoreRules": ["false-esm", "cjs-resolves-to-esm"] 3 | } 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json", 3 | "changelog": [ 4 | "@changesets/changelog-github", 5 | { "repo": "apollographql/apollo-client" } 6 | ], 7 | "commit": false, 8 | "fixed": [], 9 | "linked": [], 10 | "access": "public", 11 | "baseBranch": "main", 12 | "updateInternalDependencies": "patch", 13 | "ignore": [] 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @apollographql/client-typescript 2 | 3 | /docs/ @apollographql/docs 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🚀 Feature Request 3 | about: Feature requests are managed in the Apollo Feature Request repo (https://github.com/apollographql/apollo-feature-requests). 4 | --- 5 | 6 | Thanks for your interest in helping make Apollo Client better! 7 | 8 | Feature requests and non-bug related discussions are no longer managed in this repo. Feature requests should be opened in https://github.com/apollographql/apollo-feature-requests. 9 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Please see the documentation for all configuration options: 2 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 3 | 4 | version: 2 5 | updates: 6 | - package-ecosystem: "npm" 7 | directory: "/" 8 | schedule: 9 | interval: "weekly" 10 | # Disable @dependabot (except for security updates) because we use @renovate instead 11 | open-pull-requests-limit: 0 12 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.npmrc: -------------------------------------------------------------------------------- 1 | legacy-peer-deps=true 2 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "bracketSpacing": true, 3 | "printWidth": 80, 4 | "semi": true, 5 | "singleQuote": false, 6 | "tabWidth": 2, 7 | "trailingComma": "es5", 8 | "experimentalTernaries": true 9 | } 10 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.semgrepignore: -------------------------------------------------------------------------------- 1 | # semgrep defaults 2 | # https://semgrep.dev/docs/ignoring-files-folders-code#defining-ignored-files-and-folders-in-semgrepignore 3 | node_modules/ 4 | dist/ 5 | *.min.js 6 | .npm/ 7 | .yarn/ 8 | .semgrep 9 | .semgrep_logs/ 10 | 11 | # custom paths 12 | __tests__/ 13 | ./docs/source/data/subscriptions.mdx 14 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.size-limits.json: -------------------------------------------------------------------------------- 1 | { 2 | "dist/apollo-client.min.cjs": 40251, 3 | "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 33060 4 | } 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "editor.tabSize": 2, 4 | "editor.rulers": [80], 5 | "files.trimTrailingWhitespace": true, 6 | "files.insertFinalNewline": true, 7 | "typescript.tsdk": "node_modules/typescript/lib", 8 | "cSpell.enableFiletypes": ["mdx"], 9 | "jest.jestCommandLine": "node_modules/.bin/jest --config ./config/jest.config.js --ignoreProjects 'ReactDOM 17' --runInBand" 10 | } 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/config/postprocessDist.ts: -------------------------------------------------------------------------------- 1 | import { distDir } from "./helpers.ts"; 2 | import fs from "node:fs"; 3 | import path from "node:path"; 4 | 5 | const globalTypesFile = path.resolve(distDir, "utilities/globals/global.d.ts"); 6 | fs.writeFileSync( 7 | globalTypesFile, 8 | fs 9 | .readFileSync(globalTypesFile, "utf8") 10 | .split("\n") 11 | .filter((line) => line.trim() !== "const __DEV__: boolean;") 12 | .join("\n"), 13 | "utf8" 14 | ); 15 | -------------------------------------------------------------------------------- /external-repos/apollo-client/config/precheck.js: -------------------------------------------------------------------------------- 1 | const { lockfileVersion } = require("../package-lock.json"); 2 | 3 | const expectedVersion = 2; 4 | 5 | if (typeof lockfileVersion !== "number" || lockfileVersion < expectedVersion) { 6 | throw new Error( 7 | `Old lockfileVersion (${lockfileVersion}) found in package-lock.json (expected ${expectedVersion} or later)` 8 | ); 9 | } 10 | 11 | console.log("ok", { 12 | lockfileVersion, 13 | expectedVersion, 14 | }); 15 | -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/shared/ApiDoc/Context.js: -------------------------------------------------------------------------------- 1 | import { useMDXComponents } from "@mdx-js/react"; 2 | 3 | export const useApiDocContext = function () { 4 | const MDX = useMDXComponents(); 5 | return MDX.useApiDocContext(this, arguments); 6 | }; 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/api/react/hooks-experimental.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hooks (experimental) 3 | description: Apollo Client experimental react hooks API reference 4 | --- 5 | 6 | The latest minor version of Apollo Client has no experimental hooks. Please see the [Hooks page](./hooks) for a list of available stable React hooks. 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/api/react/preloading.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Preloading 3 | description: Apollo Client preloading API reference 4 | minVersion: 3.9.0 5 | api_doc: 6 | - "@apollo/client!createQueryPreloader:function(1)" 7 | --- 8 | 9 | import { FunctionDetails } from '../../../shared/ApiDoc'; 10 | 11 | 12 | -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-diagrams/1-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-diagrams/1-overview.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-diagrams/2-map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-diagrams/2-map.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-diagrams/3-minimize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-diagrams/3-minimize.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-diagrams/4-normalize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-diagrams/4-normalize.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-mocking/cli-clientcheck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-mocking/cli-clientcheck.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-mocking/devtools-clientstate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-mocking/devtools-clientstate.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-mocking/vscode-autocomplete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-mocking/vscode-autocomplete.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-mocking/vscode-errors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-mocking/vscode-errors.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-mocking/vscode-typeinfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-mocking/vscode-typeinfo.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/client-schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/client-schema.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/apollo-client-devtools/ac-browser-devtools-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/apollo-client-devtools/ac-browser-devtools-3.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/devtools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/devtools.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/mutation-init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/mutation-init.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/mutation-result-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/mutation-result-data.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/mutation-result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/mutation-result.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/query-init-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/query-init-data.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/query-init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/query-init.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/devtools/query-result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/devtools/query-result.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/link/concepts-intro-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/link/concepts-intro-1.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/link/concepts-intro-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/link/concepts-intro-2.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/assets/link/error-request-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/assets/link/error-request-flow.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/img/cache-inspector.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/img/cache-inspector.jpg -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/img/client-schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/img/client-schema.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/img/githunt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/img/githunt.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/img/spotify-playlists.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/img/spotify-playlists.jpg -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/logo/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/logo/favicon.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/logo/icon-apollo-white-200x200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/logo/icon-apollo-white-200x200.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/logo/large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/logo/large.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/logo/square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/docs/source/logo/square.png -------------------------------------------------------------------------------- /external-repos/apollo-client/docs/source/template.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Title 3 | subtitle: Subtitle 4 | description: Description 5 | --- 6 | 7 | ## Topic 8 | 9 | ### Sub Topic 10 | 11 | ```js 12 | // code block 13 | ``` 14 | 15 | ## Best Practices 16 | 17 | ## API Documentation 18 | -------------------------------------------------------------------------------- /external-repos/apollo-client/eslint-local-rules/fixtures/file.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/eslint-local-rules/fixtures/file.ts -------------------------------------------------------------------------------- /external-repos/apollo-client/eslint-local-rules/fixtures/react.tsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/apollo-client/eslint-local-rules/fixtures/react.tsx -------------------------------------------------------------------------------- /external-repos/apollo-client/eslint-local-rules/fixtures/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "target": "esnext" 5 | }, 6 | "include": ["file.ts", "react.tsx"] 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/apollo-client/eslint-local-rules/index.js: -------------------------------------------------------------------------------- 1 | require("ts-node").register({ 2 | transpileOnly: true, 3 | compilerOptions: { 4 | // we need this to be nodenext in the tsconfig, because 5 | // @typescript-eslint/utils only seems to export ESM 6 | // in TypeScript's eyes, but it totally works 7 | module: "commonjs", 8 | moduleResolution: "node", 9 | }, 10 | }); 11 | 12 | module.exports = { 13 | "require-using-disposable": require("./require-using-disposable").rule, 14 | }; 15 | -------------------------------------------------------------------------------- /external-repos/apollo-client/eslint-local-rules/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "node -r ts-node/register/transpile-only --no-warnings --test --watch *.test.ts" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /external-repos/apollo-client/eslint-local-rules/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node20/tsconfig.json", 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "noEmit": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | test-results/ 3 | .next 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/browser-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "browser-esm", 3 | "scripts": { 4 | "serve-app": "yarn serve html", 5 | "test": "playwright test" 6 | }, 7 | "devDependencies": { 8 | "shared": "*", 9 | "playwright": "*", 10 | "@playwright/test": "*", 11 | "serve": "*" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/browser-esm/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { baseConfig } from "shared/playwright.config"; 2 | import { defineConfig } from "@playwright/test"; 3 | 4 | export default defineConfig(baseConfig); 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/cra4/.env: -------------------------------------------------------------------------------- 1 | SKIP_PREFLIGHT_CHECK=true -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/cra4/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { baseConfig } from "shared/playwright.config"; 2 | import { defineConfig } from "@playwright/test"; 3 | 4 | export default defineConfig(baseConfig); 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/cra4/tests/playwright/apollo-client.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "@playwright/test"; 2 | import { test } from "shared/fixture"; 3 | 4 | test("Basic Test", async ({ page, withHar }) => { 5 | await page.goto("http://localhost:3000"); 6 | 7 | await expect(page.getByText("loading")).toBeVisible(); 8 | await expect(page.getByText("loading")).not.toBeVisible(); 9 | await expect(page.getByText("Soft Warm Apollo Beanie")).toBeVisible(); 10 | }); 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/cra5/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { baseConfig } from "shared/playwright.config"; 2 | import { defineConfig } from "@playwright/test"; 3 | 4 | export default defineConfig(baseConfig); 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/cra5/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import App from "./App"; 4 | 5 | const root = ReactDOM.createRoot( 6 | document.getElementById("root") as HTMLElement 7 | ); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/cra5/tests/playwright/apollo-client.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "@playwright/test"; 2 | import { test } from "shared/fixture"; 3 | 4 | test("Basic Test", async ({ page, withHar }) => { 5 | await page.goto("http://localhost:3000"); 6 | 7 | await expect(page.getByText("loading")).toBeVisible(); 8 | await expect(page.getByText("loading")).not.toBeVisible(); 9 | await expect(page.getByText("Soft Warm Apollo Beanie")).toBeVisible(); 10 | }); 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/empty.har: -------------------------------------------------------------------------------- 1 | { 2 | "log": { 3 | "version": "1.2", 4 | "creator": { 5 | "name": "Playwright", 6 | "version": "1.35.1" 7 | }, 8 | "browser": { 9 | "name": "chromium", 10 | "version": "115.0.5790.24" 11 | }, 12 | "entries": [] 13 | } 14 | } -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/next/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/basic-features/typescript for more information. 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/next/next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = {}; 3 | 4 | module.exports = nextConfig; 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/next/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { baseConfig } from "shared/playwright.config"; 2 | import { defineConfig } from "@playwright/test"; 3 | 4 | export default defineConfig(baseConfig); 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/next/src/app/cc/layout.tsx: -------------------------------------------------------------------------------- 1 | import { ApolloWrapper } from "./ApolloWrapper.tsx"; 2 | 3 | export default async function Layout({ 4 | children, 5 | }: { 6 | children: React.ReactNode; 7 | }) { 8 | return {children}; 9 | } 10 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/next/src/app/client.ts: -------------------------------------------------------------------------------- 1 | import { schemaLink } from "@/libs/schemaLink.ts"; 2 | import { ApolloClient, InMemoryCache } from "@apollo/client"; 3 | import { registerApolloClient } from "@apollo/experimental-nextjs-app-support/rsc"; 4 | 5 | export const { getClient } = registerApolloClient(() => { 6 | return new ApolloClient({ 7 | cache: new InMemoryCache(), 8 | link: schemaLink, 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/next/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: "Create Next App", 3 | description: "Generated by create next app", 4 | }; 5 | 6 | export default function RootLayout({ 7 | children, 8 | }: { 9 | children: React.ReactNode; 10 | }) { 11 | return ( 12 | 13 | {children} 14 | 15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/next/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { ApolloProvider } from "@apollo/client"; 2 | import { useApollo } from "../libs/apolloClient.ts"; 3 | import type { AppProps } from "next/app"; 4 | 5 | export default function App({ Component, pageProps }: AppProps) { 6 | const apolloClient = useApollo(pageProps); 7 | 8 | return ( 9 | 10 | 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/node-esm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dual-module-test-esm", 3 | "version": "1.0.0", 4 | "license": "MIT", 5 | "type": "module", 6 | "scripts": { 7 | "build": "echo Done", 8 | "test": "node test-cjs.cjs && node test-esm.mjs" 9 | }, 10 | "dependencies": { 11 | "@apollo/client": "^3.10.1", 12 | "react": "^18.3.0", 13 | "react-dom": "^18.3.0" 14 | }, 15 | "devDependencies": { 16 | "resolve-esm": "^1.4.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/node-standard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dual-module-test-standard", 3 | "version": "1.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "build": "echo Done", 7 | "test": "node test-cjs.js && node test-esm.mjs" 8 | }, 9 | "dependencies": { 10 | "@apollo/client": "^3.10.1", 11 | "react": "^18.3.0", 12 | "react-dom": "^18.3.0" 13 | }, 14 | "devDependencies": { 15 | "resolve-esm": "^1.4.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/peerdeps-tsc/.gitignore: -------------------------------------------------------------------------------- 1 | # explicitly avoiding to check in this one 2 | # so we run this test always with the latest version 3 | package-lock.json 4 | dist 5 | node_modules 6 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/peerdeps-tsc/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "@apollo/client"; 2 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/shared/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shared", 3 | "license": "UNLICENSED", 4 | "peerDependencies": { 5 | "@playwright/test": "*" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/shared/playwright.config.ts: -------------------------------------------------------------------------------- 1 | export const baseConfig = { 2 | webServer: { 3 | command: "yarn serve-app", 4 | url: "http://localhost:3000", 5 | timeout: 120 * 1000, 6 | reuseExistingServer: !process.env.CI, 7 | }, 8 | timeout: 120 * 1000, 9 | use: { 10 | headless: true, 11 | viewport: { width: 1280, height: 720 }, 12 | ignoreHTTPSErrors: true, 13 | }, 14 | testDir: "tests/playwright/", 15 | } as const; 16 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite-swc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite + React + TS 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite-swc/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { baseConfig } from "shared/playwright.config.ts"; 2 | import { defineConfig } from "@playwright/test"; 3 | 4 | export default defineConfig(baseConfig); 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite-swc/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import App from "./App.tsx"; 4 | 5 | ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( 6 | 7 | 8 | 9 | ); 10 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite-swc/tests/playwright/apollo-client.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "@playwright/test"; 2 | import { test } from "shared/fixture.ts"; 3 | 4 | test("Basic Test", async ({ page, withHar }) => { 5 | await page.goto("http://localhost:3000"); 6 | 7 | await expect(page.getByText("loading")).toBeVisible(); 8 | await expect(page.getByText("loading")).not.toBeVisible(); 9 | await expect(page.getByText("Soft Warm Apollo Beanie")).toBeVisible(); 10 | }); 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite-swc/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": ["vite.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite-swc/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import react from "@vitejs/plugin-react-swc"; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }); 8 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Vite + React + TS 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite/playwright.config.ts: -------------------------------------------------------------------------------- 1 | import { baseConfig } from "shared/playwright.config.ts"; 2 | import { defineConfig } from "@playwright/test"; 3 | 4 | export default defineConfig(baseConfig); 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import App from "./App.tsx"; 4 | 5 | ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( 6 | 7 | 8 | 9 | ); 10 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite/tests/playwright/apollo-client.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "@playwright/test"; 2 | import { test } from "shared/fixture.ts"; 3 | 4 | test("Basic Test", async ({ page, withHar }) => { 5 | await page.goto("http://localhost:3000"); 6 | 7 | await expect(page.getByText("loading")).toBeVisible(); 8 | await expect(page.getByText("loading")).not.toBeVisible(); 9 | await expect(page.getByText("Soft Warm Apollo Beanie")).toBeVisible(); 10 | }); 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": ["vite.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/integration-tests/vite/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import react from "@vitejs/plugin-react"; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }); 8 | -------------------------------------------------------------------------------- /external-repos/apollo-client/scripts/codemods/ac2-to-ac3/examples/client-and-cache.ts: -------------------------------------------------------------------------------- 1 | import Client from "apollo-client"; 2 | import { InMemoryCache, InMemoryCacheConfig } from "apollo-cache-inmemory"; 3 | import gql from "graphql-tag"; 4 | 5 | const client = new Client({ 6 | cache: new InMemoryCache({} as InMemoryCacheConfig), 7 | }); 8 | 9 | client.query({ 10 | query: gql` 11 | query { 12 | __typename 13 | } 14 | `, 15 | }); 16 | -------------------------------------------------------------------------------- /external-repos/apollo-client/scripts/codemods/ac2-to-ac3/examples/react-packages.tsx: -------------------------------------------------------------------------------- 1 | import { useQuery } from "@apollo/react-hooks"; 2 | import { graphql, withApollo, ChildProps } from "@apollo/react-hoc"; 3 | import { MockProvider } from "@apollo/react-testing"; 4 | 5 | import { 6 | getDataFromTree, 7 | getMarkupFromTree, 8 | renderToStringWithData, 9 | } from "@apollo/react-ssr"; 10 | 11 | import { Query, Mutation, Subscription } from "@apollo/react-components"; 12 | -------------------------------------------------------------------------------- /external-repos/apollo-client/scripts/codemods/ac2-to-ac3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "devDependencies": { 4 | "jscodeshift": "0.16.1" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/scripts/memory/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "apollo-client-memory-tests", 3 | "private": true, 4 | "scripts": { 5 | "test": "mocha --exit -n expose-gc tests.js" 6 | }, 7 | "dependencies": { 8 | "@apollo/client": "file:../../dist", 9 | "graphql": "^16.0.0" 10 | }, 11 | "devDependencies": { 12 | "mocha": "10.7.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/apollo-client/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 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/config/jest/areGraphQlErrorsEqual.ts: -------------------------------------------------------------------------------- 1 | import { GraphQLError } from "graphql"; 2 | import type { Tester } from "@jest/expect-utils"; 3 | 4 | export const areGraphQLErrorsEqual: Tester = function (a, b, customTesters) { 5 | if (a instanceof GraphQLError || b instanceof GraphQLError) { 6 | return this.equals( 7 | a instanceof GraphQLError ? a.toJSON() : a, 8 | b instanceof GraphQLError ? b.toJSON() : b, 9 | customTesters 10 | ); 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/dev/index.ts: -------------------------------------------------------------------------------- 1 | export { loadDevMessages } from "./loadDevMessages.js"; 2 | export { loadErrorMessageHandler } from "./loadErrorMessageHandler.js"; 3 | export { loadErrorMessages } from "./loadErrorMessages.js"; 4 | export { setErrorMessageHandler } from "./setErrorMessageHandler.js"; 5 | export type { ErrorMessageHandler } from "./setErrorMessageHandler.js"; 6 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/dev/loadDevMessages.ts: -------------------------------------------------------------------------------- 1 | import { devDebug, devError, devLog, devWarn } from "../invariantErrorCodes.js"; 2 | import { loadErrorMessageHandler } from "./loadErrorMessageHandler.js"; 3 | 4 | export function loadDevMessages() { 5 | loadErrorMessageHandler(devDebug, devError, devLog, devWarn); 6 | } 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/dev/loadErrorMessages.ts: -------------------------------------------------------------------------------- 1 | import { errorCodes } from "../invariantErrorCodes.js"; 2 | import { loadErrorMessageHandler } from "./loadErrorMessageHandler.js"; 3 | 4 | export function loadErrorMessages() { 5 | loadErrorMessageHandler(errorCodes); 6 | } 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./core/index.js"; 2 | export * from "./react/index.js"; 3 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/invariantErrorCodes.ts: -------------------------------------------------------------------------------- 1 | export interface ErrorCodes { 2 | [key: number]: { file: string; condition?: string; message?: string }; 3 | } 4 | 5 | export const errorCodes: ErrorCodes = {}; 6 | export const devDebug: ErrorCodes = {}; 7 | export const devLog: ErrorCodes = {}; 8 | export const devWarn: ErrorCodes = {}; 9 | export const devError: ErrorCodes = {}; 10 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/batch-http/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./batchHttpLink.js"; 2 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/batch/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./batchLink.js"; 2 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/core/concat.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from "./ApolloLink.js"; 2 | 3 | export const concat = ApolloLink.concat; 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/core/empty.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from "./ApolloLink.js"; 2 | 3 | export const empty = ApolloLink.empty; 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/core/execute.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from "./ApolloLink.js"; 2 | 3 | export const execute = ApolloLink.execute; 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/core/from.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from "./ApolloLink.js"; 2 | 3 | export const from = ApolloLink.from; 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/core/index.ts: -------------------------------------------------------------------------------- 1 | import "../../utilities/globals/index.js"; 2 | 3 | export { empty } from "./empty.js"; 4 | export { from } from "./from.js"; 5 | export { split } from "./split.js"; 6 | export { concat } from "./concat.js"; 7 | export { execute } from "./execute.js"; 8 | export { ApolloLink } from "./ApolloLink.js"; 9 | 10 | export * from "./types.js"; 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/core/split.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from "./ApolloLink.js"; 2 | 3 | export const split = ApolloLink.split; 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/http/HttpLink.ts: -------------------------------------------------------------------------------- 1 | import { ApolloLink } from "../core/index.js"; 2 | import type { HttpOptions } from "./selectHttpOptionsAndBody.js"; 3 | import { createHttpLink } from "./createHttpLink.js"; 4 | 5 | export class HttpLink extends ApolloLink { 6 | constructor(public options: HttpOptions = {}) { 7 | super(createHttpLink(options).request); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/http/createSignalIfSupported.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @deprecated 3 | * This is not used internally any more and will be removed in 4 | * the next major version of Apollo Client. 5 | */ 6 | export const createSignalIfSupported = () => { 7 | if (typeof AbortController === "undefined") 8 | return { controller: false, signal: false }; 9 | 10 | const controller = new AbortController(); 11 | const signal = controller.signal; 12 | return { controller, signal }; 13 | }; 14 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/remove-typename/index.ts: -------------------------------------------------------------------------------- 1 | export type { RemoveTypenameFromVariablesOptions } from "./removeTypenameFromVariables.js"; 2 | export { 3 | removeTypenameFromVariables, 4 | KEEP, 5 | } from "./removeTypenameFromVariables.js"; 6 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/retry/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./retryLink.js"; 2 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/utils/fromError.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from "../../utilities/index.js"; 2 | 3 | export function fromError(errorValue: any): Observable { 4 | return new Observable((observer) => { 5 | observer.error(errorValue); 6 | }); 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/link/utils/fromPromise.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from "../../utilities/index.js"; 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 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/components/index.ts: -------------------------------------------------------------------------------- 1 | export { Query } from "./Query.js"; 2 | export { Mutation } from "./Mutation.js"; 3 | export { Subscription } from "./Subscription.js"; 4 | 5 | export * from "./types.js"; 6 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/context/index.ts: -------------------------------------------------------------------------------- 1 | import "../../utilities/globals/index.js"; 2 | 3 | export type { ApolloConsumerProps } from "./ApolloConsumer.js"; 4 | export { ApolloConsumer } from "./ApolloConsumer.js"; 5 | export type { ApolloContextValue } from "./ApolloContext.js"; 6 | export { getApolloContext, resetApolloContext } from "./ApolloContext.js"; 7 | export type { ApolloProviderProps } from "./ApolloProvider.js"; 8 | export { ApolloProvider } from "./ApolloProvider.js"; 9 | -------------------------------------------------------------------------------- /external-repos/apollo-client/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 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/hoc/index.ts: -------------------------------------------------------------------------------- 1 | import "../../utilities/globals/index.js"; 2 | 3 | export { graphql } from "./graphql.js"; 4 | 5 | export { withQuery } from "./query-hoc.js"; 6 | export { withMutation } from "./mutation-hoc.js"; 7 | export { withSubscription } from "./subscription-hoc.js"; 8 | export { withApollo } from "./withApollo.js"; 9 | 10 | export * from "./types.js"; 11 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/hooks/constants.ts: -------------------------------------------------------------------------------- 1 | export const skipToken = Symbol.for("apollo.skipToken"); 2 | export type SkipToken = typeof skipToken; 3 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/hooks/internal/index.ts: -------------------------------------------------------------------------------- 1 | // These hooks are used internally and are not exported publicly by the library 2 | export { useDeepMemo } from "./useDeepMemo.js"; 3 | export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js"; 4 | export { useRenderGuard } from "./useRenderGuard.js"; 5 | export { __use } from "./__use.js"; 6 | export { wrapHook } from "./wrapHook.js"; 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/internal/cache/types.ts: -------------------------------------------------------------------------------- 1 | import type { DocumentNode } from "graphql"; 2 | 3 | export type CacheKey = [ 4 | query: DocumentNode, 5 | stringifiedVariables: string, 6 | ...queryKey: any[], 7 | ]; 8 | 9 | export interface QueryKey { 10 | __queryKey?: string; 11 | } 12 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/ssr/index.ts: -------------------------------------------------------------------------------- 1 | export { getMarkupFromTree, getDataFromTree } from "./getDataFromTree.js"; 2 | export { renderToStringWithData } from "./renderToStringWithData.js"; 3 | export { RenderPromises } from "./RenderPromises.js"; 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/react/ssr/renderToStringWithData.ts: -------------------------------------------------------------------------------- 1 | import type * as ReactTypes from "react"; 2 | import { getMarkupFromTree } from "./getDataFromTree.js"; 3 | import { renderToString } from "react-dom/server"; 4 | 5 | export function renderToStringWithData( 6 | component: ReactTypes.ReactElement 7 | ): Promise { 8 | return getMarkupFromTree({ 9 | tree: component, 10 | renderFunction: renderToString, 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/testing/core/wait.ts: -------------------------------------------------------------------------------- 1 | export async function wait(ms: number) { 2 | return new Promise((resolve) => setTimeout(resolve, ms)); 3 | } 4 | 5 | export async function tick() { 6 | return wait(0); 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/testing/experimental/index.ts: -------------------------------------------------------------------------------- 1 | export { createTestSchema } from "./createTestSchema.js"; 2 | export { createSchemaFetch } from "./createSchemaFetch.js"; 3 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | import "../utilities/globals/index.js"; 2 | export type { MockedProviderProps } from "./react/MockedProvider.js"; 3 | export { MockedProvider } from "./react/MockedProvider.js"; 4 | export * from "./core/index.js"; 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/testing/internal/disposables/__tests__/withCleanup.test.ts: -------------------------------------------------------------------------------- 1 | import { withCleanup } from "../index.js"; 2 | describe("withCleanup", () => { 3 | it("calls cleanup", () => { 4 | let cleanedUp = false; 5 | { 6 | using _x = withCleanup({}, () => { 7 | cleanedUp = true; 8 | }); 9 | expect(cleanedUp).toBe(false); 10 | } 11 | expect(cleanedUp).toBe(true); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/testing/internal/disposables/index.ts: -------------------------------------------------------------------------------- 1 | export { disableActWarnings } from "./disableActWarnings.js"; 2 | export { spyOnConsole } from "./spyOnConsole.js"; 3 | export { withCleanup } from "./withCleanup.js"; 4 | export { enableFakeTimers } from "./enableFakeTimers.js"; 5 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/testing/matchers/index.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "@jest/globals"; 2 | import { toMatchDocument } from "./toMatchDocument.js"; 3 | import { toHaveSuspenseCacheEntryUsing } from "./toHaveSuspenseCacheEntryUsing.js"; 4 | import { toBeGarbageCollected } from "./toBeGarbageCollected.js"; 5 | import { toBeDisposed } from "./toBeDisposed.js"; 6 | 7 | expect.extend({ 8 | toBeDisposed, 9 | toHaveSuspenseCacheEntryUsing, 10 | toMatchDocument, 11 | toBeGarbageCollected, 12 | }); 13 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/caching/__tests__/sizes.test.ts: -------------------------------------------------------------------------------- 1 | import { expectTypeOf } from "expect-type"; 2 | import type { CacheSizes, defaultCacheSizes } from "../sizes"; 3 | 4 | test.skip("type tests", () => { 5 | expectTypeOf().toMatchTypeOf< 6 | keyof typeof defaultCacheSizes 7 | >(); 8 | expectTypeOf().toMatchTypeOf< 9 | keyof CacheSizes 10 | >(); 11 | }); 12 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/caching/index.ts: -------------------------------------------------------------------------------- 1 | export { AutoCleanedStrongCache, AutoCleanedWeakCache } from "./caches.js"; 2 | export type { CacheSizes } from "./sizes.js"; 3 | export { cacheSizes, defaultCacheSizes } from "./sizes.js"; 4 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/common/arrays.ts: -------------------------------------------------------------------------------- 1 | // A version of Array.isArray that works better with readonly arrays. 2 | export const isArray: (a: any) => a is any[] | readonly any[] = Array.isArray; 3 | 4 | export function isNonEmptyArray(value?: ArrayLike): value is Array { 5 | return Array.isArray(value) && value.length > 0; 6 | } 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/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 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/common/objects.ts: -------------------------------------------------------------------------------- 1 | export function isNonNullObject(obj: any): obj is Record { 2 | return obj !== null && typeof obj === "object"; 3 | } 4 | 5 | export function isPlainObject(obj: any): obj is Record { 6 | return ( 7 | obj !== null && 8 | typeof obj === "object" && 9 | (Object.getPrototypeOf(obj) === Object.prototype || 10 | Object.getPrototypeOf(obj) === null) 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/common/stringifyForDisplay.ts: -------------------------------------------------------------------------------- 1 | import { makeUniqueId } from "./makeUniqueId.js"; 2 | 3 | export function stringifyForDisplay(value: any, space = 0): string { 4 | const undefId = makeUniqueId("stringifyForDisplay"); 5 | return JSON.stringify( 6 | value, 7 | (key, value) => { 8 | return value === void 0 ? undefId : value; 9 | }, 10 | space 11 | ) 12 | .split(JSON.stringify(undefId)) 13 | .join(""); 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/common/stripTypename.ts: -------------------------------------------------------------------------------- 1 | import { omitDeep } from "./omitDeep.js"; 2 | 3 | export function stripTypename(value: T) { 4 | return omitDeep(value, "__typename"); 5 | } 6 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/globals/maybe.ts: -------------------------------------------------------------------------------- 1 | export function maybe(thunk: () => T): T | undefined { 2 | try { 3 | return thunk(); 4 | } catch {} 5 | } 6 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/types/OnlyRequiredProperties.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns a new type that only contains the required properties from `T` 3 | */ 4 | export type OnlyRequiredProperties = { 5 | [K in keyof T as {} extends Pick ? never : K]: T[K]; 6 | }; 7 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/types/Primitive.ts: -------------------------------------------------------------------------------- 1 | // Matches any primitive value: https://developer.mozilla.org/en-US/docs/Glossary/Primitive. 2 | export type Primitive = 3 | | null 4 | | undefined 5 | | string 6 | | number 7 | | boolean 8 | | symbol 9 | | bigint; 10 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/utilities/types/TODO.ts: -------------------------------------------------------------------------------- 1 | /** @internal */ 2 | export type TODO = any; 3 | -------------------------------------------------------------------------------- /external-repos/apollo-client/src/version.ts: -------------------------------------------------------------------------------- 1 | export const version = "local"; 2 | -------------------------------------------------------------------------------- /external-repos/apollo-client/tsconfig.tests.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./src/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /external-repos/trpc/.dockerignore: -------------------------------------------------------------------------------- 1 | .github 2 | .vscode 3 | .thing 4 | **.turbo 5 | **.vercel 6 | **node_modules 7 | **dist -------------------------------------------------------------------------------- /external-repos/trpc/.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 2 | 3 | 4 | * @trpc/trpc-core 5 | 6 | www/**/* @trpc/trpc-website-docs 7 | 8 | -------------------------------------------------------------------------------- /external-repos/trpc/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: trpc 4 | -------------------------------------------------------------------------------- /external-repos/trpc/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a question 4 | url: https://github.com/trpc/trpc/discussions 5 | about: Ask questions and discuss with other community members 6 | -------------------------------------------------------------------------------- /external-repos/trpc/.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | name: 'Pull Request Labeler' 2 | on: 3 | - pull_request_target 4 | 5 | jobs: 6 | triage: 7 | permissions: 8 | contents: read 9 | pull-requests: write 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/labeler@v5 13 | with: 14 | repo-token: '${{ secrets.GITHUB_TOKEN }}' 15 | -------------------------------------------------------------------------------- /external-repos/trpc/.kodiak.toml: -------------------------------------------------------------------------------- 1 | # .kodiak.toml 2 | version = 1 3 | 4 | [approve] 5 | auto_approve_usernames = ["dependabot", "renovate"] 6 | 7 | [merge] 8 | method = "squash" 9 | automerge_label = ["🚀 merge", "⬆️ dependencies"] 10 | 11 | [merge.automerge_dependencies] 12 | # only auto merge "minor" and "patch" version upgrades. 13 | versions = ["minor", "patch"] 14 | usernames = ["dependabot", "renovate"] 15 | 16 | [update] 17 | autoupdate_label = "♻️ autoupdate" 18 | -------------------------------------------------------------------------------- /external-repos/trpc/.npmrc: -------------------------------------------------------------------------------- 1 | public-hoist-pattern[]=@types/* 2 | public-hoist-pattern[]=playwright-core 3 | public-hoist-pattern[]=zod 4 | side-effects-cache=false 5 | strict-peer-dependencies=false 6 | prefer-workspace-packages=true 7 | link-workspace-packages=true -------------------------------------------------------------------------------- /external-repos/trpc/.nvmrc: -------------------------------------------------------------------------------- 1 | 20.10 2 | -------------------------------------------------------------------------------- /external-repos/trpc/.prettierignore: -------------------------------------------------------------------------------- 1 | __generated__/ 2 | .docusaurus/ 3 | .test/ 4 | **/.next/ 5 | **/www/build/ 6 | **/www/typedoc/ 7 | dist/ 8 | examples/next-big-router/src/server/routers/*.ts 9 | examples/.diagnostics/**/* 10 | packages/tests/vendor/ 11 | packages/server/src/vendor/ 12 | packages/coverage/ 13 | pnpm-lock.yaml 14 | www/docs/main/quickstart.mdx 15 | .turbo 16 | .vinxi 17 | .output 18 | -------------------------------------------------------------------------------- /external-repos/trpc/.tool-versions: -------------------------------------------------------------------------------- 1 | nodejs 20.10.0 2 | pnpm 8.15.5 3 | -------------------------------------------------------------------------------- /external-repos/trpc/.ts-prunerc: -------------------------------------------------------------------------------- 1 | { 2 | "error": true, 3 | "ignore": ".d.ts|config.ts|examples|index.ts|packages/server/src/adapters/*" 4 | } 5 | -------------------------------------------------------------------------------- /external-repos/trpc/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "yzhang.markdown-all-in-one", 4 | "esbenp.prettier-vscode", 5 | "dbaeumer.vscode-eslint", 6 | "bungcip.better-toml", 7 | "orta.vscode-twoslash-queries", 8 | "yoavbls.pretty-ts-errors" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /external-repos/trpc/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | | ------- | ------------------ | 7 | | > 9.x.x | :white_check_mark: | 8 | | < 9.0 | :x: | 9 | 10 | ## Reporting a Vulnerability 11 | 12 | DM [alexdotjs](https://twitter.com/alexdotjs) on Twitter or email at alex@kattcorp.com. 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/.env: -------------------------------------------------------------------------------- 1 | NEXTAUTH_SECRET=supersecret 2 | GITHUB_ID= 3 | GITHUB_SECRET= 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | eslint: { 5 | ignoreDuringBuilds: true, 6 | }, 7 | serverExternalPackages: ['@trpc/server'], 8 | webpack: (config) => { 9 | // This is only intended to pass CI and should be skiped in your app 10 | if (config.name === 'server') 11 | config.optimization.concatenateModules = false; 12 | 13 | return config; 14 | }, 15 | } satisfies NextConfig; 16 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/api/auth/[...nextauth]/route.ts: -------------------------------------------------------------------------------- 1 | import { handlers } from '~/auth'; 2 | 3 | export const { GET, POST } = handlers; 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/api/trpc/revalidate/route.ts: -------------------------------------------------------------------------------- 1 | export { experimental_revalidateEndpoint as POST } from '@trpc/next/app-dir/server'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/client/ClientGreeting.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | // import { use } from 'react'; 4 | // import { api } from 'trpc-api'; 5 | 6 | export function ClientGreeting() { 7 | // const greeting = use(api.greeting.query({ text: 'from client' })); 8 | 9 | // return <>{greeting}; 10 | 11 | return <>not implemented; 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/client/page.tsx: -------------------------------------------------------------------------------- 1 | import { Suspense } from 'react'; 2 | import { ClientGreeting } from './ClientGreeting'; 3 | 4 | export default function ClientPage() { 5 | return ( 6 | 7 | 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/posts/[id]/page.tsx: -------------------------------------------------------------------------------- 1 | import { postById } from '../_data'; 2 | 3 | export default async function Page(props: { 4 | params: Promise<{ 5 | id: string; 6 | }>; 7 | }) { 8 | const { id } = await props.params; 9 | const post = await postById({ id }); 10 | 11 | return ( 12 |
13 |

{post.title}

14 | 15 |

{post.content}

16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/posts/_data.schema.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | export const postSchema = z.object({ 4 | id: z.string(), 5 | title: z.string().min(1), 6 | content: z.string().min(1), 7 | }); 8 | 9 | export type Post = z.infer; 10 | 11 | export const addPostSchema = postSchema.omit({ id: true }); 12 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/rsc-rq-prefetch/layout.tsx: -------------------------------------------------------------------------------- 1 | import { TRPCReactProvider } from '~/trpc/rq-client'; 2 | 3 | export default function Layout(props: Readonly<{ children: React.ReactNode }>) { 4 | return {props.children}; 5 | } 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/app/server-action/ReactHookFormExample.schema.tsx: -------------------------------------------------------------------------------- 1 | import { z } from 'zod'; 2 | 3 | export const rhfActionSchema = z.object({ 4 | text: z.string().min(1), 5 | }); 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/server/context.ts: -------------------------------------------------------------------------------- 1 | import type { FetchCreateContextFnOptions } from '@trpc/server/adapters/fetch'; 2 | import { auth } from '~/auth'; 3 | 4 | export async function createContext(opts?: FetchCreateContextFnOptions) { 5 | const session = await auth(); 6 | 7 | return { 8 | session, 9 | headers: opts && Object.fromEntries(opts.req.headers), 10 | }; 11 | } 12 | 13 | export type Context = Awaited>; 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.experimental/next-app-dir/src/trpc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "trpc-api", 3 | "typings": "client.ts", 4 | "exports": { 5 | ".": { 6 | "types": "./client.ts", 7 | "react-server": "./server-invoker.ts", 8 | "default": "./client.ts" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.railway/next-prisma-websockets-starter/railway.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://railway.app/railway.schema.json", 3 | "build": { 4 | "builder": "NIXPACKS" 5 | }, 6 | "deploy": { 7 | "runtime": "V2", 8 | "numReplicas": 1, 9 | "healthcheckPath": "/api/trpc/healthcheck", 10 | "healthcheckTimeout": 100, 11 | "sleepApplication": true, 12 | "restartPolicyType": "ON_FAILURE", 13 | "restartPolicyMaxRetries": 10 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.railway/next-sse-chat/railway.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://railway.app/railway.schema.json", 3 | "build": { 4 | "builder": "DOCKERFILE", 5 | "dockerfilePath": "examples/.railway/next-sse-chat/Dockerfile" 6 | }, 7 | "deploy": { 8 | "healthcheckPath": "/", 9 | "healthcheckTimeout": 100, 10 | "restartPolicyType": "ON_FAILURE", 11 | "runtime": "LEGACY", 12 | "sleepApplication": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/diagnostics-big-router/.gitignore: -------------------------------------------------------------------------------- 1 | .next 2 | src/server/routers 3 | node_modules 4 | build -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/diagnostics-big-router/README.md: -------------------------------------------------------------------------------- 1 | This is an example to test that declaration files work with a big router in tRPC. 2 | 3 | It has a `postinstall`-script that generates 1400 procedures (which you can modify in `scripts/codegen.ts`). 4 | 5 | ```bash 6 | git clone git@github.com:trpc/examples-v10-next-big-router.git 7 | cd examples-v10-next-big-router 8 | yarn && code . && yarn dev 9 | ``` 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/diagnostics-big-router/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/diagnostics-big-router/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | /** We run eslint as a separate task in CI */ 5 | eslint: { ignoreDuringBuilds: !!process.env.CI }, 6 | } satisfies NextConfig; -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/diagnostics-big-router/src/server/trpc.ts: -------------------------------------------------------------------------------- 1 | import { initTRPC, TRPCError } from '@trpc/server'; 2 | import type { Context } from '~/server/context'; 3 | 4 | const t = initTRPC.context().create(); 5 | 6 | export const router = t.router; 7 | 8 | export const publicProcedure = t.procedure; 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/internal-types-export/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | node_modules 3 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/internal-types-export/README.md: -------------------------------------------------------------------------------- 1 | # Internal types export test 2 | 3 | This is an example to test that tRPC exports enough [internal types](../../../packages/server/src/internals.ts) for generating declaration files. 4 | 5 | ## Generate the declaration files 6 | 7 | ```bash 8 | pnpm build 9 | ``` 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/internal-types-export/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "@tsconfig/node-lts", 4 | "@tsconfig/strictest", 5 | "@tsconfig/esm", 6 | ], 7 | "compilerOptions": { 8 | "declaration": true, 9 | "emitDeclarationOnly": true, 10 | "module": "nodenext", 11 | "moduleResolution": "nodenext", 12 | "noEmitOnError": true, 13 | "outDir": "build", 14 | "rootDir": "src", 15 | }, 16 | "include": [ 17 | "src", 18 | ], 19 | } 20 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg-infinite-serialization/README.md: -------------------------------------------------------------------------------- 1 | # SSG E2E Test with Infinite 2 | 3 | This test shows prefetching infinite queries without a transformer. 4 | 5 | tRPC doesn't require `defaultPageParam` to be set, which can be problematic since undefined cannot be serialized which leads to invalid page params. This test should test that we don't mess this up. -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg-infinite-serialization/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg-infinite-serialization/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | /** We run eslint as a separate task in CI */ 5 | eslint: { ignoreDuringBuilds: !!process.env.CI }, 6 | } satisfies NextConfig; -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg-infinite-serialization/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppType } from 'next/app'; 2 | import { trpc } from '../utils/trpc'; 3 | 4 | const MyApp: AppType = ({ Component, pageProps }) => { 5 | return ; 6 | }; 7 | 8 | export default trpc.withTRPC(MyApp); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg/README.md: -------------------------------------------------------------------------------- 1 | # SSG E2E Test 2 | 3 | This example shows how you can prefetch queries. This page works without JavaScript enabled. 4 | 5 | ## Start the server 6 | 7 | ```bash 8 | pnpm dev 9 | ``` 10 | 11 | ## In your Chrome DevTools 12 | 13 | 1. Press `CMD + SHIFT + P` to open the command palette. 14 | 2. Search for `Disable JavaScript` and press enter. 15 | 3. Reload page and see the data is still fetched. 16 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | /** We run eslint as a separate task in CI */ 5 | eslint: { ignoreDuringBuilds: !!process.env.CI }, 6 | } satisfies NextConfig; -------------------------------------------------------------------------------- /external-repos/trpc/examples/.test/ssg/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppType } from 'next/app'; 2 | import { trpc } from '../utils/trpc'; 3 | 4 | const MyApp: AppType = (props) => { 5 | return ; 6 | }; 7 | 8 | export default trpc.withTRPC(MyApp); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/bun/README.md: -------------------------------------------------------------------------------- 1 | - [Bun](https://bun.sh) 2 | - Vanilla tRPC Client in Bun 3 | 4 | [Install Bun](https://bun.sh/docs/installation) then run: 5 | 6 | ```sh 7 | bun dev:server 8 | ``` 9 | 10 | Run the client in another terminal: 11 | 12 | ```sh 13 | bun dev:client 14 | ``` 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/cloudflare-workers/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/cloudflare-workers/README.md: -------------------------------------------------------------------------------- 1 | - [Cloudflare Workers](https://workers.cloudflare.com) 2 | - Vanilla TRPCClient in node 3 | 4 | --- 5 | 6 | Created by [sachinraja](https://github.com/sachinraja). 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/cloudflare-workers/wrangler.toml: -------------------------------------------------------------------------------- 1 | name = "cloudflare-workers" 2 | main = "src/index.ts" 3 | compatibility_date = "2022-05-01" 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/deno-deploy/README.md: -------------------------------------------------------------------------------- 1 | - [Deno Deploy](https://deno.com/deploy) 2 | - Vanilla TRPCClient in Deno 3 | 4 | [Install Deno](https://deno.com/manual/getting_started/installation) then run: 5 | 6 | ```sh 7 | deno task server 8 | ``` 9 | 10 | Run the client in another terminal: 11 | 12 | ```sh 13 | deno task client 14 | ``` 15 | 16 | --- 17 | 18 | Created by [tomlienard](https://github.com/quiibz). 19 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/express-minimal/README.md: -------------------------------------------------------------------------------- 1 | # Express Minimal Example 2 | 3 | ## Includes 4 | 5 | - Express server 6 | - Vanilla TRPCClient in Node 7 | 8 | ## Usage 9 | 10 | Run the server and client: 11 | 12 | ```bash 13 | yarn start 14 | ``` 15 | 16 | Tip: Try changing either the procedure name or it's input on the server and see the client type-erroring. 17 | 18 | --- 19 | 20 | Created by [Julius](https://github.com/juliusmarminge). 21 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/express-minimal/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["esnext", "dom"], 4 | "target": "esnext", 5 | "esModuleInterop": true, 6 | "strict": true, 7 | "moduleResolution": "node", 8 | "noEmit": true, 9 | "skipLibCheck": true 10 | }, 11 | "include": ["src"], 12 | "exclude": ["node_modules"] 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/express-server/README.md: -------------------------------------------------------------------------------- 1 | - Express server 2 | - Vanilla TRPCClient in node 3 | 4 | --- 5 | 6 | Created by [@alexdotjs](https://twitter.com/alexdotjs). 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/express-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["esnext", "dom"], 4 | "target": "esnext", 5 | "esModuleInterop": true, 6 | "strict": true, 7 | "moduleResolution": "node", 8 | "noEmit": true, 9 | "skipLibCheck": true 10 | }, 11 | "include": ["src"], 12 | "exclude": ["node_modules"] 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "view": "console", 3 | "container": { 4 | "node": "20" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/src/client/polyfill.ts: -------------------------------------------------------------------------------- 1 | import { WebSocket } from 'ws'; 2 | 3 | globalThis.WebSocket = WebSocket as any; 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/src/config.ts: -------------------------------------------------------------------------------- 1 | import type { ServerOptions } from './server/server'; 2 | 3 | export const serverConfig: ServerOptions = { 4 | dev: false, 5 | port: 2022, 6 | prefix: '/trpc', 7 | }; 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/src/server/index.ts: -------------------------------------------------------------------------------- 1 | import { serverConfig } from '../config'; 2 | import { createServer } from './server'; 3 | 4 | const server = createServer(serverConfig); 5 | 6 | void server.start(); 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/src/server/router/context.ts: -------------------------------------------------------------------------------- 1 | import type { CreateFastifyContextOptions } from '@trpc/server/adapters/fastify'; 2 | 3 | export interface User { 4 | name: string[] | string; 5 | } 6 | 7 | export function createContext({ req, res }: CreateFastifyContextOptions) { 8 | const user: User = { name: req.headers.username ?? 'anonymous' }; 9 | 10 | return { req, res, user }; 11 | } 12 | 13 | export type Context = Awaited>; 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/src/server/router/index.ts: -------------------------------------------------------------------------------- 1 | import { apiRouter } from './routers/api'; 2 | import { postsRouter } from './routers/posts'; 3 | import { subRouter } from './routers/sub'; 4 | import { router } from './trpc'; 5 | 6 | export const appRouter = router({ 7 | posts: postsRouter, 8 | sub: subRouter, 9 | api: apiRouter, 10 | }); 11 | 12 | export type AppRouter = typeof appRouter; 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/src/server/router/trpc.ts: -------------------------------------------------------------------------------- 1 | import { initTRPC } from '@trpc/server'; 2 | import superjson from 'superjson'; 3 | import type { Context } from './context'; 4 | 5 | const t = initTRPC.context().create({ 6 | transformer: superjson, 7 | errorFormatter({ shape }) { 8 | return shape; 9 | }, 10 | }); 11 | 12 | export const router = t.router; 13 | export const publicProcedure = t.procedure; 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/fastify-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["esnext", "dom"], 4 | "target": "esnext", 5 | "esModuleInterop": true, 6 | "strict": true, 7 | "moduleResolution": "node", 8 | "noEmit": true, 9 | "skipLibCheck": true 10 | }, 11 | "include": ["src"], 12 | "exclude": ["node_modules"] 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/kitchen-sink/README.md: -------------------------------------------------------------------------------- 1 | # tRPC Kitchen Sink 2 | 3 | **Go to https://github.com/trpc/examples-kitchen-sink** 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/lambda-api-gateway/.gitignore: -------------------------------------------------------------------------------- 1 | .build 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/lambda-api-gateway/src/client.ts: -------------------------------------------------------------------------------- 1 | import { createTRPCClient, httpBatchLink } from '@trpc/client'; 2 | import type { AppRouter } from './server'; 3 | 4 | const client = createTRPCClient({ 5 | links: [httpBatchLink({ url: 'http://localhost:4050' })], 6 | }); 7 | 8 | void (async () => { 9 | try { 10 | const q = await client.greet.query({ name: 'Erik' }); 11 | console.log(q); 12 | } catch (error) { 13 | console.log('error', error); 14 | } 15 | })(); 16 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/lambda-api-gateway/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["esnext", "dom"], 4 | "target": "esnext", 5 | "esModuleInterop": true, 6 | "strict": true, 7 | "moduleResolution": "node", 8 | "noEmit": true 9 | }, 10 | "include": ["src"], 11 | "exclude": ["node_modules"] 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/README.md: -------------------------------------------------------------------------------- 1 | # A minimal React tRPC example 2 | 3 | Requires node 18 (for global fetch). 4 | 5 | ## Playing around 6 | 7 | ```bash 8 | npm i 9 | npm run dev 10 | ``` 11 | 12 | Try editing the ts files to see the type checking in action :) 13 | 14 | ## Building 15 | 16 | ```bash 17 | npm run build 18 | npm run start 19 | ``` 20 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/client/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React + TS 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/client/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import { App } from './App'; 4 | 5 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 6 | ReactDOM.createRoot(document.getElementById('root')!).render( 7 | 8 | 9 | , 10 | ); 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/client/src/utils/trpc.ts: -------------------------------------------------------------------------------- 1 | import { createTRPCReact } from '@trpc/react-query'; 2 | import type { AppRouter } from '../../../server'; 3 | 4 | export const trpc = createTRPCReact(); 5 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/client/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/client/vite.config.ts: -------------------------------------------------------------------------------- 1 | import react from '@vitejs/plugin-react'; 2 | import { defineConfig } from 'vite'; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | server: { 7 | port: 3000, 8 | }, 9 | preview: { 10 | port: 3000, 11 | }, 12 | plugins: [react()], 13 | }); 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "moduleResolution": "node", 4 | "esModuleInterop": true, 5 | "target": "ESNext", 6 | "strict": true, 7 | "outDir": "dist" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-content-types/test/smoke.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from '@playwright/test'; 2 | 3 | test.setTimeout(35e3); 4 | 5 | test('go to /', async ({ page }) => { 6 | await page.goto('/'); 7 | 8 | await page.waitForSelector(`text=tRPC user`); 9 | }); 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/README.md: -------------------------------------------------------------------------------- 1 | # A minimal React tRPC example 2 | 3 | Requires node 18 (for global fetch). 4 | 5 | ## Playing around 6 | 7 | ```bash 8 | npm i 9 | npm run dev 10 | ``` 11 | 12 | Try editing the ts files to see the type checking in action :) 13 | 14 | ## Building 15 | 16 | ```bash 17 | npm run build 18 | npm run start 19 | ``` 20 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/client/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React + TS 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/client/src/Greeting.tsx: -------------------------------------------------------------------------------- 1 | import { trpc } from './utils/trpc'; 2 | 3 | export function Greeting() { 4 | const greeting = trpc.greeting.useQuery({ name: 'tRPC user' }); 5 | 6 | return
{greeting.data?.text}
; 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/client/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import { App } from './App'; 4 | 5 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 6 | ReactDOM.createRoot(document.getElementById('root')!).render( 7 | 8 | 9 | , 10 | ); 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/client/src/utils/trpc.ts: -------------------------------------------------------------------------------- 1 | import { createTRPCReact } from '@trpc/react-query'; 2 | import type { AppRouter } from '../../../server'; 3 | 4 | export const trpc = createTRPCReact(); 5 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/client/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/client/vite.config.ts: -------------------------------------------------------------------------------- 1 | import react from '@vitejs/plugin-react'; 2 | import { defineConfig } from 'vite'; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | server: { 7 | port: 3000, 8 | }, 9 | preview: { 10 | port: 3000, 11 | }, 12 | plugins: [react()], 13 | }); 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["es2023"], 4 | "module": "node16", 5 | "target": "es2022", 6 | 7 | "strict": true, 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "moduleResolution": "node16", 11 | "outDir": "dist" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal-react/test/smoke.test.ts: -------------------------------------------------------------------------------- 1 | import { test } from '@playwright/test'; 2 | 3 | test.setTimeout(35e3); 4 | 5 | test('go to /', async ({ page }) => { 6 | await page.goto('/'); 7 | 8 | await page.waitForSelector(`text=tRPC user`); 9 | }); 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal/README.md: -------------------------------------------------------------------------------- 1 | # A minimal working tRPC example 2 | 3 | Requires node 18 (for global fetch). 4 | 5 | ## Playing around 6 | 7 | ``` 8 | npm i 9 | npm run dev 10 | ``` 11 | 12 | Try editing the ts files to see the type checking in action :) 13 | 14 | ## Building 15 | 16 | ``` 17 | npm run build 18 | npm run start 19 | ``` 20 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal/src/server/db.ts: -------------------------------------------------------------------------------- 1 | type User = { id: string; name: string }; 2 | 3 | // Imaginary database 4 | const users: User[] = []; 5 | export const db = { 6 | user: { 7 | findMany: async () => users, 8 | findById: async (id: string) => users.find((user) => user.id === id), 9 | create: async (data: { name: string }) => { 10 | const user = { id: String(users.length + 1), ...data }; 11 | users.push(user); 12 | return user; 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal/src/server/trpc.ts: -------------------------------------------------------------------------------- 1 | import { initTRPC } from '@trpc/server'; 2 | 3 | /** 4 | * Initialization of tRPC backend 5 | * Should be done only once per backend! 6 | */ 7 | const t = initTRPC.create(); 8 | 9 | /** 10 | * Export reusable router and procedure helpers 11 | * that can be used throughout the router 12 | */ 13 | export const router = t.router; 14 | export const publicProcedure = t.procedure; 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/minimal/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "NodeNext", 5 | "moduleResolution": "NodeNext", 6 | "esModuleInterop": true, 7 | "strict": true, 8 | "outDir": "dist", 9 | "skipLibCheck": true 10 | }, 11 | "include": ["src"] 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-big-router/.gitignore: -------------------------------------------------------------------------------- 1 | .next 2 | src/server/routers 3 | node_modules 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-big-router/README.md: -------------------------------------------------------------------------------- 1 | This is an example to preview how the DX is when making a big router with tRPC v10. 2 | 3 | It has a `postinstall`-script that generates 700 procedures (which you can modify in `scripts/codegen.ts`). 4 | 5 | ```bash 6 | git clone git@github.com:trpc/examples-v10-next-big-router.git 7 | cd examples-v10-next-big-router 8 | yarn && code . && yarn dev 9 | ``` 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-big-router/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-big-router/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | /** We run eslint as a separate task in CI */ 5 | eslint: { ignoreDuringBuilds: !!process.env.CI }, 6 | } satisfies NextConfig; 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-big-router/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppType } from 'next/app'; 2 | import { trpc } from '../utils/trpc'; 3 | 4 | const MyApp: AppType = ({ Component, pageProps }) => { 5 | return ; 6 | }; 7 | 8 | export default trpc.withTRPC(MyApp); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-big-router/src/server/trpc.ts: -------------------------------------------------------------------------------- 1 | import { initTRPC } from '@trpc/server'; 2 | import type { Context } from './context'; 3 | 4 | export const t = initTRPC.context().create(); 5 | 6 | export const router = t.router; 7 | 8 | export const publicProcedure = t.procedure; 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-edge-runtime/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-edge-runtime/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | /** We run eslint as a separate task in CI */ 5 | eslint: { ignoreDuringBuilds: !!process.env.CI }, 6 | } satisfies NextConfig; 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-edge-runtime/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppType } from 'next/app'; 2 | import { trpc } from '../utils/trpc'; 3 | 4 | const MyApp: AppType = ({ Component, pageProps }) => { 5 | return ; 6 | }; 7 | 8 | export default trpc.withTRPC(MyApp); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/.gitignore: -------------------------------------------------------------------------------- 1 | public/uploads -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/README.md: -------------------------------------------------------------------------------- 1 | # Next.js + tRPC + `FormData` 2 | 3 | This example showcases how to use tRPC with `FormData`. 4 | 5 | ## Setup 6 | 7 | ```bash 8 | npx create-next-app --example https://github.com/trpc/trpc --example-path examples/next-formdata trpc-formdata 9 | cd trpc-formdata 10 | npm i 11 | npm run dev 12 | ``` 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | /** We run eslint as a separate task in CI */ 5 | eslint: { ignoreDuringBuilds: !!process.env.CI }, 6 | } satisfies NextConfig; 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppType } from 'next/app'; 2 | import { trpc } from '../utils/trpc'; 3 | 4 | const MyApp: AppType = ({ Component, pageProps }) => { 5 | return ; 6 | }; 7 | 8 | export default trpc.withTRPC(MyApp); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link'; 2 | 3 | export default function IndexPage() { 4 | return ( 5 |
    6 |
  • 7 | /vanilla 8 |
  • 9 |
  • 10 | /react-hook-form 11 |
  • 12 |
13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/src/server/routers/room.ts: -------------------------------------------------------------------------------- 1 | import { uploadFileSchema } from '~/utils/schemas'; 2 | import { writeFileToDisk } from '../../utils/writeFileToDisk'; 3 | import { publicProcedure, router } from '../trpc'; 4 | 5 | export const roomRouter = router({ 6 | sendMessage: publicProcedure 7 | .input(uploadFileSchema) 8 | .mutation(async (opts) => { 9 | return { 10 | image: await writeFileToDisk(opts.input.image), 11 | }; 12 | }), 13 | }); 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-formdata/src/utils/schemas.ts: -------------------------------------------------------------------------------- 1 | import { zfd } from 'zod-form-data'; 2 | 3 | export const uploadFileSchema = zfd.formData({ 4 | name: zfd.text(), 5 | image: zfd.file(), 6 | }); 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-minimal-starter/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-minimal-starter/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | /** We run eslint as a separate task in CI */ 5 | eslint: { ignoreDuringBuilds: !!process.env.CI }, 6 | } satisfies NextConfig; 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-minimal-starter/src/pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import type { AppType } from 'next/app'; 2 | import { trpc } from '../utils/trpc'; 3 | 4 | const MyApp: AppType = ({ Component, pageProps }) => { 5 | return ; 6 | }; 7 | 8 | export default trpc.withTRPC(MyApp); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/.env: -------------------------------------------------------------------------------- 1 | # Make sure to override these in deployment 2 | DATABASE_URL=postgresql://postgres:@localhost:5432/next-prisma-starter-new 3 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: KATT 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: '/' 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 2 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/.npmrc: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts=true 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "esbenp.prettier-vscode", 4 | "dbaeumer.vscode-eslint", 5 | "prisma.prisma" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/prisma/migrations/20220307124425_non_unique_timestamps/migration.sql: -------------------------------------------------------------------------------- 1 | -- DropIndex 2 | DROP INDEX "Post_createdAt_key"; 3 | 4 | -- DropIndex 5 | DROP INDEX "Post_updatedAt_key"; 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/prisma/migrations/20220918091608_pagination/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - A unique constraint covering the columns `[createdAt]` on the table `Post` will be added. If there are existing duplicate values, this will fail. 5 | 6 | */ 7 | -- CreateIndex 8 | CREATE UNIQUE INDEX "Post_createdAt_key" ON "Post"("createdAt"); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/prisma/migrations/20220918134120_revert/migration.sql: -------------------------------------------------------------------------------- 1 | -- DropIndex 2 | DROP INDEX "Post_createdAt_key"; 3 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (i.e. Git) 3 | provider = "postgresql" -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/examples/next-prisma-starter/public/favicon.ico -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "next" 3 | } 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/src/styles/globals.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | body { 7 | height: 100vh; 8 | background-color: rgb(31 41 55); 9 | color: #fff; 10 | padding: 0 32px; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/src/utils/transformer.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * If you need to add transformers for special data types like `Temporal.Instant` or `Temporal.Date`, `Decimal.js`, etc you can do so here. 3 | * Make sure to import this file rather than `superjson` directly. 4 | * @see https://github.com/blitz-js/superjson#recipes 5 | */ 6 | import superjson from 'superjson'; 7 | 8 | export const transformer = superjson; 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'tailwindcss'; 2 | 3 | const config: Config = { 4 | content: [ 5 | './src/pages/**/*.{js,ts,jsx,tsx}', 6 | './src/components/**/*.{js,ts,jsx,tsx}', 7 | ], 8 | theme: { 9 | extend: {}, 10 | }, 11 | plugins: [], 12 | }; 13 | 14 | export default config; 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-starter/vitest.config.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath } from 'url'; 2 | import { configDefaults, defineConfig } from 'vitest/config'; 3 | 4 | export default defineConfig({ 5 | test: { 6 | globals: true, 7 | exclude: [...configDefaults.exclude, '**/playwright/**'], 8 | alias: { 9 | '~/': fileURLToPath(new URL('./src/', import.meta.url)), 10 | }, 11 | setupFiles: ['dotenv/config'], 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/prisma/migrations/20210304121245_/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "Task" ( 3 | "id" TEXT NOT NULL, 4 | "text" TEXT NOT NULL, 5 | "completed" BOOLEAN NOT NULL DEFAULT false, 6 | "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, 7 | 8 | PRIMARY KEY ("id") 9 | ); 10 | 11 | -- CreateIndex 12 | CREATE UNIQUE INDEX "Task.createdAt_unique" ON "Task"("createdAt"); 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (i.e. Git) 3 | provider = "postgresql" -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/examples/next-prisma-todomvc/public/favicon.ico -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/src/server/prisma.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @see https://prisma.io/docs/support/help-articles/nextjs-prisma-client-dev-practices 3 | */ 4 | import { PrismaClient } from '@prisma/client'; 5 | 6 | const globalForPrisma = global as unknown as { prisma: PrismaClient }; 7 | 8 | export const prisma = globalForPrisma.prisma || new PrismaClient(); 9 | 10 | if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma; 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/src/server/routers/_app.ts: -------------------------------------------------------------------------------- 1 | import { baseProcedure, router } from '../trpc'; 2 | import { todoRouter } from './todo'; 3 | 4 | export const appRouter = router({ 5 | todo: todoRouter, 6 | 7 | i18n: baseProcedure.query(({ ctx }) => ({ 8 | i18n: ctx.i18n, 9 | locale: ctx.locale, 10 | })), 11 | }); 12 | 13 | export type AppRouter = typeof appRouter; 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/src/server/trpc.ts: -------------------------------------------------------------------------------- 1 | import { initTRPC } from '@trpc/server'; 2 | import superjson from 'superjson'; 3 | import type { createInnerTRPCContext } from './context'; 4 | 5 | const t = initTRPC.context().create({ 6 | transformer: superjson, 7 | }); 8 | 9 | export const router = t.router; 10 | export const baseProcedure = t.procedure; 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/src/utils/use-locale.tsx: -------------------------------------------------------------------------------- 1 | import { useTranslation } from 'next-i18next'; 2 | 3 | export const useLocale = ( 4 | namespace: Parameters[0] = 'common', 5 | ) => useTranslation(namespace); 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-todomvc/vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "github": { 3 | "silent": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: KATT 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: '/' 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 2 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/.npmrc: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts=true 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "esbenp.prettier-vscode", 4 | "dbaeumer.vscode-eslint", 5 | "prisma.prisma" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | postgres: 4 | image: postgres:13 5 | ports: 6 | - '5932:5432' # expose pg on port 5932 to not collide with pg from elsewhere 7 | restart: always 8 | volumes: 9 | - db_data:/var/lib/postgresql/data 10 | environment: 11 | POSTGRES_PASSWORD: ${PGPASSWORD} 12 | POSTGRES_HOST_AUTH_METHOD: trust 13 | volumes: 14 | db_data: 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/prisma/migrations/20210704013430_/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateTable 2 | CREATE TABLE "Post" ( 3 | "id" TEXT NOT NULL, 4 | "title" TEXT NOT NULL, 5 | "text" TEXT NOT NULL, 6 | 7 | PRIMARY KEY ("id") 8 | ); 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/prisma/migrations/20210704022645_name/migration.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Warnings: 3 | 4 | - You are about to drop the column `title` on the `Post` table. All the data in the column will be lost. 5 | - Added the required column `name` to the `Post` table without a default value. This is not possible if the table is not empty. 6 | 7 | */ 8 | -- AlterTable 9 | ALTER TABLE "Post" DROP COLUMN "title", 10 | ADD COLUMN "name" TEXT NOT NULL; 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/prisma/migrations/20210718182836_poster_source/migration.sql: -------------------------------------------------------------------------------- 1 | -- CreateEnum 2 | CREATE TYPE "PosterSource" AS ENUM ('RAW', 'GITHUB'); 3 | 4 | -- AlterTable 5 | ALTER TABLE "Post" ADD COLUMN "source" "PosterSource" NOT NULL DEFAULT E'RAW'; 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/prisma/migrations/20211027034151_/migration.sql: -------------------------------------------------------------------------------- 1 | -- RenameIndex 2 | ALTER INDEX "Post.createdAt_unique" RENAME TO "Post_createdAt_key"; 3 | 4 | -- RenameIndex 5 | ALTER INDEX "Post.updatedAt_unique" RENAME TO "Post_updatedAt_key"; 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/prisma/migrations/migration_lock.toml: -------------------------------------------------------------------------------- 1 | # Please do not edit this file manually 2 | # It should be added in your version-control system (i.e. Git) 3 | provider = "postgresql" -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/examples/next-prisma-websockets-starter/public/favicon.ico -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "next" 3 | } 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/src/styles/global.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'tailwindcss'; 2 | 3 | const config: Config = { 4 | content: ['./src/pages/**/*.{js,ts,jsx,tsx}'], 5 | theme: { 6 | extend: {}, 7 | }, 8 | plugins: [], 9 | }; 10 | 11 | export default config; 12 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-prisma-websockets-starter/tsconfig.server.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "dist", 6 | "target": "ES2019", 7 | "lib": ["ES2019", "DOM"], 8 | "isolatedModules": false, 9 | "noEmit": false 10 | }, 11 | "include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx"] 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/.env.example: -------------------------------------------------------------------------------- 1 | POSTGRES_URL=postgres://postgres:@0.0.0.0:5432/postgres 2 | NEXTAUTH_URL=http://localhost:3000 3 | NEXTAUTH_SECRET=secret 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/docker-compose.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/examples/next-sse-chat/docker-compose.yaml -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/next.config.ts: -------------------------------------------------------------------------------- 1 | import { NextConfig } from 'next'; 2 | 3 | export default { 4 | output: 'standalone', 5 | } satisfies NextConfig; 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/postcss.config.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: { 3 | tailwindcss: {}, 4 | }, 5 | }; 6 | 7 | export default config; 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/src/app/api/auth/[...nextauth]/route.ts: -------------------------------------------------------------------------------- 1 | import { handlers } from '~/server/auth'; 2 | 3 | export const { GET, POST } = handlers; 4 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/src/lib/query-client.ts: -------------------------------------------------------------------------------- 1 | import { QueryClient } from '@tanstack/react-query'; 2 | 3 | export const createQueryClient = () => 4 | new QueryClient({ 5 | defaultOptions: { 6 | queries: { 7 | // With SSR, we usually want to set some default staleTime 8 | // above 0 to avoid refetching immediately on the client 9 | staleTime: 30 * 1000, 10 | }, 11 | }, 12 | }); 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/src/lib/trpc.ts: -------------------------------------------------------------------------------- 1 | import { createTRPCReact } from '@trpc/react-query'; 2 | import type { AppRouter } from '~/server/routers/_app'; 3 | 4 | export const trpc = createTRPCReact(); 5 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/src/server/db/client.ts: -------------------------------------------------------------------------------- 1 | import { drizzle } from 'drizzle-orm/postgres-js'; 2 | import postgres from 'postgres'; 3 | import * as schema from './schema'; 4 | 5 | const DB_URL = process.env.DATABASE_URL ?? process.env.POSTGRES_URL; 6 | if (!DB_URL) { 7 | throw new Error('Missing POSTGRES_URL or DATABASE_URL environment variable'); 8 | } 9 | 10 | const queryClient = postgres(DB_URL); 11 | export const db = drizzle(queryClient, { schema }); 12 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/src/server/db/migrations/0001_wet_tarantula.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "sse-chat_post" ALTER COLUMN "channel_id" SET NOT NULL;--> statement-breakpoint 2 | ALTER TABLE "sse-chat_post" ALTER COLUMN "name" SET NOT NULL;--> statement-breakpoint 3 | ALTER TABLE "sse-chat_post" ALTER COLUMN "text" SET NOT NULL; -------------------------------------------------------------------------------- /external-repos/trpc/examples/next-sse-chat/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'tailwindcss'; 2 | 3 | export default { 4 | content: ['./src/components/**/*.{tsx,mdx}', './src/app/**/*.{tsx,mdx}'], 5 | theme: { 6 | extend: { 7 | fontFamily: { 8 | sans: 'var(--font-inter), system-ui, sans-serif', 9 | }, 10 | }, 11 | }, 12 | } satisfies Config; 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/soa/client/index.ts: -------------------------------------------------------------------------------- 1 | import { client } from './client.js'; 2 | 3 | { 4 | const result = await client.serverA.greet.query('tRPC'); 5 | 6 | console.log(result.greeting); 7 | // ^? 8 | } 9 | { 10 | const result = await client.serverB.foo.query(); 11 | 12 | console.log({ result }); 13 | // ^? 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/soa/faux-gateway/index.ts: -------------------------------------------------------------------------------- 1 | import { serverA_appRouter } from '../server-a/router.js'; 2 | import { serverB_appRouter } from '../server-b/router.js'; 3 | import { router } from '../server-lib/index.js'; 4 | 5 | const appRouter = router({ 6 | serverA: serverA_appRouter, 7 | serverB: serverB_appRouter, 8 | }); 9 | 10 | export type AppRouter = typeof appRouter; 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/soa/server-a/index.ts: -------------------------------------------------------------------------------- 1 | import { createHTTPServer } from '@trpc/server/adapters/standalone'; 2 | import { serverA_appRouter } from './router.js'; 3 | 4 | const port = 2021; 5 | 6 | createHTTPServer({ 7 | router: serverA_appRouter, 8 | createContext() { 9 | return {}; 10 | }, 11 | }).listen(port); 12 | 13 | console.log('server A listening on port', port); 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/soa/server-a/router.ts: -------------------------------------------------------------------------------- 1 | import { publicProcedure, router } from '../server-lib/index.js'; 2 | 3 | export const serverA_appRouter = router({ 4 | greet: publicProcedure 5 | .input((val: unknown) => { 6 | if (typeof val === 'string') return val; 7 | throw new Error(`Invalid input: ${typeof val}`); 8 | }) 9 | .query(({ input }) => ({ greeting: `hello, ${input}!` as const })), 10 | }); 11 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/soa/server-b/index.ts: -------------------------------------------------------------------------------- 1 | import { createHTTPServer } from '@trpc/server/adapters/standalone'; 2 | import { serverB_appRouter } from './router.js'; 3 | 4 | const port = 2022; 5 | 6 | createHTTPServer({ 7 | router: serverB_appRouter, 8 | createContext() { 9 | return {}; 10 | }, 11 | }).listen(port); 12 | 13 | console.log('server B listening on port', port); 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/soa/server-b/router.ts: -------------------------------------------------------------------------------- 1 | import { publicProcedure, router } from '../server-lib/index.js'; 2 | 3 | export const serverB_appRouter = router({ 4 | foo: publicProcedure.query(() => 'bar' as const), 5 | }); 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/soa/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "module": "NodeNext", 5 | "moduleResolution": "NodeNext", 6 | "esModuleInterop": true, 7 | "strict": true, 8 | "outDir": "dist", 9 | "skipLibCheck": true 10 | }, 11 | "include": ["**/*.ts"] 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/standalone-server/README.md: -------------------------------------------------------------------------------- 1 | Bare-minimum example. 2 | 3 | - Standalone HTTP-server + WebSocket 4 | - Vanilla `TRPCClient` in node 5 | 6 | Try in StackBlitz: https://stackblitz.com/github/trpc/trpc/tree/main/examples/standalone-server?file=src%2Fserver.ts,src%2Fclient.ts&view=editor&terminal=dev 7 | 8 | --- 9 | 10 | ### Get started 11 | 12 | Created by [@alexdotjs](https://twitter.com/alexdotjs). 13 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/standalone-server/sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "view": "console", 3 | "container": { 4 | "node": "20" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/standalone-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["esnext", "dom"], 4 | "target": "esnext", 5 | "esModuleInterop": true, 6 | "strict": true, 7 | "moduleResolution": "node", 8 | "noEmit": true, 9 | "skipLibCheck": true 10 | }, 11 | "include": ["src"], 12 | "exclude": ["node_modules"] 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/README.md: -------------------------------------------------------------------------------- 1 | # trpc with Tanstack Start 2 | 3 | ### Playing around 4 | 5 | ```bash 6 | pnpm install 7 | pnpm dev 8 | ``` 9 | 10 | > [!TIP] 11 | > Try editing the app.config.ts deployment presets for different runtime builds. :) 12 | 13 | ## Building 14 | 15 | ```bash 16 | pnpm build 17 | pnpm start 18 | ``` 19 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@tanstack/start/config'; 2 | import tsConfigPaths from 'vite-tsconfig-paths'; 3 | 4 | export default defineConfig({ 5 | server: { 6 | // https://tanstack.com/router/v1/docs/framework/react/start/hosting 7 | preset: 'node-server', 8 | }, 9 | vite: { 10 | plugins: [ 11 | tsConfigPaths({ 12 | projects: ['./tsconfig.json'], 13 | }), 14 | ], 15 | }, 16 | }); 17 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/api.ts: -------------------------------------------------------------------------------- 1 | import { 2 | createStartAPIHandler, 3 | defaultAPIFileRouteHandler, 4 | } from '@tanstack/start/api'; 5 | 6 | export default createStartAPIHandler(defaultAPIFileRouteHandler); 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @layer base { 6 | /* html, 7 | body { 8 | @apply bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-200; 9 | } */ 10 | 11 | .using-mouse * { 12 | outline: none !important; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/client.tsx: -------------------------------------------------------------------------------- 1 | import { StartClient } from '@tanstack/start'; 2 | import { hydrateRoot } from 'react-dom/client'; 3 | import { createRouter } from './router'; 4 | 5 | const router = createRouter(); 6 | 7 | hydrateRoot(document.getElementById('root')!, ); 8 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/routes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createFileRoute } from '@tanstack/react-router'; 2 | 3 | export const Route = createFileRoute('/')({ 4 | component: Home, 5 | }); 6 | 7 | function Home() { 8 | return ( 9 |
10 |

Welcome Home!!!

11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/routes/posts.index.tsx: -------------------------------------------------------------------------------- 1 | import { createFileRoute } from '@tanstack/react-router'; 2 | 3 | export const Route = createFileRoute('/posts/')({ 4 | component: PostsIndexComponent, 5 | }); 6 | 7 | function PostsIndexComponent() { 8 | return
Select a post.
; 9 | } 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/routes/redirect.tsx: -------------------------------------------------------------------------------- 1 | import { createFileRoute, redirect } from '@tanstack/react-router'; 2 | 3 | export const Route = createFileRoute('/redirect')({ 4 | beforeLoad: async () => { 5 | throw redirect({ 6 | to: '/posts', 7 | }); 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/ssr.tsx: -------------------------------------------------------------------------------- 1 | import { getRouterManifest } from '@tanstack/start/router-manifest'; 2 | import { 3 | createStartHandler, 4 | defaultStreamHandler, 5 | } from '@tanstack/start/server'; 6 | import { createRouter } from './router'; 7 | 8 | export default createStartHandler({ 9 | createRouter, 10 | getRouterManifest, 11 | })(defaultStreamHandler); 12 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/trpc/init.ts: -------------------------------------------------------------------------------- 1 | import { initTRPC } from '@trpc/server'; 2 | import superjson from 'superjson'; 3 | 4 | const t = initTRPC.create({ 5 | transformer: superjson, 6 | }); 7 | 8 | export const createTRPCRouter = t.router; 9 | export const publicProcedure = t.procedure; 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/app/trpc/react.tsx: -------------------------------------------------------------------------------- 1 | import { createTRPCReact } from '@trpc/react-query'; 2 | import type { TRPCRouter } from './router'; 3 | 4 | export const trpc = createTRPCReact(); 5 | 6 | export const useTRPC = () => { 7 | return trpc.useUtils(); 8 | }; 9 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/tanstack-start/tailwind.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from 'tailwindcss'; 2 | 3 | export default { 4 | content: ['./app/**/*.{ts,tsx}'], 5 | } satisfies Config; 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/trpc-chrome/README.md: -------------------------------------------------------------------------------- 1 | # trpc-chrome 2 | 3 | ### Plasmo 4 | 5 | **Go to https://github.com/jlalmes/trpc-chrome/tree/master/examples/with-plasmo** 6 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/trpc-openapi/README.md: -------------------------------------------------------------------------------- 1 | # trpc-openapi 2 | 3 | ### Next.js 4 | 5 | **Go to https://github.com/jlalmes/trpc-openapi/tree/master/examples/with-nextjs** 6 | 7 | ### Express 8 | 9 | **Go to https://github.com/jlalmes/trpc-openapi/tree/master/examples/with-express** 10 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/vercel-edge-runtime/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/vercel-edge-runtime/README.md: -------------------------------------------------------------------------------- 1 | - [Vercel Edge Runtime](https://edge-runtime.vercel.app) 2 | - Vanilla TRPCClient in node 3 | 4 | --- 5 | 6 | Created by [tomlienard](https://github.com/quiibz). 7 | -------------------------------------------------------------------------------- /external-repos/trpc/examples/vercel-edge-runtime/src/index.ts: -------------------------------------------------------------------------------- 1 | import { fetchRequestHandler } from '@trpc/server/adapters/fetch'; 2 | import { appRouter } from './router'; 3 | 4 | addEventListener('fetch', (event) => { 5 | return event.respondWith( 6 | fetchRequestHandler({ 7 | endpoint: '/trpc', 8 | req: event.request, 9 | router: appRouter, 10 | createContext: () => ({}), 11 | }), 12 | ); 13 | }); 14 | -------------------------------------------------------------------------------- /external-repos/trpc/lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "10.45.1", 3 | "registry": "https://registry.npmjs.org/", 4 | "npmClient": "pnpm", 5 | "$schema": "node_modules/lerna/schemas/lerna-schema.json" 6 | } 7 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/client/entrypoints.script.ts: -------------------------------------------------------------------------------- 1 | import { generateEntrypoints } from '../../scripts/entrypoints'; 2 | import { input } from './rollup.config'; 3 | 4 | // eslint-disable-next-line no-console 5 | generateEntrypoints(input).catch(console.error); 6 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/client/src/unstable-internals.ts: -------------------------------------------------------------------------------- 1 | export * from './internals/transformer'; 2 | export * from './links/internals/subscriptions'; 3 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/client/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "declarationDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/client/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "codegen-entrypoints": { 6 | "outputs": [ 7 | "package.json", 8 | "dist/**", 9 | "links/**", 10 | "unstable-internals/**" 11 | ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/client/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export { default } from '../../vitest.config'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/next/entrypoints.script.ts: -------------------------------------------------------------------------------- 1 | import { generateEntrypoints } from '../../scripts/entrypoints'; 2 | import { input } from './rollup.config'; 3 | 4 | // eslint-disable-next-line no-console 5 | generateEntrypoints(input).catch(console.error); 6 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/next/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './withTRPC'; 2 | export * from './createTRPCNext'; 3 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/next/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "declarationDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/next/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/next/tsconfig.watch.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "target": "ES2020", 7 | "noEmit": true, 8 | "emitDeclarationOnly": false, 9 | "pretty": true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/next/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "codegen-entrypoints": { 6 | "outputs": ["package.json", "dist/**", "app-dir/**", "ssrPrepass/**"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/next/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export { default } from '../../vitest.config'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/entrypoints.script.ts: -------------------------------------------------------------------------------- 1 | import { generateEntrypoints } from '../../scripts/entrypoints'; 2 | import { input } from './rollup.config'; 3 | 4 | // eslint-disable-next-line no-console 5 | generateEntrypoints(input).catch(console.error); 6 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from '@trpc/client'; 2 | 3 | export { getQueryKey, getMutationKey } from './internals/getQueryKey'; 4 | export { 5 | createTRPCReact, 6 | type CreateTRPCReact, 7 | type CreateTRPCReactBase, 8 | } from './createTRPCReact'; 9 | export type { inferReactQueryProcedureOptions } from './utils/inferReactQueryProcedure'; 10 | export { createTRPCQueryUtils } from './createTRPCQueryUtils'; 11 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/src/server/index.ts: -------------------------------------------------------------------------------- 1 | export { createServerSideHelpers } from './ssgProxy'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/src/shared/hooks/createRootHooks.tsx: -------------------------------------------------------------------------------- 1 | // NOTE: This indirection is only needed to break a circular-reference. 2 | // After removal of `hooks/deprecated/createHooksInternal` file, 3 | // `hooks/createHooksInternal` can be swapped for all `createRootHooks` imports. 4 | export { createRootHooks } from './createHooksInternal'; 5 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/src/shared/polymorphism/index.ts: -------------------------------------------------------------------------------- 1 | export * from './mutationLike'; 2 | export * from './queryLike'; 3 | export * from './routerLike'; 4 | export * from './utilsLike'; 5 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "declarationDir": "dist" 5 | }, 6 | "include": ["src"] 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "codegen-entrypoints": { 6 | "outputs": ["package.json", "dist/**", "rsc/**", "server/**", "shared/**"] 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/react-query/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export { default } from '../../vitest.config'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/entrypoints.script.ts: -------------------------------------------------------------------------------- 1 | import { generateEntrypoints } from '../../scripts/entrypoints'; 2 | import { input } from './rollup.config.js'; 3 | 4 | // eslint-disable-next-line no-console 5 | generateEntrypoints(input).catch(console.error); 6 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/adapters/fastify/index.ts: -------------------------------------------------------------------------------- 1 | export * from './fastifyRequestHandler'; 2 | export * from './fastifyTRPCPlugin'; 3 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/adapters/fetch/index.ts: -------------------------------------------------------------------------------- 1 | export * from './fetchRequestHandler'; 2 | export * from './types'; 3 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/adapters/next-app-dir.ts: -------------------------------------------------------------------------------- 1 | export { nextAppDirCaller as experimental_nextAppDirCaller } from './next-app-dir/nextAppDirCaller'; 2 | export { redirect as experimental_redirect } from './next-app-dir/redirect'; 3 | export { notFound as experimental_notFound } from './next-app-dir/notFound'; 4 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/adapters/next-app-dir/notFound.ts: -------------------------------------------------------------------------------- 1 | import type { notFound as __notFound } from 'next/navigation'; 2 | import { TRPCError } from '../../@trpc/server'; 3 | 4 | /** 5 | * Like `next/navigation`'s `notFound()` but throws a `TRPCError` that later will be handled by Next.js 6 | * @public 7 | */ 8 | export const notFound: typeof __notFound = () => { 9 | throw new TRPCError({ 10 | code: 'NOT_FOUND', 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/adapters/node-http/index.ts: -------------------------------------------------------------------------------- 1 | export * from './nodeHTTPRequestHandler'; 2 | export * from './types'; 3 | export * from './incomingMessageToRequest'; 4 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/http.ts: -------------------------------------------------------------------------------- 1 | export * from './@trpc/server/http'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './@trpc/server'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/rpc.ts: -------------------------------------------------------------------------------- 1 | export * from './@trpc/server/rpc'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/vendor/unpromise/ATTRIBUTION.txt: -------------------------------------------------------------------------------- 1 | Origin source: https://github.com/cefn/watchable/tree/main/packages/unpromise 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/src/vendor/unpromise/index.ts: -------------------------------------------------------------------------------- 1 | export { Unpromise } from "./unpromise"; 2 | export type { 3 | ProxyPromise, 4 | SubscribedPromise, 5 | PromiseExecutor, 6 | PromiseWithResolvers, 7 | } from "./types"; 8 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/tsconfig.benchmark.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.build.json", 3 | "compilerOptions": { 4 | "noEmit": true, 5 | "extendedDiagnostics": true, 6 | "emitDeclarationOnly": false, 7 | "incremental": true 8 | }, 9 | "include": ["src"] 10 | } 11 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.build.json", 3 | "compilerOptions": { 4 | "declarationDir": "dist", 5 | "types": ["node"] 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // https://github.com/tsconfig/bases/blob/main/bases/node18.json 6 | "lib": ["es2023", "DOM", "DOM.Iterable"], 7 | "target": "es2022", 8 | "module": "Node16", 9 | "moduleResolution": "Node16" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "extends": ["//"], 4 | "tasks": { 5 | "codegen-entrypoints": { 6 | "outputs": [ 7 | "package.json", 8 | "dist/**", 9 | "adapters/**", 10 | "http/**", 11 | "observable/**", 12 | "rpc/**", 13 | "shared/**", 14 | "unstable-core-do-not-import/**" 15 | ] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/server/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export { default } from '../../vitest.config'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/tests/README.md: -------------------------------------------------------------------------------- 1 | # @trpc/tests 2 | 3 | This is the home for the entire test suite for `trpc`, including `@trpc/server`, `@trpc/client`, `@trpc/react-query` & `@trpc/next`. 4 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/tests/server/react/polymorphism.common.tsx: -------------------------------------------------------------------------------- 1 | import { initTRPC } from '@trpc/server'; 2 | 3 | export const t = initTRPC.create(); 4 | 5 | export type $RootTypes = (typeof t)['_config']['$types']; 6 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/tests/server/regression/issue-2856-middleware-infer.test.ts: -------------------------------------------------------------------------------- 1 | import type { TRPCError } from '@trpc/server'; 2 | import { initTRPC } from '@trpc/server'; 3 | 4 | test('middleware next()', async () => { 5 | const t = initTRPC.create(); 6 | t.middleware(async (opts) => { 7 | const result = await opts.next(); 8 | 9 | if (!result.ok) { 10 | expectTypeOf(result.error).toEqualTypeOf(); 11 | } 12 | 13 | return result; 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/tests/server/regression/issue-3351-TRPCError.test.ts: -------------------------------------------------------------------------------- 1 | import '../___testHelpers'; 2 | import { TRPCError } from '@trpc/server'; 3 | 4 | test('TRPCError cause', async () => { 5 | const err = new TRPCError({ 6 | code: 'INTERNAL_SERVER_ERROR', 7 | }); 8 | expect(err.cause).toBeUndefined(); 9 | }); 10 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/tests/setupTests.ts: -------------------------------------------------------------------------------- 1 | import '@testing-library/jest-dom/vitest'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["server", "showcase", "setupTests.ts", "vitest.config.ts"], 4 | "compilerOptions": { 5 | "skipLibCheck": true, 6 | "lib": ["ES2023", "DOM", "DOM.Iterable"], 7 | "target": "ES2023", 8 | "types": ["node", "vitest/globals"], 9 | "noUnusedLocals": false, 10 | "noEmit": true 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /external-repos/trpc/packages/tests/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export { default } from '../../vitest.config'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | - 'examples/*' 4 | - 'examples/.*/*' 5 | - 'examples/minimal/*' 6 | - 'examples/minimal-react/*' 7 | - 'examples/minimal-content-types/*' 8 | - 'www' 9 | - 'www/og-image' 10 | -------------------------------------------------------------------------------- /external-repos/trpc/vitest.workspace.json: -------------------------------------------------------------------------------- 1 | ["packages/*"] 2 | -------------------------------------------------------------------------------- /external-repos/trpc/www/.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 | 22 | 23 | .env 24 | 25 | 26 | /src/components/CompaniesUsing.script.output.ts 27 | -------------------------------------------------------------------------------- /external-repos/trpc/www/.npmrc: -------------------------------------------------------------------------------- 1 | auto-install-peers=true 2 | -------------------------------------------------------------------------------- /external-repos/trpc/www/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /external-repos/trpc/www/docs/.gitignore: -------------------------------------------------------------------------------- 1 | # Autogenerated by https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc 2 | typedoc/ -------------------------------------------------------------------------------- /external-repos/trpc/www/docs/community/contributing.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: contributing 3 | title: Contributing 4 | sidebar_label: Contributing 5 | slug: /community/contributing 6 | --- 7 | 8 | import Content from '@site/unversioned/_contributing.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/docs/community/love.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: love 3 | title: Testimonials / Love 4 | sidebar_label: Testimonials 5 | slug: /community/love 6 | --- 7 | 8 | import Content from '@site/unversioned/_love.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/docs/community/sponsors.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: sponsors 3 | title: Sponsors 4 | sidebar_label: Sponsors 5 | slug: /community/sponsors 6 | --- 7 | 8 | import Content from '@site/unversioned/_sponsors.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/docs/landing-intro/Step2.md: -------------------------------------------------------------------------------- 1 | ```ts 2 | const { listen } = createHTTPServer({ 3 | router: appRouter, 4 | }); 5 | 6 | // The API will now be listening on port 3000! 7 | listen(3000); 8 | ``` 9 | -------------------------------------------------------------------------------- /external-repos/trpc/www/docusaurus.twitterReload.js: -------------------------------------------------------------------------------- 1 | module.exports = (() => { 2 | return { 3 | onRouteUpdate() { 4 | window.twttr?.widgets?.load(); 5 | }, 6 | }; 7 | })(); 8 | -------------------------------------------------------------------------------- /external-repos/trpc/www/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module '@docusaurus/plugin-content-docs/client'; 2 | -------------------------------------------------------------------------------- /external-repos/trpc/www/og-image/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. 6 | -------------------------------------------------------------------------------- /external-repos/trpc/www/og-image/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/www/og-image/public/favicon.ico -------------------------------------------------------------------------------- /external-repos/trpc/www/og-image/utils/fetchFont.ts: -------------------------------------------------------------------------------- 1 | import { fontParams } from './zodParams'; 2 | 3 | const baseUrl = process.env.VERCEL 4 | ? 'https://' + process.env.VERCEL_URL 5 | : 'http://localhost:3001'; 6 | 7 | export const fetchFont = (family: string, weight?: number, text?: string) => 8 | fetch( 9 | `${baseUrl}/api/font?${fontParams.toSearchString({ 10 | family, 11 | weight, 12 | text, 13 | })}`, 14 | ).then((res) => res.arrayBuffer()); 15 | -------------------------------------------------------------------------------- /external-repos/trpc/www/shikiTwoslash.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | module.exports = { 3 | themes: ['min-light', 'github-dark'], 4 | }; 5 | -------------------------------------------------------------------------------- /external-repos/trpc/www/src/animations/popIn.ts: -------------------------------------------------------------------------------- 1 | import type { Variants } from 'framer-motion'; 2 | 3 | export const popIn: Variants = { 4 | hidden: { 5 | opacity: 0, 6 | y: 48, 7 | }, 8 | visible: { 9 | opacity: 1, 10 | y: 0, 11 | transition: { 12 | duration: 0.4, 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /external-repos/trpc/www/src/components/sponsors/.gitignore: -------------------------------------------------------------------------------- 1 | script.output.raw.json 2 | -------------------------------------------------------------------------------- /external-repos/trpc/www/src/utils/cn.ts: -------------------------------------------------------------------------------- 1 | import type { ClassValue } from 'clsx'; 2 | import { clsx } from 'clsx'; 3 | import { twMerge } from 'tailwind-merge'; 4 | 5 | export function cn(...inputs: ClassValue[]) { 6 | return twMerge(clsx(inputs)); 7 | } 8 | -------------------------------------------------------------------------------- /external-repos/trpc/www/src/utils/useEnv.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ 2 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; 3 | import type { parseEnv } from './env'; 4 | 5 | type Env = ReturnType; 6 | 7 | export function useEnv() { 8 | const { siteConfig } = useDocusaurusContext(); 9 | const customFields = siteConfig.customFields!; 10 | 11 | const env = customFields.env; 12 | 13 | return env as Env; 14 | } 15 | -------------------------------------------------------------------------------- /external-repos/trpc/www/static/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/www/static/.nojekyll -------------------------------------------------------------------------------- /external-repos/trpc/www/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/www/static/img/favicon.ico -------------------------------------------------------------------------------- /external-repos/trpc/www/static/logos/Documenso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/TypeScript-5-Design-Patterns-and-Best-Practices/77f4e0d9ee64a62081a88800a5a7d1af99a06998/external-repos/trpc/www/static/logos/Documenso.png -------------------------------------------------------------------------------- /external-repos/trpc/www/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@docusaurus/tsconfig", 3 | "compilerOptions": { 4 | "strict": true, 5 | "strictNullChecks": true, 6 | "noUncheckedIndexedAccess": true, 7 | "noEmit": true, 8 | "types": [ 9 | "node", 10 | "@docusaurus/module-type-aliases", 11 | "@docusaurus/theme-classic" 12 | ] 13 | }, 14 | "include": ["src", "*.ts", "*.js", ".eslintrc.js", "global.d.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /external-repos/trpc/www/types.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.md' { 2 | declare const component: React.FC; 3 | export default component; 4 | } 5 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-10.x/.gitignore: -------------------------------------------------------------------------------- 1 | # Autogenerated by https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc 2 | typedoc/ -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-10.x/community/contributing.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: contributing 3 | title: Contributing 4 | sidebar_label: Contributing 5 | slug: /community/contributing 6 | --- 7 | 8 | import Content from '@site/unversioned/_contributing.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-10.x/community/love.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: love 3 | title: Testimonials / Love 4 | sidebar_label: Testimonials 5 | slug: /community/love 6 | --- 7 | 8 | import Content from '@site/unversioned/_love.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-10.x/community/sponsors.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: sponsors 3 | title: Sponsors 4 | sidebar_label: Sponsors 5 | slug: /community/sponsors 6 | --- 7 | 8 | import Content from '@site/unversioned/_sponsors.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-10.x/landing-intro/Step2.md: -------------------------------------------------------------------------------- 1 | ```ts 2 | const { listen } = createHTTPServer({ 3 | router: appRouter, 4 | }); 5 | 6 | // The API will now be listening on port 3000! 7 | listen(3000); 8 | ``` 9 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-9.x/main/contributing.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: contributing 3 | title: Contributing 4 | sidebar_label: Contributing 5 | slug: /contributing 6 | --- 7 | 8 | import Content from '@site/unversioned/_contributing.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-9.x/main/love.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: love 3 | title: Testimonials / Love 4 | sidebar_label: Testimonials 5 | slug: /love 6 | --- 7 | 8 | import Content from '@site/unversioned/_love.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versioned_docs/version-9.x/main/sponsors.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | id: sponsors 3 | title: Sponsors 4 | sidebar_label: Sponsors 5 | slug: /sponsors 6 | --- 7 | 8 | import Content from '@site/unversioned/_sponsors.mdx'; 9 | 10 | 11 | -------------------------------------------------------------------------------- /external-repos/trpc/www/versions.json: -------------------------------------------------------------------------------- 1 | ["current", "10.x", "9.x"] 2 | -------------------------------------------------------------------------------- /vitest.workspace.ts: -------------------------------------------------------------------------------- 1 | export default ["chapters/*"]; 2 | --------------------------------------------------------------------------------