Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make inmemorycache compatible #2

Open
wants to merge 7 commits into
base: add_modify
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extends:

parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 2017
ecmaVersion: latest
sourceType: module
jsx: true

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.13.0
22.7.0
3 changes: 3 additions & 0 deletions apollo-client/.attw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignoreRules": ["false-esm", "cjs-resolves-to-esm"]
}
8 changes: 8 additions & 0 deletions apollo-client/.changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions apollo-client/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "apollographql/apollo-client" }
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions apollo-client/.changeset/modern-cows-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Type `MutationResult.reset` as an arrow function
5 changes: 5 additions & 0 deletions apollo-client/.changeset/tough-geese-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Better conform to Rules of React by avoiding write of ref in render for `useFragment`.
191 changes: 191 additions & 0 deletions apollo-client/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
version: 2.1

orbs:
secops: apollo/circleci-secops-orb@2.0.7

jobs:
# Filesize:
# docker:
# - image: cimg/node:20.2.0
# steps:
# - checkout
# - run: npm version
# - run: npm ci
# - run: npm run bundlesize

Lint:
docker:
- image: cimg/node:22.6.0
steps:
- checkout
- run: npm version
- run: npm ci
- run: npm run lint

Formatting:
docker:
- image: cimg/node:22.6.0
steps:
- checkout
- run: npm ci
- run: npm run check:format

Tests:
docker:
- image: cimg/node:22.6.0
parameters:
project:
type: string
steps:
- checkout
- run: npm run ci:precheck
- run: npm version
- run: npm ci
- run: if test "<< parameters.project >>" = "Core Tests"; then npm run test:memory; fi
- run:
name: Jest suite with coverage
command: npm run test:ci -- --selectProjects "<< parameters.project >>"
environment:
JEST_JUNIT_OUTPUT_FILE: "reports/junit/js-test-results-<< parameters.project >>.xml"
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit

BuildTarball:
docker:
- image: cimg/node:22.6.0
steps:
- checkout
- run: npm run ci:precheck
- run: npm version
- run: npm ci
- run: npm run build && cd dist && mv "$(npm pack --json | jq --raw-output '.[0].filename')" apollo-client.tgz
- persist_to_workspace:
root: dist
paths:
- apollo-client.tgz

IntegrationTests:
parameters:
framework:
type: string
react:
type: string
docker:
- image: cimg/node:22.6.0-browsers
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run: npm version
- run:
command: npm pkg set "overrides[@apollo/client]=/tmp/workspace/apollo-client.tgz"
working_directory: integration-tests
- run:
command: |
export VERSION=$(npm show react --json | jq '."dist-tags"."<< parameters.react >>"' -r)
npm pkg set "overrides[react]=${VERSION}" "overrides[react-dom]=${VERSION}"
working_directory: integration-tests
- run:
command: npm run ci-preparations --workspace=<< parameters.framework >> --if-present
working_directory: integration-tests
- run:
command: npm install
working_directory: integration-tests
- run:
command: npx playwright install-deps
working_directory: integration-tests
- run:
command: npx playwright install
working_directory: integration-tests
- run:
command: npm run build --workspace=<< parameters.framework >> --if-present
working_directory: integration-tests
- run:
command: npm run test --workspace=<< parameters.framework >>
working_directory: integration-tests

TestPeerDepTypes:
parameters:
externalPackage:
type: string
docker:
- image: cimg/node:22.6.0
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
working_directory: integration-tests/peerdeps-tsc
command: |
npm install
npm install @apollo/client@/tmp/workspace/apollo-client.tgz
npm install << parameters.externalPackage >>
npm test

workflows:
Build and Test:
jobs:
# - Filesize
- Tests:
matrix:
parameters:
project:
["Core Tests", "ReactDOM 17", "ReactDOM 18", "ReactDOM 19"]
- Formatting
- Lint
- BuildTarball
- IntegrationTests:
name: Integration Test << matrix.framework >> with React << matrix.react >>
requires:
- BuildTarball
matrix:
parameters:
framework:
- cra4
- cra5
- next
- dual-module-test-esm
- dual-module-test-standard
- vite
- vite-swc
# -browser-esm would need a package publish to npm/CDNs
react:
- latest
- next
exclude:
- framework: cra4
react: next
# next ships it's own React version anyways, no need to run this test twice
- framework: next
react: next
- TestPeerDepTypes:
name: Test external types for << matrix.externalPackage >>
requires:
- BuildTarball
matrix:
parameters:
externalPackage:
- "graphql@15"
- "graphql@16"
- "graphql@^17.0.0-alpha"
- "@types/react@16.8 @types/react-dom@16.8"
- "@types/react@17 @types/react-dom@17"
- "@types/react@18 @types/react-dom@18"
- "@types/react@npm:types-react@19.0.0-rc.0 @types/react-dom@npm:types-react-dom@19.0.0-rc.0"
- "typescript@next"
security-scans:
jobs:
- secops/gitleaks:
context:
- platform-docker-ro
- github-orb
- secops-oidc
git-base-revision: <<#pipeline.git.base_revision>><<pipeline.git.base_revision>><</pipeline.git.base_revision >>
git-revision: << pipeline.git.revision >>
- secops/semgrep:
context:
- secops-oidc
- github-orb
git-base-revision: <<#pipeline.git.base_revision>><<pipeline.git.base_revision>><</pipeline.git.base_revision >>
99 changes: 99 additions & 0 deletions apollo-client/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "local-rules"],
"env": {
"browser": true,
"node": true,
"es2021": true
},
"parserOptions": {
"ecmaVersion": "latest"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
},
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
"excludedFiles": ["**/__tests__/**/*.*", "*.d.ts"],
"extends": ["plugin:react-hooks/recommended"],
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["eslint-plugin-react-compiler"],
"rules": {
"react-compiler/react-compiler": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{
"prefer": "type-imports",
"disallowTypeAnnotations": false,
"fixStyle": "separate-type-imports"
}
],
"@typescript-eslint/consistent-type-exports": ["error"],
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"GraphQLError": {
"message": "Use GraphQLFormattedError instead",
"fixWith": "GraphQLFormattedError"
},
"ExecutionResult": {
"message": "Use FormattedExecutionResult instead",
"fixWith": "FormattedExecutionResult"
}
},
"extendDefaults": false
}
],
"no-restricted-syntax": [
"error",
{
"selector": "ImportDeclaration[source.value='react'][importKind!='type'] :matches(ImportSpecifier, ImportDefaultSpecifier)",
"message": "Please only use the namespace import syntax (`import * as React from 'react'`) for React imports!"
}
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
"import/extensions": [
"error",
"always",
{
"ignorePackages": true,
"checkTypeImports": true
}
],
"local-rules/require-using-disposable": "error"
}
},
{
"files": [
"**/__tests__/**/*.[jt]s",
"**/__tests__/**/*.[jt]sx",
"**/?(*.)+(test).[jt]s",
"**/?(*.)+(test).[jt]sx"
],
"extends": ["plugin:testing-library/react"],
"parserOptions": {
"project": "./tsconfig.tests.json"
},
"rules": {
"testing-library/prefer-user-event": "error",
"testing-library/no-wait-for-multiple-assertions": "off",
"local-rules/require-using-disposable": "error"
}
}
],
"rules": {
"import/no-unresolved": "off"
}
}
14 changes: 14 additions & 0 deletions apollo-client/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# format "ObservableQuery" test
0a67647b73abd94b706242f32b88d21a1400ad50
# format "ObservableQuery" test (in #10597)
104bf11765b1db50292f9656aa8fe48e2d749a83
# format changes from ee0b4ae
f7890ae96a3ba900d3de9bf8b23254bcfba18a25
# Format "DisplayClientError.js" (#10909)
0cb68364f2c3828badde8c74de44e9c1864fb6d4
# Format `react` folder, upgrade to prettier 3.0 (#11111)
ba3e7d9fa7d46e4c636148bbf01552833db0ceda
# Format all non-docs files with prettier (#11170)
352c4a9ad4d140d58850688bd1b2d5513f62c6cb
# Format remaining files from #11170 (#11185)
994ae91f16ea4c8ee28818bd7eaac47e4765c660
1 change: 1 addition & 0 deletions apollo-client/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
3 changes: 3 additions & 0 deletions apollo-client/.github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* @apollographql/client-typescript

/docs/ @apollographql/docs
31 changes: 31 additions & 0 deletions apollo-client/.github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Bug
description: File a bug report
body:
- type: markdown
attributes:
value: "Hello from the Apollo Client team! Hopefully we can help resolve your issue. To increase the chances of us being able to help, please take the time to fill out the form as completely as possible. A minimal, runnable reproduction is the best way to get us to help you quickly and in many cases we simply cannot help without one."
- type: textarea
attributes:
label: Issue Description
description: Describe the issue you are experiencing.
validations:
required: false
- type: input
attributes:
label: Link to Reproduction
description: "A link with runnable reproduction. For web projects, you can fork our `react-apollo-error-template` to create one via [GitHub repository](https://github.com/apollographql/react-apollo-error-template) or [CodeSandbox](https://codesandbox.io/s/github/apollographql/react-apollo-error-template). For React Native projects, you can fork our `rn-apollo-client-testbed` via [GitHub respository](https://github.com/apollographql/rn-apollo-client-testbed). Make sure this includes everything necessary (`package.json`, `tsconfig.json`, etc.) so we don't have to guess anything! If a minimal reproduction can't be created, please share a [Replay](https://docs.replay.io/workflows/recording-bug-reports) of the bug (note: you don't have to grant Replay access to a private repo to create a recording, but it will contain source maps for your JavaScript code). Feel free to ask for an email address to send Replays to if they contain sensitive information."
validations:
required: true
- type: textarea
attributes:
label: Reproduction Steps
description: Please provide any additional non-trivial steps required to reproduce the issue.
validations:
required: false
- type: input
attributes:
label: "`@apollo/client` version"
description: "What version of Apollo Client are you running?"
placeholder: "ex: 3.8.10"
validations:
required: true
Loading