diff --git a/.changeset/chatty-cherries-drum.md b/.changeset/chatty-cherries-drum.md new file mode 100644 index 000000000..6291b1455 --- /dev/null +++ b/.changeset/chatty-cherries-drum.md @@ -0,0 +1,56 @@ +--- +'apollo-angular': major +--- + +Namespaced types + +Before: + +```ts +import type { + Options, + BatchOptions +} from 'apollo-angular/http'; + +import type { + MutationOptionsAlone, + QueryOptionsAlone, + SubscriptionOptionsAlone, + WatchQueryOptions, + WatchQueryOptionsAlone, +} from 'apollo-angular'; + +type AllTypes = + | Options + | BatchOptions + | MutationOptionsAlone + | QueryOptionsAlone + | SubscriptionOptionsAlone + | WatchQueryOptions + | WatchQueryOptionsAlone; +``` + +After: + +```ts +import type { + HttpBatchLink, + HttpLink +} from 'apollo-angular/http'; + +import type { + Apollo, + Mutation, + Query, + Subscription, +} from 'apollo-angular'; + +type AllTypes = + | HttpLink.Options + | HttpBatchLink.Options + | Mutation.MutateOptions + | Query.FetchOptions + | Subscription.SubscribeOptions + | Apollo.WatchQueryOptions + | Query.WatchOptions; +``` diff --git a/.changeset/config.json b/.changeset/config.json index b9fc32db3..0a1387de2 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,6 +1,6 @@ { "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", - "changelog": ["@changesets/changelog-github", { "repo": "kamilkisiela/apollo-angular" }], + "changelog": ["@changesets/changelog-github", { "repo": "Ecodev/apollo-angular" }], "commit": false, "access": "public", "baseBranch": "master", diff --git a/.changeset/early-tigers-draw.md b/.changeset/early-tigers-draw.md new file mode 100644 index 000000000..f8cb8ca5b --- /dev/null +++ b/.changeset/early-tigers-draw.md @@ -0,0 +1,5 @@ +--- +'apollo-angular': patch +--- + +Drop support for node 18 diff --git a/.changeset/funny-trainers-look.md b/.changeset/funny-trainers-look.md new file mode 100644 index 000000000..e7f79476a --- /dev/null +++ b/.changeset/funny-trainers-look.md @@ -0,0 +1,12 @@ +--- +'apollo-angular': major +--- + +`httpHeaders` is a class + +Migrate your code like so: + +```diff +- const link = httpHeaders(); ++ const link = new HttpHeadersLink(); +``` diff --git a/.changeset/giant-clouds-shout.md b/.changeset/giant-clouds-shout.md new file mode 100644 index 000000000..e90d9021f --- /dev/null +++ b/.changeset/giant-clouds-shout.md @@ -0,0 +1,11 @@ +--- +'apollo-angular': major +--- + +Move `useZone` option into subscription options + + +```diff +- const obs = apollo.subscribe(options, { useZone: false }); ++ const obs = apollo.subscribe({ ...options, useZone: false }); +``` diff --git a/.changeset/odd-badgers-fetch.md b/.changeset/odd-badgers-fetch.md new file mode 100644 index 000000000..e87d25dfa --- /dev/null +++ b/.changeset/odd-badgers-fetch.md @@ -0,0 +1,5 @@ +--- +'apollo-angular': patch +--- + +Drop ESM2022 in favor of FESM2022 diff --git a/.changeset/rich-dogs-fetch.md b/.changeset/rich-dogs-fetch.md new file mode 100644 index 000000000..d924f09f5 --- /dev/null +++ b/.changeset/rich-dogs-fetch.md @@ -0,0 +1,14 @@ +--- +'apollo-angular': patch +--- + +New repository owners + +[@kamilkisiela](https://github.com/kamilkisiela), the creator of this library, has found new +interests and is not able to contribute like in the past. He gracefully transferred ownership of the +repository to me. I have been maintaining this library since 2022, and will continue doing so in the +foreseeable future. + +For the package consumers, pretty much nothing will change. The package name, the code, the relation +with [The Guild](https://github.com/the-guild-org), and the maintenance style will all remain the +same. The only difference is the new repository URL: https://github.com/the-guild-org/apollo-angular. diff --git a/.changeset/tough-masks-search.md b/.changeset/tough-masks-search.md new file mode 100644 index 000000000..150e6bf9f --- /dev/null +++ b/.changeset/tough-masks-search.md @@ -0,0 +1,26 @@ +--- +'apollo-angular': major +--- + +Combined parameters of `Query`, `Mutation` and `Subscription` classes generated via codegen + +Migrate your code like so: + +```diff +class MyComponent { + myQuery = inject(MyQuery); + myMutation = inject(MyMutation); + mySubscription = inject(MySubscription); + + constructor() { +- myQuery.watch({ myVariable: 'foo' }, { fetchPolicy: 'cache-and-network' }); ++ myQuery.watch({ variables: { myVariable: 'foo' }, fetchPolicy: 'cache-and-network' }) + +- myMutation.mutate({ myVariable: 'foo' }, { errorPolicy: 'ignore' }); ++ myMutation.mutate({ variables: { myVariable: 'foo' }, errorPolicy: 'ignore' }); + +- mySubscription.subscribe({ myVariable: 'foo' }, { fetchPolicy: 'network-only' }); ++ mySubscription.subscribe({ variables: { myVariable: 'foo' }, fetchPolicy: 'network-only' }); + } +} +``` diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index df692461f..bbfbd254e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,3 @@ # These are supported funding model platforms -github: kamilkisiela -custom: http://paypal.me/kamilkisiela +github: PowerKiKi diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f28f6fe3d..965b890e6 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,8 @@ blank_issues_enabled: false contact_links: - name: Feature Request - url: https://github.com/kamilkisiela/apollo-angular/discussions/new + url: https://github.com/the-guild-org/apollo-angular/discussions/new about: Request and discuss a feature - name: Ask a Question - url: https://github.com/kamilkisiela/apollo-angular/discussions/new + url: https://github.com/the-guild-org/apollo-angular/discussions/new about: Ask questions and discuss with other community members diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 51b95bf13..d48ec5e60 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,10 +9,9 @@ jobs: steps: - uses: actions/checkout@master - - name: Use Node.js 18 - uses: actions/setup-node@master + - uses: actions/setup-node@master with: - node-version: 18 + node-version: 22 - uses: actions/cache@v4 name: Cache node_modules @@ -59,10 +58,9 @@ jobs: steps: - uses: actions/checkout@master - - name: Use Node.js 18 - uses: actions/setup-node@master + - uses: actions/setup-node@master with: - node-version: 18 + node-version: 22 - uses: actions/cache@v4 name: Cache node_modules @@ -89,10 +87,9 @@ jobs: steps: - uses: actions/checkout@master - - name: Use Node.js 18 - uses: actions/setup-node@master + - uses: actions/setup-node@master with: - node-version: 18 + node-version: 22 - uses: actions/cache@v4 name: Cache node_modules @@ -115,9 +112,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - angular_version: [17, 18, 19] - graphql_version: [15, 16] - node_version: [18, 20] + angular_version: [18, 19, 20] + graphql_version: [16] + node_version: [20, 22, 24] + exclude: + - angular_version: 18 + node_version: 24 + + - angular_version: 19 + node_version: 24 steps: - name: Use Node.js ${{ matrix.node_version }} uses: actions/setup-node@master diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 40135ad19..a7e02d71f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,7 +20,7 @@ jobs: with: npmTag: alpha buildScript: build - nodeVersion: 18 + nodeVersion: 22 secrets: githubToken: ${{ secrets.GITHUB_TOKEN }} npmToken: ${{ secrets.NPM_TOKEN }} @@ -36,7 +36,7 @@ jobs: npmTag: rc restoreDeletedChangesets: true buildScript: build - nodeVersion: 18 + nodeVersion: 22 secrets: githubToken: ${{ secrets.GITHUB_TOKEN }} npmToken: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e86cc7015..087ec8e82 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,11 +10,13 @@ jobs: contents: write id-token: write packages: write + issues: write + pull-requests: write uses: the-guild-org/shared-config/.github/workflows/release-stable.yml@main with: createGithubReleases: true releaseScript: release - nodeVersion: 18 + nodeVersion: 22 secrets: - githubToken: ${{ secrets.GUILD_BOT_TOKEN }} + githubToken: ${{ secrets.GITHUB_TOKEN }} npmToken: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 3367fdad3..ea3e2401f 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -23,9 +23,12 @@ jobs: - uses: the-guild-org/shared-config/setup@main name: website with: - nodeVersion: 18 # change if needed + nodeVersion: 22 # change if needed packageManager: yarn # change if needed + - name: Pre-install wrangler + run: yarn add wrangler --ignore-workspace-root-check + - uses: the-guild-org/shared-config/website-cf@main name: build and deploy website env: diff --git a/.nvmrc b/.nvmrc index 3c032078a..2bd5a0a98 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18 +22 diff --git a/package.json b/package.json index 5636142fa..70da51699 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@angular/platform-browser-dynamic": "^18.0.0", "@angular/platform-server": "^18.0.0", "@angular/router": "^18.0.0", - "@apollo/client": "https://pkg.pr.new/@apollo/client@12221", + "@apollo/client": "4.0.1", "@babel/core": "^7.24.6", "@babel/preset-env": "^7.24.6", "@changesets/changelog-github": "^0.5.0", @@ -49,7 +49,7 @@ "graphql": "^16.8.0", "husky": "^9.0.0", "lint-staged": "^15.2.5", - "ng-packagr": "^18.0.0", + "ng-packagr": "^19.0.0", "prettier": "^3.5.3", "react": "^18.3.1", "rimraf": "^5.0.7", diff --git a/packages/apollo-angular/CHANGELOG.md b/packages/apollo-angular/CHANGELOG.md index 5801ce5fe..d5ab1d1d4 100644 --- a/packages/apollo-angular/CHANGELOG.md +++ b/packages/apollo-angular/CHANGELOG.md @@ -1,11 +1,35 @@ # Change log +## 11.0.0 + +### Major Changes + +- [#2360](https://github.com/the-guild-org/apollo-angular/pull/2360) + [`20a418e`](https://github.com/the-guild-org/apollo-angular/commit/20a418e06e09c6cb71ad3c8e4f55b5d6d294876d) + Thanks [@mark7-bell](https://github.com/mark7-bell)! - Drop support for Angular 17 + +- [#2364](https://github.com/the-guild-org/apollo-angular/pull/2364) + [`bdb302a`](https://github.com/the-guild-org/apollo-angular/commit/bdb302abf042978a3c8f19c9a8d75153ec067ab8) + Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Drop support for GraphQL 15 + +- [#2360](https://github.com/the-guild-org/apollo-angular/pull/2360) + [`f311133`](https://github.com/the-guild-org/apollo-angular/commit/f311133bc45241d002f48234af5fd62afcfbacdc) + Thanks [@mark7-bell](https://github.com/mark7-bell)! - Support Angular 20 + +### Patch Changes + +- [#2364](https://github.com/the-guild-org/apollo-angular/pull/2364) + [`bdb302a`](https://github.com/the-guild-org/apollo-angular/commit/bdb302abf042978a3c8f19c9a8d75153ec067ab8) + Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: + - Updated dependency [`graphql@^16.0.0` ↗︎](https://www.npmjs.com/package/graphql/v/16.0.0) (from + `^15.0.0 || ^16.0.0`, in `peerDependencies`) + ## 10.0.3 ### Patch Changes -- [#2351](https://github.com/kamilkisiela/apollo-angular/pull/2351) - [`61ff0b8`](https://github.com/kamilkisiela/apollo-angular/commit/61ff0b8e5257f20cae45e84fd724498ff63acc44) +- [#2351](https://github.com/the-guild-org/apollo-angular/pull/2351) + [`61ff0b8`](https://github.com/the-guild-org/apollo-angular/commit/61ff0b8e5257f20cae45e84fd724498ff63acc44) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - `fetchMore` typing is duplicated from `@apollo/client` @@ -13,16 +37,16 @@ ### Patch Changes -- [#2347](https://github.com/kamilkisiela/apollo-angular/pull/2347) - [`67b8b8c`](https://github.com/kamilkisiela/apollo-angular/commit/67b8b8cb401bdc63222b136133934e67a99dafc1) +- [#2347](https://github.com/the-guild-org/apollo-angular/pull/2347) + [`67b8b8c`](https://github.com/the-guild-org/apollo-angular/commit/67b8b8cb401bdc63222b136133934e67a99dafc1) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - `fetchMore` typing was too loose ## 10.0.1 ### Patch Changes -- [#2344](https://github.com/kamilkisiela/apollo-angular/pull/2344) - [`3ef5483`](https://github.com/kamilkisiela/apollo-angular/commit/3ef5483a02b788fe1ce9de7f66f2a71be334f45c) +- [#2344](https://github.com/the-guild-org/apollo-angular/pull/2344) + [`3ef5483`](https://github.com/the-guild-org/apollo-angular/commit/3ef5483a02b788fe1ce9de7f66f2a71be334f45c) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - `FormattedExecutionResult` instead of `ExecutionResult` @@ -30,8 +54,8 @@ ### Major Changes -- [#2342](https://github.com/kamilkisiela/apollo-angular/pull/2342) - [`baf538a`](https://github.com/kamilkisiela/apollo-angular/commit/baf538aeb1f76f0835c84f6979589cbf2dfd0f0b) +- [#2342](https://github.com/the-guild-org/apollo-angular/pull/2342) + [`baf538a`](https://github.com/the-guild-org/apollo-angular/commit/baf538aeb1f76f0835c84f6979589cbf2dfd0f0b) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Drop deprecated things: - Instead of `ApolloModule`, use either `provideApollo()` or `provideNamedApollo()`. @@ -42,8 +66,8 @@ ### Major Changes -- [#2340](https://github.com/kamilkisiela/apollo-angular/pull/2340) - [`6d3d5ba`](https://github.com/kamilkisiela/apollo-angular/commit/6d3d5ba67a5a8d2778a021f1059559379ff99e8f) +- [#2340](https://github.com/the-guild-org/apollo-angular/pull/2340) + [`6d3d5ba`](https://github.com/the-guild-org/apollo-angular/commit/6d3d5ba67a5a8d2778a021f1059559379ff99e8f) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - - Requires `@apollo/client` 3.13.1 - Dropped `SubscriptionResult`, because it added extra maintenance work to keep native types in sync, and it brought no value over using native type. @@ -56,8 +80,8 @@ ### Patch Changes -- [#2340](https://github.com/kamilkisiela/apollo-angular/pull/2340) - [`88656f0`](https://github.com/kamilkisiela/apollo-angular/commit/88656f00f4f4f8c757ef19e35b172a647e6e2300) +- [#2340](https://github.com/the-guild-org/apollo-angular/pull/2340) + [`88656f0`](https://github.com/the-guild-org/apollo-angular/commit/88656f00f4f4f8c757ef19e35b172a647e6e2300) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: - Updated dependency [`@apollo/client@^3.13.1` ↗︎](https://www.npmjs.com/package/@apollo/client/v/3.13.1) (from @@ -67,8 +91,8 @@ ### Patch Changes -- [#2336](https://github.com/kamilkisiela/apollo-angular/pull/2336) - [`78b0ba1`](https://github.com/kamilkisiela/apollo-angular/commit/78b0ba18706d0cf3dd6a877520ae02bc7ede0220) +- [#2336](https://github.com/the-guild-org/apollo-angular/pull/2336) + [`78b0ba1`](https://github.com/the-guild-org/apollo-angular/commit/78b0ba18706d0cf3dd6a877520ae02bc7ede0220) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Export MutationOptionsAlone, QueryOptionsAlone, SubscriptionOptionsAlone, WatchQueryOptionsAlone from 'apollo-angular' @@ -76,16 +100,16 @@ ### Patch Changes -- [#2333](https://github.com/kamilkisiela/apollo-angular/pull/2333) - [`9866ec6`](https://github.com/kamilkisiela/apollo-angular/commit/9866ec675a0f38602aabe4ca3fd591e4d9f3248f) +- [#2333](https://github.com/the-guild-org/apollo-angular/pull/2333) + [`9866ec6`](https://github.com/the-guild-org/apollo-angular/commit/9866ec675a0f38602aabe4ca3fd591e4d9f3248f) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: - Updated dependency [`@apollo/client@^3.10.0` ↗︎](https://www.npmjs.com/package/@apollo/client/v/3.10.0) (from `^3.0.0`, in `peerDependencies`) -- [#2333](https://github.com/kamilkisiela/apollo-angular/pull/2333) - [`eeec0a9`](https://github.com/kamilkisiela/apollo-angular/commit/eeec0a96c52e891620d072158166f9ad5de6dc00) +- [#2333](https://github.com/the-guild-org/apollo-angular/pull/2333) + [`eeec0a9`](https://github.com/the-guild-org/apollo-angular/commit/eeec0a96c52e891620d072158166f9ad5de6dc00) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Requires @apollo/client ^3.10.0 for watchFragment @@ -93,8 +117,8 @@ ### Major Changes -- [#2316](https://github.com/kamilkisiela/apollo-angular/pull/2316) - [`8c75368`](https://github.com/kamilkisiela/apollo-angular/commit/8c75368d4c433fdb0fd5b0615e5eda404e14b1aa) +- [#2316](https://github.com/the-guild-org/apollo-angular/pull/2316) + [`8c75368`](https://github.com/the-guild-org/apollo-angular/commit/8c75368d4c433fdb0fd5b0615e5eda404e14b1aa) Thanks [@Frozen-byte](https://github.com/Frozen-byte)! - added a `complete()` method for `TestOperation` object to cancel subscriptions after `flush()` @@ -102,32 +126,32 @@ ### Patch Changes -- [#2323](https://github.com/kamilkisiela/apollo-angular/pull/2323) - [`095457d`](https://github.com/kamilkisiela/apollo-angular/commit/095457d609239ee2de636376b62159e420e1df54) +- [#2323](https://github.com/the-guild-org/apollo-angular/pull/2323) + [`095457d`](https://github.com/the-guild-org/apollo-angular/commit/095457d609239ee2de636376b62159e420e1df54) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: - Updated dependency [`@angular/core@^17.0.0 || ^18.0.0 || ^19.0.0` ↗︎](https://www.npmjs.com/package/@angular/core/v/17.0.0) (from `^17.0.0 || ^18.0.0`, in `peerDependencies`) -- [#2319](https://github.com/kamilkisiela/apollo-angular/pull/2319) - [`cafb23a`](https://github.com/kamilkisiela/apollo-angular/commit/cafb23a797371b2f4df5aae4891cf528cdbcfa58) +- [#2319](https://github.com/the-guild-org/apollo-angular/pull/2319) + [`cafb23a`](https://github.com/the-guild-org/apollo-angular/commit/cafb23a797371b2f4df5aae4891cf528cdbcfa58) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Move away from deprecated things -- [#2317](https://github.com/kamilkisiela/apollo-angular/pull/2317) - [`a564953`](https://github.com/kamilkisiela/apollo-angular/commit/a5649533e12a589e8d7171ad2b320ee426c8c21d) +- [#2317](https://github.com/the-guild-org/apollo-angular/pull/2317) + [`a564953`](https://github.com/the-guild-org/apollo-angular/commit/a5649533e12a589e8d7171ad2b320ee426c8c21d) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Let typing flow better ## 7.2.1 ### Patch Changes -- [#2312](https://github.com/kamilkisiela/apollo-angular/pull/2312) - [`8bbdc6b`](https://github.com/kamilkisiela/apollo-angular/commit/8bbdc6be14b389d9bcb52887fadb4e239e85a58d) +- [#2312](https://github.com/the-guild-org/apollo-angular/pull/2312) + [`8bbdc6b`](https://github.com/the-guild-org/apollo-angular/commit/8bbdc6be14b389d9bcb52887fadb4e239e85a58d) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Smaller bundle for `gql` -- [#2314](https://github.com/kamilkisiela/apollo-angular/pull/2314) - [`e98e06a`](https://github.com/kamilkisiela/apollo-angular/commit/e98e06a1a9d9da9e81becf905c738171d797f745) +- [#2314](https://github.com/the-guild-org/apollo-angular/pull/2314) + [`e98e06a`](https://github.com/the-guild-org/apollo-angular/commit/e98e06a1a9d9da9e81becf905c738171d797f745) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Deprecate `graphql` alias for `gql` tag function @@ -142,19 +166,19 @@ ### Minor Changes -- [#2296](https://github.com/kamilkisiela/apollo-angular/pull/2296) - [`6a45784`](https://github.com/kamilkisiela/apollo-angular/commit/6a45784ce4e916e9e2df1ee11f579b70edd8445d) +- [#2296](https://github.com/the-guild-org/apollo-angular/pull/2296) + [`6a45784`](https://github.com/the-guild-org/apollo-angular/commit/6a45784ce4e916e9e2df1ee11f579b70edd8445d) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - New `provideApollo()` and `provideNamedApollo()` ### Patch Changes -- [#2294](https://github.com/kamilkisiela/apollo-angular/pull/2294) - [`d56c5cb`](https://github.com/kamilkisiela/apollo-angular/commit/d56c5cb169847b3d65724c00bcc8c3223de05bac) +- [#2294](https://github.com/the-guild-org/apollo-angular/pull/2294) + [`d56c5cb`](https://github.com/the-guild-org/apollo-angular/commit/d56c5cb169847b3d65724c00bcc8c3223de05bac) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Update documentation to standalone usage -- [#2292](https://github.com/kamilkisiela/apollo-angular/pull/2292) - [`04fdd28`](https://github.com/kamilkisiela/apollo-angular/commit/04fdd28ff6aa3b4b844488c5b20a55f0bfa60e19) +- [#2292](https://github.com/the-guild-org/apollo-angular/pull/2292) + [`04fdd28`](https://github.com/the-guild-org/apollo-angular/commit/04fdd28ff6aa3b4b844488c5b20a55f0bfa60e19) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Relax type to be able to use `extract-files` properly @@ -162,8 +186,8 @@ ### Patch Changes -- [#2289](https://github.com/kamilkisiela/apollo-angular/pull/2289) - [`d78cc8d`](https://github.com/kamilkisiela/apollo-angular/commit/d78cc8d27a8d6aca805f0da1eb4e0764c7fb6212) +- [#2289](https://github.com/the-guild-org/apollo-angular/pull/2289) + [`d78cc8d`](https://github.com/the-guild-org/apollo-angular/commit/d78cc8d27a8d6aca805f0da1eb4e0764c7fb6212) Thanks [@richard-elastique](https://github.com/richard-elastique)! - Don't require a dependency on React @@ -171,16 +195,16 @@ ### Patch Changes -- [#2286](https://github.com/kamilkisiela/apollo-angular/pull/2286) - [`dbd4f68`](https://github.com/kamilkisiela/apollo-angular/commit/dbd4f6885da9d897fe41d6625a1090454ce996ab) +- [#2286](https://github.com/the-guild-org/apollo-angular/pull/2286) + [`dbd4f68`](https://github.com/the-guild-org/apollo-angular/commit/dbd4f6885da9d897fe41d6625a1090454ce996ab) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Permissions for release provenance ## 7.1.0 ### Minor Changes -- [#2226](https://github.com/kamilkisiela/apollo-angular/pull/2226) - [`4ca9c4a`](https://github.com/kamilkisiela/apollo-angular/commit/4ca9c4a09446be00ba5882bd80e397f70cd9fb51) +- [#2226](https://github.com/the-guild-org/apollo-angular/pull/2226) + [`4ca9c4a`](https://github.com/the-guild-org/apollo-angular/commit/4ca9c4a09446be00ba5882bd80e397f70cd9fb51) Thanks [@alessbell](https://github.com/alessbell)! - Exposes `watchFragment` method on the `ApolloBase` class. @@ -188,32 +212,32 @@ ### Patch Changes -- [#2259](https://github.com/kamilkisiela/apollo-angular/pull/2259) - [`78f319a`](https://github.com/kamilkisiela/apollo-angular/commit/78f319a6a93268144bbb9dc42c84bd45f50ff606) +- [#2259](https://github.com/the-guild-org/apollo-angular/pull/2259) + [`78f319a`](https://github.com/the-guild-org/apollo-angular/commit/78f319a6a93268144bbb9dc42c84bd45f50ff606) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: - Updated dependency [`@angular/core@^17.0.0 || ^18.0.0` ↗︎](https://www.npmjs.com/package/@angular/core/v/17.0.0) (from `^17.0.0`, in `peerDependencies`) -- [#2259](https://github.com/kamilkisiela/apollo-angular/pull/2259) - [`97fba6a`](https://github.com/kamilkisiela/apollo-angular/commit/97fba6ab7909c2d65bd58f7e376a94c0b4394249) +- [#2259](https://github.com/the-guild-org/apollo-angular/pull/2259) + [`97fba6a`](https://github.com/the-guild-org/apollo-angular/commit/97fba6ab7909c2d65bd58f7e376a94c0b4394249) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: - Updated dependency [`@angular/core@^17.0.0 || ^18.0.0` ↗︎](https://www.npmjs.com/package/@angular/core/v/17.0.0) (from `^17.0.0`, in `peerDependencies`) -- [#2259](https://github.com/kamilkisiela/apollo-angular/pull/2259) - [`29b9fdc`](https://github.com/kamilkisiela/apollo-angular/commit/29b9fdc2279d3e48a46db0a8e811dac0a3b72c00) +- [#2259](https://github.com/the-guild-org/apollo-angular/pull/2259) + [`29b9fdc`](https://github.com/the-guild-org/apollo-angular/commit/29b9fdc2279d3e48a46db0a8e811dac0a3b72c00) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - Allow Angular 18 ## 7.0.1 ### Patch Changes -- [#2252](https://github.com/kamilkisiela/apollo-angular/pull/2252) - [`67ba1e8`](https://github.com/kamilkisiela/apollo-angular/commit/67ba1e88ed6aa231bff4b7e794b5b864d5b3a114) +- [#2252](https://github.com/the-guild-org/apollo-angular/pull/2252) + [`67ba1e8`](https://github.com/the-guild-org/apollo-angular/commit/67ba1e88ed6aa231bff4b7e794b5b864d5b3a114) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - ApolloClient does not delay the application becoming stable @@ -221,8 +245,8 @@ ### Major Changes -- [#2225](https://github.com/kamilkisiela/apollo-angular/pull/2225) - [`712205f`](https://github.com/kamilkisiela/apollo-angular/commit/712205fd8762b1125d614cb58c9fcffcc9135a55) +- [#2225](https://github.com/the-guild-org/apollo-angular/pull/2225) + [`712205f`](https://github.com/the-guild-org/apollo-angular/commit/712205fd8762b1125d614cb58c9fcffcc9135a55) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - BREAKING use Typescript strict mode This is breaking because: @@ -246,16 +270,16 @@ ### Major Changes -- [#2093](https://github.com/kamilkisiela/apollo-angular/pull/2093) - [`fbd86daf`](https://github.com/kamilkisiela/apollo-angular/commit/fbd86daf1a413695ad1f5dfcddd652ce73590b42) +- [#2093](https://github.com/the-guild-org/apollo-angular/pull/2093) + [`fbd86daf`](https://github.com/the-guild-org/apollo-angular/commit/fbd86daf1a413695ad1f5dfcddd652ce73590b42) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - - Add Angular 17 Support - Drop support for Angular 14, 15 and 16 - Support for `ng add` schematics for standalone apps or module apps ### Patch Changes -- [#2093](https://github.com/kamilkisiela/apollo-angular/pull/2093) - [`e0bec09a`](https://github.com/kamilkisiela/apollo-angular/commit/e0bec09a877cb617d96dea0f3379925d39458e6a) +- [#2093](https://github.com/the-guild-org/apollo-angular/pull/2093) + [`e0bec09a`](https://github.com/the-guild-org/apollo-angular/commit/e0bec09a877cb617d96dea0f3379925d39458e6a) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: - Updated dependency [`@angular/core@^17.0.0` ↗︎](https://www.npmjs.com/package/@angular/core/v/17.0.0) (from @@ -265,16 +289,16 @@ ### Patch Changes -- [#2074](https://github.com/kamilkisiela/apollo-angular/pull/2074) - [`f014edcb`](https://github.com/kamilkisiela/apollo-angular/commit/f014edcbfc3396de52c70c5deea194049ac7e746) +- [#2074](https://github.com/the-guild-org/apollo-angular/pull/2074) + [`f014edcb`](https://github.com/the-guild-org/apollo-angular/commit/f014edcbfc3396de52c70c5deea194049ac7e746) Thanks [@vz-tl](https://github.com/vz-tl)! - Disable dev-tool check when using ApolloTestingModule ## 5.0.1 ### Patch Changes -- [#2065](https://github.com/kamilkisiela/apollo-angular/pull/2065) - [`78947ba5`](https://github.com/kamilkisiela/apollo-angular/commit/78947ba59d5fe791fb813471c7823fc931279f11) +- [#2065](https://github.com/the-guild-org/apollo-angular/pull/2065) + [`78947ba5`](https://github.com/the-guild-org/apollo-angular/commit/78947ba59d5fe791fb813471c7823fc931279f11) Thanks [@PowerKiKi](https://github.com/PowerKiKi)! - dependencies updates: - Updated dependency [`tslib@^2.6.2` ↗︎](https://www.npmjs.com/package/tslib/v/2.6.2) (from `^2.0.0`, in `dependencies`) @@ -283,8 +307,8 @@ ### Major Changes -- [#2010](https://github.com/kamilkisiela/apollo-angular/pull/2010) - [`ea8b7034`](https://github.com/kamilkisiela/apollo-angular/commit/ea8b70343ef024e1d24eccf578909704f5de2ebe) +- [#2010](https://github.com/the-guild-org/apollo-angular/pull/2010) + [`ea8b7034`](https://github.com/the-guild-org/apollo-angular/commit/ea8b70343ef024e1d24eccf578909704f5de2ebe) Thanks [@HendrikJanssen](https://github.com/HendrikJanssen)! - Support Angular 16 This is a breaking change because support for node v14 must be dropped to follow Angular 16 @@ -294,8 +318,8 @@ ### Patch Changes -- [#1910](https://github.com/kamilkisiela/apollo-angular/pull/1910) - [`ff0b0d72`](https://github.com/kamilkisiela/apollo-angular/commit/ff0b0d721f847b536b3ba5dd4b598e2055d4532f) +- [#1910](https://github.com/the-guild-org/apollo-angular/pull/1910) + [`ff0b0d72`](https://github.com/the-guild-org/apollo-angular/commit/ff0b0d721f847b536b3ba5dd4b598e2055d4532f) Thanks [@phryneas](https://github.com/phryneas)! - `TVariable` generics now `extend OperationVariables` to accommodate an upstream type change in @apollo/client@3.7.6. #1910, #1907 @@ -331,16 +355,16 @@ ## v3.0.0 - `useGETForQueries` in Http Link - [`5996109`](https://github.com/kamilkisiela/apollo-angular/commit/599610934e5f9cf8cc2d62abc270edddc937cc60) + [`5996109`](https://github.com/the-guild-org/apollo-angular/commit/599610934e5f9cf8cc2d62abc270edddc937cc60) - Bring back `ApolloModule` - [`0a24c4f`](https://github.com/kamilkisiela/apollo-angular/commit/0a24c4f7af8189a825483c57b2d60cb7a875b18f) + [`0a24c4f`](https://github.com/the-guild-org/apollo-angular/commit/0a24c4f7af8189a825483c57b2d60cb7a875b18f) - Fix `useInitialLoading` - [`750429c`](https://github.com/kamilkisiela/apollo-angular/commit/750429cbe0aaad07a3fdc2e2ef046fe8be4aad28) + [`750429c`](https://github.com/the-guild-org/apollo-angular/commit/750429cbe0aaad07a3fdc2e2ef046fe8be4aad28) - Typed `gql` and `graphql` tags - both accept two generic types and support `TypedDocumentNode` - [`9a8ea5f`](https://github.com/kamilkisiela/apollo-angular/commit/9a8ea5f229cf7937d74332092cb3eba40828b7b1) + [`9a8ea5f`](https://github.com/the-guild-org/apollo-angular/commit/9a8ea5f229cf7937d74332092cb3eba40828b7b1) - Add `useMutationLoading` flag - [`bc223fe`](https://github.com/kamilkisiela/apollo-angular/commit/bc223fe6487edd35c56ad908e4739580ce69f056) -- Fix type inference for Mutations [#1659](https://github.com/kamilkisiela/apollo-angular/pull/1659) + [`bc223fe`](https://github.com/the-guild-org/apollo-angular/commit/bc223fe6487edd35c56ad908e4739580ce69f056) +- Fix type inference for Mutations [#1659](https://github.com/the-guild-org/apollo-angular/pull/1659) - Declare support for Angular 13 - Remove `extract-files` library from dependencies (you need to pass `extractFiles` function to HttpLink's options) @@ -356,7 +380,7 @@ ## v2.6.0 - Support `TypedDocumentNode` - [`120594a`](https://github.com/kamilkisiela/apollo-angular/commit/120594a3f744e0d233ede3239b08e6721cb35d54) + [`120594a`](https://github.com/the-guild-org/apollo-angular/commit/120594a3f744e0d233ede3239b08e6721cb35d54) ## v2.5.0 @@ -365,26 +389,26 @@ ## v2.4.0 - Fix: Use let in Apollo constructor due to firefox bug - [#1632](https://github.com/kamilkisiela/apollo-angular/pull/1632) + [#1632](https://github.com/the-guild-org/apollo-angular/pull/1632) - Adds `operationPrinter` option to replace operation printing logic in `HttpLink` and - `HttpBatchLink` [#1637](https://github.com/kamilkisiela/apollo-angular/pull/1637) + `HttpBatchLink` [#1637](https://github.com/the-guild-org/apollo-angular/pull/1637) ## v2.3.0 - `830da182` build: Allows zone.js v11 - [#1629](https://github.com/kamilkisiela/apollo-angular/pull/1629) + [#1629](https://github.com/the-guild-org/apollo-angular/pull/1629) - `136663f0` docs: Update queries.md - [#1616](https://github.com/kamilkisiela/apollo-angular/pull/1616) + [#1616](https://github.com/the-guild-org/apollo-angular/pull/1616) ## v2.2.0 - `b152d53` Added Angular 11 peer dependency - [#1615](https://github.com/kamilkisiela/apollo-angular/pull/1615) + [#1615](https://github.com/the-guild-org/apollo-angular/pull/1615) - `d179a66` docs: Integrated documentation changes - [#1590](https://github.com/kamilkisiela/apollo-angular/pull/1590) -- `5d938a3` Update README.md [#1598](https://github.com/kamilkisiela/apollo-angular/pull/1598) + [#1590](https://github.com/the-guild-org/apollo-angular/pull/1590) +- `5d938a3` Update README.md [#1598](https://github.com/the-guild-org/apollo-angular/pull/1598) - `60b8445` fix: test data modification - [#1596](https://github.com/kamilkisiela/apollo-angular/pull/1596) + [#1596](https://github.com/the-guild-org/apollo-angular/pull/1596) ## v2.1.0 @@ -426,7 +450,7 @@ Changes: `apollo-angular/headers` - Re-export `gql` of `graphql-tag` (`import { gql } from 'apollo-angular'`) - Add `flushData` method to `TestingOperation` - ([PR #1474](https://github.com/kamilkisiela/apollo-angular/pull/1474) by + ([PR #1474](https://github.com/the-guild-org/apollo-angular/pull/1474) by [@fetis](https://github.com/fetis)) - Remove `apollo-angular-boost` and `apollo-angular-cache-ngrx` @@ -437,7 +461,7 @@ Changes: ## v1.9.1 - Fix an issue with TypeScript prior v3.5 - private get accessor - [#1491](https://github.com/kamilkisiela/apollo-angular/issues/1491) + [#1491](https://github.com/the-guild-org/apollo-angular/issues/1491) ## v1.9.0 @@ -446,29 +470,29 @@ Changes: ## v1.8.0 - Introduces `APOLLO_NAMED_OPTIONS` token. Allows to create named Apollo clients using Dependency - Injection ([PR #1365](https://github.com/kamilkisiela/apollo-angular/pull/1365)) + Injection ([PR #1365](https://github.com/the-guild-org/apollo-angular/pull/1365)) - Allow to test named Apollo client - ([PR #1365](https://github.com/kamilkisiela/apollo-angular/pull/1365)) + ([PR #1365](https://github.com/the-guild-org/apollo-angular/pull/1365)) ## v1.7.0 - Fixed type definition for subscribe - [PR #1290](https://github.com/kamilkisiela/apollo-angular/pull/1290) + [PR #1290](https://github.com/the-guild-org/apollo-angular/pull/1290) - Fix global scope naming for UMD build - [PR #1305](https://github.com/kamilkisiela/apollo-angular/pull/1305) + [PR #1305](https://github.com/the-guild-org/apollo-angular/pull/1305) - Introduce useInitialLoading in watch - [PR #1306](https://github.com/kamilkisiela/apollo-angular/pull/1306) + [PR #1306](https://github.com/the-guild-org/apollo-angular/pull/1306) ## v1.6.0 -- Angular 8 [PR #1206](https://github.com/kamilkisiela/apollo-angular/pull/1206) +- Angular 8 [PR #1206](https://github.com/the-guild-org/apollo-angular/pull/1206) - Bumps packages in schematics ## v1.5.0 - Use more generic types and make everything more strict - [PR #885](https://github.com/kamilkisiela/apollo-angular/pull/885) -- Angular 7 [PR #913](https://github.com/kamilkisiela/apollo-angular/pull/913) + [PR #885](https://github.com/the-guild-org/apollo-angular/pull/885) +- Angular 7 [PR #913](https://github.com/the-guild-org/apollo-angular/pull/913) ## v1.4.1 @@ -477,22 +501,22 @@ Changes: ## v1.4.0 - Support named clients in Query, Mutatio and Subscription classes - [PR #799](https://github.com/kamilkisiela/apollo-angular/pull/799) + [PR #799](https://github.com/the-guild-org/apollo-angular/pull/799) ## v1.3.0 -- Make `Subscription` generic [PR #778](https://github.com/kamilkisiela/apollo-angular/pull/778) +- Make `Subscription` generic [PR #778](https://github.com/the-guild-org/apollo-angular/pull/778) - Schematics (`ng add apollo-angular`) - [PR #779](https://github.com/kamilkisiela/apollo-angular/pull/779), - [PR #780](https://github.com/kamilkisiela/apollo-angular/pull/780) + [PR #779](https://github.com/the-guild-org/apollo-angular/pull/779), + [PR #780](https://github.com/the-guild-org/apollo-angular/pull/780) - Allow to use a custom ApolloCache while testing - [PR #786](https://github.com/kamilkisiela/apollo-angular/pull/786) + [PR #786](https://github.com/the-guild-org/apollo-angular/pull/786) ## v1.2.0 -- Expose `queryId` in `QueryRef` [PR #733](https://github.com/kamilkisiela/apollo-angular/pull/733) +- Expose `queryId` in `QueryRef` [PR #733](https://github.com/the-guild-org/apollo-angular/pull/733) - Introduce `Query`, `Mutation`, `Subscription` services - [PR #622](https://github.com/kamilkisiela/apollo-angular/pull/622) + [PR #622](https://github.com/the-guild-org/apollo-angular/pull/622) - Angular 6.1 is now required (because of TypeScript 2.8) - TypeScript 2.8 is now required (because of Omit type) - Apollo Client ^2.3.4 is now required (versions before are not compatible because of the change in @@ -503,20 +527,20 @@ Changes: ## v1.1.1 - Fix typescript compilation errors caused by recent Apollo Client interface changes. - [Issue #659](https://github.com/kamilkisiela/apollo-angular/issues/659) - [PR #660](https://github.com/kamilkisiela/apollo-angular/pull/660) + [Issue #659](https://github.com/the-guild-org/apollo-angular/issues/659) + [PR #660](https://github.com/the-guild-org/apollo-angular/pull/660) ## v1.1.0 - Introduces `ExtraSubscriptionOptions`. Allows to run `Apollo.subscribe` outside the Zone - ([PR #488](https://github.com/kamilkisiela/apollo-angular/pull/488)) + ([PR #488](https://github.com/the-guild-org/apollo-angular/pull/488)) - Introduces `apollo-angular/testing` tools - ([PR #592](https://github.com/kamilkisiela/apollo-angular/pull/592)) + ([PR #592](https://github.com/the-guild-org/apollo-angular/pull/592)) - Introduces `APOLLO_OPTIONS` token. Allows to create Apollo using Dependency Injection - ([PR #607](https://github.com/kamilkisiela/apollo-angular/pull/607)) + ([PR #607](https://github.com/the-guild-org/apollo-angular/pull/607)) - Adds `sideEffects: false` (webpack) - ([PR #580](https://github.com/kamilkisiela/apollo-angular/pull/580)) -- Supports Angular 6 and RxJS 6 ([PR #580](https://github.com/kamilkisiela/apollo-angular/pull/580)) + ([PR #580](https://github.com/the-guild-org/apollo-angular/pull/580)) +- Supports Angular 6 and RxJS 6 ([PR #580](https://github.com/the-guild-org/apollo-angular/pull/580)) ## v1.0.1 @@ -546,43 +570,43 @@ Changes: ## v0.13.3 - Don't reuse options object for mutate and query - ([PR #356](https://github.com/kamilkisiela/apollo-angular/pull/356)) + ([PR #356](https://github.com/the-guild-org/apollo-angular/pull/356)) ## v0.13.2 - Use `InjectionToken`, instead of deprecated `OpaqueToken` - ([PR #358](https://github.com/kamilkisiela/apollo-angular/pull/358)) + ([PR #358](https://github.com/the-guild-org/apollo-angular/pull/358)) - Expose `ClientMap`, `ClientMapWrapper`, `ClientWrapper` - ([PR #360](https://github.com/kamilkisiela/apollo-angular/pull/360)) + ([PR #360](https://github.com/the-guild-org/apollo-angular/pull/360)) - Allow to install the library directly from git (NPM v5+ required) - ([PR #362](https://github.com/kamilkisiela/apollo-angular/pull/362)) + ([PR #362](https://github.com/the-guild-org/apollo-angular/pull/362)) - Fix AoT issue in Angular 5 **(added InjectDecorator on ClientMap in Apollo)** - ([PR #365](https://github.com/kamilkisiela/apollo-angular/pull/365)) + ([PR #365](https://github.com/the-guild-org/apollo-angular/pull/365)) ## v0.13.1 -- Update dependencies ([PR #347](https://github.com/kamilkisiela/apollo-angular/pull/304)) +- Update dependencies ([PR #347](https://github.com/the-guild-org/apollo-angular/pull/304)) - **Potential breaking change:** Run a GraphQL Operation on subscribe, applies to `mutate()` and - `query()` ([PR #304](https://github.com/kamilkisiela/apollo-angular/pull/304)) + `query()` ([PR #304](https://github.com/the-guild-org/apollo-angular/pull/304)) ## v0.13.0 - Run `subscribe`, `mutate` and `query` within a Zone - ([PR #297](https://github.com/kamilkisiela/apollo-angular/pull/297)) + ([PR #297](https://github.com/the-guild-org/apollo-angular/pull/297)) ## v0.12.0 - Support `apollo-client@1.0.0-rc.2` - ([PR #290](https://github.com/kamilkisiela/apollo-angular/pull/290)) -- Support `jsnext:main` ([PR #277](https://github.com/kamilkisiela/apollo-angular/pull/277)) + ([PR #290](https://github.com/the-guild-org/apollo-angular/pull/290)) +- Support `jsnext:main` ([PR #277](https://github.com/the-guild-org/apollo-angular/pull/277)) ## v0.11.0 - Remove `DeprecatedWatchQueryOptions` and use `WatchQueryOptions` - ([PR #274](https://github.com/kamilkisiela/apollo-angular/pull/274)) + ([PR #274](https://github.com/the-guild-org/apollo-angular/pull/274)) **After updating to** -([`apollo-client-rxjs@0.5.0`](https://github.com/kamilkisiela/apollo-client-rxjs/blob/master/CHANGELOG.md#v050)) +([`apollo-client-rxjs@0.5.0`](https://github.com/the-guild-org/apollo-client-rxjs/blob/master/CHANGELOG.md#v050)) - Add `result()`, `currentResult()`, `variables`, `setOptions`, `setVariables` to `ApolloQueryObservable` @@ -609,20 +633,20 @@ Behaves the same as the `ObservableQuery` of `apollo-client`. ## v0.10.0 - **BRAKING CHANGE** Change name of the service to `Apollo`, instead of `Angular2Apollo` - ([PR #262](https://github.com/kamilkisiela/apollo-angular/pull/262)) -- Introduce multiple clients ([PR #263](https://github.com/kamilkisiela/apollo-angular/pull/263)) + ([PR #262](https://github.com/the-guild-org/apollo-angular/pull/262)) +- Introduce multiple clients ([PR #263](https://github.com/the-guild-org/apollo-angular/pull/263)) ## v0.9.0 -- Support `apollo-client@0.8.0` ([PR #206](https://github.com/kamilkisiela/apollo-angular/pull/206)) +- Support `apollo-client@0.8.0` ([PR #206](https://github.com/the-guild-org/apollo-angular/pull/206)) - Support `es6` modules and `tree-shaking` - ([PR #151](https://github.com/kamilkisiela/apollo-angular/pull/151), - [PR #206](https://github.com/kamilkisiela/apollo-angular/pull/206)) + ([PR #151](https://github.com/the-guild-org/apollo-angular/pull/151), + [PR #206](https://github.com/the-guild-org/apollo-angular/pull/206)) - Make our `Ahead-of-Time` compilation compatible with Angular 2.3+ - ([PR #189](https://github.com/kamilkisiela/apollo-angular/pull/189), - [PR #195](https://github.com/kamilkisiela/apollo-angular/pull/195)) + ([PR #189](https://github.com/the-guild-org/apollo-angular/pull/189), + [PR #195](https://github.com/the-guild-org/apollo-angular/pull/195)) - Added `getClient()` that exposes an instance of ApolloClient - ([PR #203](https://github.com/kamilkisiela/apollo-angular/pull/203)) + ([PR #203](https://github.com/the-guild-org/apollo-angular/pull/203)) - **BREAKING CHANGE** The way to provide an instance of ApolloClient has changed, [see how](https://github.com/apollographql/angular2-docs/pull/23) - **BREAKING CHANGE** Change the name of the package. Use `apollo-angular` instead of @@ -631,21 +655,21 @@ Behaves the same as the `ObservableQuery` of `apollo-client`. ## v0.8.0 - Made `mutate()` and `query()` methods to return `Observable` instead of `Promise` - ([PR #140](https://github.com/kamilkisiela/apollo-angular/pull/140)) + ([PR #140](https://github.com/the-guild-org/apollo-angular/pull/140)) - Use types of options (for `watchQuery`, `query`, `mutate`) ( - [PR #145](https://github.com/kamilkisiela/apollo-angular/pull/145), - [PR #146](https://github.com/kamilkisiela/apollo-angular/pull/146), - [PR #148](https://github.com/kamilkisiela/apollo-angular/pull/148) ) + [PR #145](https://github.com/the-guild-org/apollo-angular/pull/145), + [PR #146](https://github.com/the-guild-org/apollo-angular/pull/146), + [PR #148](https://github.com/the-guild-org/apollo-angular/pull/148) ) ## v0.7.0 - Added support for **Ahead of Time** compilation - ([PR #124](https://github.com/kamilkisiela/apollo-angular/pull/124)) + ([PR #124](https://github.com/the-guild-org/apollo-angular/pull/124)) ## v0.6.0 - Added support for ApolloClient `v0.5.X` ([PR #]) -- Added `subscribeToMore` function ([PR](https://github.com/kamilkisiela/apollo-client-rxjs/pull/5)) +- Added `subscribeToMore` function ([PR](https://github.com/the-guild-org/apollo-client-rxjs/pull/5)) - **BREAKING CHANGE** No no longer support ApolloClient `v0.4.X` - **BREAKING CHANGE** Removed `Apollo` decorator (use `Angular2Apollo` service) - **BREAKING CHANGE** Removed `ApolloQueryPipe` (use `SelectPipe` instead) @@ -653,9 +677,9 @@ Behaves the same as the `ObservableQuery` of `apollo-client`. ## v0.5.0 - Added `subscribe` method to `Angular2Apollo` service - ([PR #113](https://github.com/kamilkisiela/apollo-angular/pull/113)) + ([PR #113](https://github.com/the-guild-org/apollo-angular/pull/113)) - Added `updateQuery` to `ApolloQueryObservable` - ([PR #113](https://github.com/kamilkisiela/apollo-angular/pull/113)) + ([PR #113](https://github.com/the-guild-org/apollo-angular/pull/113)) - **Deprecated** `ApolloQueryPipe` (use `SelectPipe` instead) - **Deprecated** `Apollo` decorator (use `Angular2Apollo` service) - **BREAKING CHANGE** No longer support for ApolloClient v0.3.X @@ -663,99 +687,99 @@ Behaves the same as the `ObservableQuery` of `apollo-client`. ## v0.4.6 - Moved to Angular 2 final and updated RxJS to the latest version - ([PR #96](https://github.com/kamilkisiela/apollo-angular/pull/96)) + ([PR #96](https://github.com/the-guild-org/apollo-angular/pull/96)) ## v0.4.5 -- Moved to Angular2 RC6 ([PR #81](https://github.com/kamilkisiela/apollo-angular/pull/81)) +- Moved to Angular2 RC6 ([PR #81](https://github.com/the-guild-org/apollo-angular/pull/81)) - Added `fetchMore` to the `ApolloQuery` interface - ([PR #82](https://github.com/kamilkisiela/apollo-angular/pull/82)) - ([Issue #80](https://github.com/kamilkisiela/apollo-angular/issues/80)) + ([PR #82](https://github.com/the-guild-org/apollo-angular/pull/82)) + ([Issue #80](https://github.com/the-guild-org/apollo-angular/issues/80)) ## v0.4.4 - Fixed format of arguments in backward compatible methods - ([PR #74](https://github.com/kamilkisiela/apollo-angular/pull/74)) + ([PR #74](https://github.com/the-guild-org/apollo-angular/pull/74)) - Made queries reusable (use refetch on new variables) - ([PR #74](https://github.com/kamilkisiela/apollo-angular/pull/74)) -- Used [`apollo-client-rxjs`](https://github.com/kamilkisiela/apollo-client-rxjs) - ([PR #72](https://github.com/kamilkisiela/apollo-angular/pull/72)) + ([PR #74](https://github.com/the-guild-org/apollo-angular/pull/74)) +- Used [`apollo-client-rxjs`](https://github.com/the-guild-org/apollo-client-rxjs) + ([PR #72](https://github.com/the-guild-org/apollo-angular/pull/72)) - Fixed an issue that prevents from subscribing to `ApolloQueryObservable` - ([PR #71](https://github.com/kamilkisiela/apollo-angular/pull/71)) + ([PR #71](https://github.com/the-guild-org/apollo-angular/pull/71)) - Added `SelectPipe` and deprecated `ApolloQueryPipe` - ([PR #78](https://github.com/kamilkisiela/apollo-angular/pull/78)) + ([PR #78](https://github.com/the-guild-org/apollo-angular/pull/78)) ## v0.4.3 - Added `ApolloModule` (with RC5 of Angular2 comes NgModules) - ([PR #63](https://github.com/kamilkisiela/apollo-angular/pull/63)) + ([PR #63](https://github.com/the-guild-org/apollo-angular/pull/63)) - Added ability to use query variables as observables. With this, the query can be automatically re-run when those obserables emit new values. - ([PR #64](https://github.com/kamilkisiela/apollo-angular/pull/64)) + ([PR #64](https://github.com/the-guild-org/apollo-angular/pull/64)) ## v0.4.2 -- Added `fetchMore` support ([PR #58](https://github.com/kamilkisiela/apollo-angular/pull/58)) +- Added `fetchMore` support ([PR #58](https://github.com/the-guild-org/apollo-angular/pull/58)) - Exposed `ApolloQueryObservable` in the index module - ([PR #54](https://github.com/kamilkisiela/apollo-angular/pull/54)) + ([PR #54](https://github.com/the-guild-org/apollo-angular/pull/54)) - Added support for getting `loading` state from ApolloQueryResult - [Issue #36](https://github.com/kamilkisiela/apollo-angular/issues/36) - ([PR #43](https://github.com/kamilkisiela/apollo-angular/pull/43)) + [Issue #36](https://github.com/the-guild-org/apollo-angular/issues/36) + ([PR #43](https://github.com/the-guild-org/apollo-angular/pull/43)) - Fixed `ApolloQueryObservable` incompatibility with `Rx.Observable` - ([PR #59](https://github.com/kamilkisiela/apollo-angular/pull/59)) + ([PR #59](https://github.com/the-guild-org/apollo-angular/pull/59)) ## v0.4.1 - Added `ApolloQueryObservable` to support `Rx.Observable` in `Angular2Apollo.watchQuery` method - ([PR #52](https://github.com/kamilkisiela/apollo-angular/pull/52)) + ([PR #52](https://github.com/the-guild-org/apollo-angular/pull/52)) - Added `query` method to `Angular2Apollo` service - ([PR #51](https://github.com/kamilkisiela/apollo-angular/pull/51)) + ([PR #51](https://github.com/the-guild-org/apollo-angular/pull/51)) ## v0.4.0 - Passing all the options of mutation in `Apollo` decorator - [PR #39](https://github.com/kamilkisiela/apollo-angular/pull/39) + [PR #39](https://github.com/the-guild-org/apollo-angular/pull/39) - Added support for `apollo-client` breaking change that moves methods to query's observable - ([PR #40](https://github.com/kamilkisiela/apollo-angular/pull/40)) + ([PR #40](https://github.com/the-guild-org/apollo-angular/pull/40)) - Replaced `lodash` with subpackages, removed `graphql-tag` from dependencies, moved `apollo-client` and `@angular/core` to peerDependecies - ([PR #44](https://github.com/kamilkisiela/apollo-angular/pull/44)) -- Added `ApolloQuery` interface ([PR #45](https://github.com/kamilkisiela/apollo-angular/pull/45)) + ([PR #44](https://github.com/the-guild-org/apollo-angular/pull/44)) +- Added `ApolloQuery` interface ([PR #45](https://github.com/the-guild-org/apollo-angular/pull/45)) ## v0.3.0 - Added SSR support - Left `lodash` as the only one dependency and `@angular/core` with `apollo-client` as - peerDependecies ([PR #29](https://github.com/kamilkisiela/apollo-angular/pull/29)) + peerDependecies ([PR #29](https://github.com/the-guild-org/apollo-angular/pull/29)) - Fixed missing data in reused component - ([PR #30](https://github.com/kamilkisiela/apollo-angular/pull/30)) + ([PR #30](https://github.com/the-guild-org/apollo-angular/pull/30)) - Fixed overwriting query data with the same value on every poll interval - ([PR #34](https://github.com/kamilkisiela/apollo-angular/pull/34)) + ([PR #34](https://github.com/the-guild-org/apollo-angular/pull/34)) ## v0.2.0 - Added polling, refetching and access to unsubscribe method - ([PR #19](https://github.com/kamilkisiela/apollo-angular/pull/19)) + ([PR #19](https://github.com/the-guild-org/apollo-angular/pull/19)) - Added `forceFetch`, `returnPartialData` and `pollInterval` support - ([PR #19](https://github.com/kamilkisiela/apollo-angular/pull/19)) + ([PR #19](https://github.com/the-guild-org/apollo-angular/pull/19)) - Added `errors` and `loading` to the query's result object - ([PR #19](https://github.com/kamilkisiela/apollo-angular/pull/19)) + ([PR #19](https://github.com/the-guild-org/apollo-angular/pull/19)) - Added both results from decorator and service support for `ApolloQueryPipe` - ([PR #27](https://github.com/kamilkisiela/apollo-angular/pull/27)) + ([PR #27](https://github.com/the-guild-org/apollo-angular/pull/27)) - Fixed issue with not setting a query with not defined variables - ([PR #19](https://github.com/kamilkisiela/apollo-angular/pull/19)) + ([PR #19](https://github.com/the-guild-org/apollo-angular/pull/19)) ## v0.1.0 - Added Angular2 RC1 and ApolloClient 0.3.X support - ([PR #16](https://github.com/kamilkisiela/apollo-angular/pull/16), - [PR #17](https://github.com/kamilkisiela/apollo-angular/pull/17)) + ([PR #16](https://github.com/the-guild-org/apollo-angular/pull/16), + [PR #17](https://github.com/the-guild-org/apollo-angular/pull/17)) ## v0.0.2 - Added `@Apollo` decorator - ([99fed6e](https://github.com/kamilkisiela/apollo-angular/commit/99fed6e), - [9f0107e](https://github.com/kamilkisiela/apollo-angular/commit/9f0107e)) + ([99fed6e](https://github.com/the-guild-org/apollo-angular/commit/99fed6e), + [9f0107e](https://github.com/the-guild-org/apollo-angular/commit/9f0107e)) ## v0.0.1 diff --git a/packages/apollo-angular/headers/ng-package.json b/packages/apollo-angular/headers/ng-package.json index 5715f4253..86fcb8dd2 100644 --- a/packages/apollo-angular/headers/ng-package.json +++ b/packages/apollo-angular/headers/ng-package.json @@ -1,7 +1,6 @@ { "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", "lib": { - "entryFile": "src/index.ts", - "flatModuleFile": "ngApolloLinkHeaders" + "entryFile": "src/index.ts" } } diff --git a/packages/apollo-angular/headers/package.json b/packages/apollo-angular/headers/package.json index 43e52ca51..b82f6d64e 100644 --- a/packages/apollo-angular/headers/package.json +++ b/packages/apollo-angular/headers/package.json @@ -2,11 +2,13 @@ "name": "apollo-angular/headers", "type": "module", "description": "An Apollo Link to easily transform headers from being a key-value object to an instance of HttpHeaders. Great combination with apollo-angular-link-http.", - "author": { - "name": "Kamil Kisiela", - "email": "kamil.kisiela@gmail.com", - "url": "https://github.com/kamilkisiela/" - }, + "contributors": [ + { + "name": "Kamil Kisiela", + "email": "kamil.kisiela@gmail.com", + "url": "https://github.com/kamilkisiela/" + } + ], "license": "MIT", "module": "../build/fesm2020/ngApolloLinkHeaders.mjs", "typings": "../build/headers/index.d.ts", diff --git a/packages/apollo-angular/headers/src/index.ts b/packages/apollo-angular/headers/src/index.ts index f2ed5f233..c88b7d6d2 100644 --- a/packages/apollo-angular/headers/src/index.ts +++ b/packages/apollo-angular/headers/src/index.ts @@ -1,18 +1,17 @@ import { HttpHeaders } from '@angular/common/http'; -import { ApolloLink, NextLink, Operation } from '@apollo/client/core'; +import { ApolloLink } from '@apollo/client'; -export const httpHeaders = () => { - return new ApolloLink((operation: Operation, forward: NextLink) => { - const { getContext, setContext } = operation; - const context = getContext(); +export class HttpHeadersLink extends ApolloLink { + constructor() { + super((operation, forward) => { + const { getContext, setContext } = operation; + const context = getContext(); - if (context.headers) { - setContext({ - ...context, - headers: new HttpHeaders(context.headers), - }); - } + if (context.headers) { + setContext({ headers: new HttpHeaders(context.headers) }); + } - return forward(operation); - }); -}; + return forward(operation); + }); + } +} diff --git a/packages/apollo-angular/headers/tests/index.spec.ts b/packages/apollo-angular/headers/tests/index.spec.ts index 30f0eaee1..61bd89308 100644 --- a/packages/apollo-angular/headers/tests/index.spec.ts +++ b/packages/apollo-angular/headers/tests/index.spec.ts @@ -1,8 +1,8 @@ import { of } from 'rxjs'; import { describe, expect, test } from 'vitest'; import { HttpHeaders } from '@angular/common/http'; -import { ApolloLink, execute, gql } from '@apollo/client/core'; -import { httpHeaders } from '../src'; +import { ApolloClient, ApolloLink, execute, gql, InMemoryCache } from '@apollo/client'; +import { HttpHeadersLink } from '../src'; const query = gql` query heroes { @@ -14,10 +14,12 @@ const query = gql` `; const data = { heroes: [{ name: 'Foo', __typename: 'Hero' }] }; -describe('httpHeaders', () => { +const dummyClient = new ApolloClient({ cache: new InMemoryCache(), link: ApolloLink.empty() }); + +describe('HttpHeadersLink', () => { test('should turn object into HttpHeaders', () => new Promise(done => { - const headersLink = httpHeaders(); + const headersLink = new HttpHeadersLink(); const mockLink = new ApolloLink(operation => { const { headers } = operation.getContext(); @@ -30,14 +32,18 @@ describe('httpHeaders', () => { const link = headersLink.concat(mockLink); - execute(link, { - query, - context: { - headers: { - Authorization: 'Bearer Foo', + execute( + link, + { + query, + context: { + headers: { + Authorization: 'Bearer Foo', + }, }, }, - }).subscribe(result => { + { client: dummyClient }, + ).subscribe(result => { expect(result.data).toEqual(data); done(); }); @@ -45,7 +51,7 @@ describe('httpHeaders', () => { test('should not set headers when not defined', () => new Promise(done => { - const headersLink = httpHeaders(); + const headersLink = new HttpHeadersLink(); const mockLink = new ApolloLink(operation => { const { headers } = operation.getContext(); @@ -57,9 +63,7 @@ describe('httpHeaders', () => { const link = headersLink.concat(mockLink); - execute(link, { - query, - }).subscribe(result => { + execute(link, { query }, { client: dummyClient }).subscribe(result => { expect(result.data).toEqual(data); done(); }); diff --git a/packages/apollo-angular/http/ng-package.json b/packages/apollo-angular/http/ng-package.json index 2d252367b..86fcb8dd2 100644 --- a/packages/apollo-angular/http/ng-package.json +++ b/packages/apollo-angular/http/ng-package.json @@ -1,7 +1,6 @@ { "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", "lib": { - "entryFile": "src/index.ts", - "flatModuleFile": "ngApolloLinkHttp" + "entryFile": "src/index.ts" } } diff --git a/packages/apollo-angular/http/package.json b/packages/apollo-angular/http/package.json index 51b290e47..c652b216f 100644 --- a/packages/apollo-angular/http/package.json +++ b/packages/apollo-angular/http/package.json @@ -2,11 +2,13 @@ "name": "apollo-angular/http", "type": "module", "description": "An Apollo Link to allow sending an http request per operation.", - "author": { - "name": "Kamil Kisiela", - "email": "kamil.kisiela@gmail.com", - "url": "https://github.com/kamilkisiela/" - }, + "contributors": [ + { + "name": "Kamil Kisiela", + "email": "kamil.kisiela@gmail.com", + "url": "https://github.com/kamilkisiela/" + } + ], "license": "MIT", "module": "../build/fesm2020/ngApolloLinkHttp.mjs", "typings": "../build/http/index.d.ts", diff --git a/packages/apollo-angular/http/src/http-batch-link.ts b/packages/apollo-angular/http/src/http-batch-link.ts index 6663f698a..be63af9dc 100644 --- a/packages/apollo-angular/http/src/http-batch-link.ts +++ b/packages/apollo-angular/http/src/http-batch-link.ts @@ -2,11 +2,20 @@ import { print } from 'graphql'; import { Observable } from 'rxjs'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ApolloLink, FetchResult, Operation } from '@apollo/client/core'; -import { BatchHandler, BatchLink } from '@apollo/client/link/batch'; -import { BatchOptions, Body, Context, OperationPrinter, Options, Request } from './types'; +import { ApolloLink } from '@apollo/client'; +import { BatchLink } from '@apollo/client/link/batch'; +import type { HttpLink } from './http-link'; +import { Body, Context, OperationPrinter, Request } from './types'; import { createHeadersWithClientAwareness, fetch, mergeHeaders, prioritize } from './utils'; +export declare namespace HttpBatchLink { + export type Options = { + batchMax?: number; + batchInterval?: number; + batchKey?: (operation: ApolloLink.Operation) => string; + } & HttpLink.Options; +} + export const defaults = { batchInterval: 10, batchMax: 10, @@ -23,9 +32,9 @@ export const defaults = { */ export function pick>( context: Context, - options: Options, + options: HttpBatchLink.Options, key: K, -): ReturnType> { +): ReturnType> { return prioritize(context[key], options[key], defaults[key]); } @@ -37,7 +46,7 @@ export class HttpBatchLinkHandler extends ApolloLink { constructor( private readonly httpClient: HttpClient, - private readonly options: BatchOptions, + private readonly options: HttpBatchLink.Options, ) { super(); @@ -48,7 +57,7 @@ export class HttpBatchLinkHandler extends ApolloLink { this.print = this.options.operationPrinter; } - const batchHandler: BatchHandler = (operations: Operation[]) => { + const batchHandler: BatchLink.BatchHandler = (operations: ApolloLink.Operation[]) => { return new Observable((observer: any) => { const body = this.createBody(operations); const headers = this.createHeaders(operations); @@ -86,7 +95,7 @@ export class HttpBatchLinkHandler extends ApolloLink { const batchKey = options.batchKey || - ((operation: Operation) => { + ((operation: ApolloLink.Operation) => { return this.createBatchKey(operation); }); @@ -99,8 +108,8 @@ export class HttpBatchLinkHandler extends ApolloLink { } private createOptions( - operations: Operation[], - ): Required> { + operations: ApolloLink.Operation[], + ): Required> { const context: Context = operations[0].getContext(); return { @@ -110,7 +119,7 @@ export class HttpBatchLinkHandler extends ApolloLink { }; } - private createBody(operations: Operation[]): Body[] { + private createBody(operations: ApolloLink.Operation[]): Body[] { return operations.map(operation => { const includeExtensions = prioritize( operation.getContext().includeExtensions, @@ -140,10 +149,11 @@ export class HttpBatchLinkHandler extends ApolloLink { }); } - private createHeaders(operations: Operation[]): HttpHeaders { + private createHeaders(operations: ApolloLink.Operation[]): HttpHeaders { return operations.reduce( - (headers: HttpHeaders, operation: Operation) => { - return mergeHeaders(headers, operation.getContext().headers); + (headers: HttpHeaders, operation: ApolloLink.Operation) => { + const { headers: contextHeaders } = operation.getContext(); + return contextHeaders ? mergeHeaders(headers, contextHeaders) : headers; }, createHeadersWithClientAwareness({ headers: this.options.headers, @@ -152,7 +162,7 @@ export class HttpBatchLinkHandler extends ApolloLink { ); } - private createBatchKey(operation: Operation): string { + private createBatchKey(operation: ApolloLink.Operation): string { const context: Context & { skipBatching?: boolean } = operation.getContext(); if (context.skipBatching) { @@ -171,8 +181,11 @@ export class HttpBatchLinkHandler extends ApolloLink { return prioritize(context.uri, this.options.uri, '') + opts; } - public request(op: Operation): Observable | null { - return this.batcher.request(op); + public request( + op: ApolloLink.Operation, + forward: ApolloLink.ForwardFunction, + ): Observable { + return this.batcher.request(op, forward); } } @@ -182,7 +195,7 @@ export class HttpBatchLinkHandler extends ApolloLink { export class HttpBatchLink { constructor(private readonly httpClient: HttpClient) {} - public create(options: BatchOptions): HttpBatchLinkHandler { + public create(options: HttpBatchLink.Options): HttpBatchLinkHandler { return new HttpBatchLinkHandler(this.httpClient, options); } } diff --git a/packages/apollo-angular/http/src/http-link.ts b/packages/apollo-angular/http/src/http-link.ts index 9fe1de4e9..4528589a5 100644 --- a/packages/apollo-angular/http/src/http-link.ts +++ b/packages/apollo-angular/http/src/http-link.ts @@ -2,19 +2,35 @@ import { print } from 'graphql'; import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { ApolloLink, FetchResult, Operation } from '@apollo/client/core'; +import { ApolloLink } from '@apollo/client'; import { pick } from './http-batch-link'; -import { Body, Context, OperationPrinter, Options, Request } from './types'; +import { + Body, + Context, + ExtractFiles, + FetchOptions, + HttpRequestOptions, + OperationPrinter, + Request, +} from './types'; import { createHeadersWithClientAwareness, fetch, mergeHeaders } from './utils'; +export declare namespace HttpLink { + export interface Options extends FetchOptions, HttpRequestOptions { + operationPrinter?: OperationPrinter; + useGETForQueries?: boolean; + extractFiles?: ExtractFiles; + } +} + // XXX find a better name for it export class HttpLinkHandler extends ApolloLink { - public requester: (operation: Operation) => Observable | null; + public requester: (operation: ApolloLink.Operation) => Observable; private print: OperationPrinter = print; constructor( private readonly httpClient: HttpClient, - private readonly options: Options, + private readonly options: HttpLink.Options, ) { super(); @@ -22,7 +38,7 @@ export class HttpLinkHandler extends ApolloLink { this.print = this.options.operationPrinter; } - this.requester = (operation: Operation) => + this.requester = (operation: ApolloLink.Operation) => new Observable((observer: any) => { const context: Context = operation.getContext(); @@ -85,7 +101,7 @@ export class HttpLinkHandler extends ApolloLink { }); } - public request(op: Operation): Observable | null { + public request(op: ApolloLink.Operation): Observable { return this.requester(op); } } @@ -96,7 +112,7 @@ export class HttpLinkHandler extends ApolloLink { export class HttpLink { constructor(private readonly httpClient: HttpClient) {} - public create(options: Options): HttpLinkHandler { + public create(options: HttpLink.Options): HttpLinkHandler { return new HttpLinkHandler(this.httpClient, options); } } diff --git a/packages/apollo-angular/http/src/index.ts b/packages/apollo-angular/http/src/index.ts index 7791a9da5..4c05cd559 100644 --- a/packages/apollo-angular/http/src/index.ts +++ b/packages/apollo-angular/http/src/index.ts @@ -2,5 +2,3 @@ export { HttpLink, HttpLinkHandler } from './http-link'; // http-batch export { HttpBatchLink, HttpBatchLinkHandler } from './http-batch-link'; -// common -export { BatchOptions, Options } from './types'; diff --git a/packages/apollo-angular/http/src/types.ts b/packages/apollo-angular/http/src/types.ts index 58ddf3612..b6802d3cc 100644 --- a/packages/apollo-angular/http/src/types.ts +++ b/packages/apollo-angular/http/src/types.ts @@ -1,6 +1,10 @@ import { DocumentNode } from 'graphql'; import { HttpHeaders } from '@angular/common/http'; -import { Operation } from '@apollo/client/core'; +import { ApolloLink } from '@apollo/client'; + +declare module '@apollo/client' { + export interface DefaultContext extends Context {} +} export type HttpRequestOptions = { headers?: HttpHeaders; @@ -8,7 +12,7 @@ export type HttpRequestOptions = { useMultipart?: boolean; }; -export type URIFunction = (operation: Operation) => string; +export type URIFunction = (operation: ApolloLink.Operation) => string; export type FetchOptions = { method?: string; @@ -19,12 +23,6 @@ export type FetchOptions = { export type OperationPrinter = (operation: DocumentNode) => string; -export interface Options extends FetchOptions, HttpRequestOptions { - operationPrinter?: OperationPrinter; - useGETForQueries?: boolean; - extractFiles?: ExtractFiles; -} - export type Body = { query?: string; variables?: Record; @@ -47,9 +45,3 @@ export type ExtractedFiles = { }; export type ExtractFiles = (body: Body | Body[]) => ExtractedFiles; - -export type BatchOptions = { - batchMax?: number; - batchInterval?: number; - batchKey?: (operation: Operation) => string; -} & Options; diff --git a/packages/apollo-angular/http/tests/http-batch-link.spec.ts b/packages/apollo-angular/http/tests/http-batch-link.spec.ts index 2e348da8e..be91a77d1 100644 --- a/packages/apollo-angular/http/tests/http-batch-link.spec.ts +++ b/packages/apollo-angular/http/tests/http-batch-link.spec.ts @@ -2,8 +2,10 @@ import { afterEach, beforeEach, describe, expect, test } from 'vitest'; import { HttpHeaders, provideHttpClient } from '@angular/common/http'; import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { ApolloLink, execute, gql, Operation } from '@apollo/client/core'; +import { ApolloLink, gql } from '@apollo/client'; +import { getOperationName } from '@apollo/client/utilities/internal'; import { HttpBatchLink } from '../src/http-batch-link'; +import { executeWithDefaultContext as execute } from './utils'; const noop = () => { // @@ -36,7 +38,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes', variables: {}, }; const data = { @@ -71,7 +72,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes', variables: {}, }; @@ -96,7 +96,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes-1', variables: {}, }; const op2 = { @@ -107,7 +106,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes-2', variables: {}, }; @@ -116,8 +114,8 @@ describe('HttpBatchLink', () => { setTimeout(() => { httpBackend.match(req => { - expect(req.body[0].operationName).toEqual(op1.operationName); - expect(req.body[1].operationName).toEqual(op2.operationName); + expect(req.body[0].operationName).toEqual(getOperationName(op1.query)); + expect(req.body[1].operationName).toEqual(getOperationName(op2.query)); done(); return true; }); @@ -135,7 +133,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes', variables: {}, }; @@ -143,7 +140,7 @@ describe('HttpBatchLink', () => { setTimeout(() => { httpBackend.match(req => { - expect(req.body[0].operationName).toEqual(op.operationName); + expect(req.body[0].operationName).toEqual(getOperationName(op.query)); expect(req.reportProgress).toEqual(false); expect(req.responseType).toEqual('json'); expect(req.detectContentTypeHeader()).toEqual('application/json'); @@ -164,7 +161,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes', variables: {}, }; @@ -173,7 +169,7 @@ describe('HttpBatchLink', () => { setTimeout(() => { httpBackend.match(req => { expect(req.method).toEqual('POST'); - expect(req.body[0].operationName).toEqual(op.operationName); + expect(req.body[0].operationName).toEqual(getOperationName(op.query)); expect(req.detectContentTypeHeader()).toEqual('application/json'); done(); return true; @@ -196,7 +192,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes', variables: { up: 'dog' }, extensions: { what: 'what' }, }; @@ -525,7 +520,7 @@ describe('HttpBatchLink', () => { execute(link, { query: gql` - query heroes($first: Int!) { + query op1($first: Int!) { heroes(first: $first) { name } @@ -534,17 +529,15 @@ describe('HttpBatchLink', () => { variables: { first: 5, }, - operationName: 'op1', }).subscribe(noop); execute(link, { query: gql` - query heroes { + query op2 { heroes { name } } `, - operationName: 'op2', }).subscribe(noop); setTimeout(() => { @@ -571,7 +564,8 @@ describe('HttpBatchLink', () => { new Promise(done => { const link = httpLink.create({ uri: 'graphql', - batchKey: (operation: Operation) => operation.getContext().uri || 'graphql', + batchKey: (operation: ApolloLink.Operation) => + (operation.getContext().uri as string) || 'graphql', }); execute(link, { @@ -582,7 +576,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'op1', }).subscribe(noop); execute(link, { @@ -593,7 +586,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'op2', context: { uri: 'gql', }, @@ -639,7 +631,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'op1', }).subscribe(noop); execute(link, { @@ -650,7 +641,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'op2', context: { uri: 'gql', }, @@ -698,7 +688,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'op1', }).subscribe(noop); execute(link, { @@ -709,7 +698,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'op2', context: { skipBatching: true, }, @@ -752,7 +740,6 @@ describe('HttpBatchLink', () => { } } `, - operationName: 'heroes', variables: {}, }; diff --git a/packages/apollo-angular/http/tests/http-link.spec.ts b/packages/apollo-angular/http/tests/http-link.spec.ts index 387e7326d..36516b20e 100644 --- a/packages/apollo-angular/http/tests/http-link.spec.ts +++ b/packages/apollo-angular/http/tests/http-link.spec.ts @@ -4,9 +4,10 @@ import { afterEach, beforeEach, describe, expect, test } from 'vitest'; import { HttpHeaders, provideHttpClient } from '@angular/common/http'; import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing'; import { TestBed } from '@angular/core/testing'; -import { ApolloLink, execute, gql, InMemoryCache } from '@apollo/client/core'; +import { ApolloLink, gql, InMemoryCache } from '@apollo/client'; import { Apollo } from '../../src'; import { HttpLink } from '../src/http-link'; +import { executeWithDefaultContext as execute } from './utils'; const noop = () => { // diff --git a/packages/apollo-angular/http/tests/ssr.spec.ts b/packages/apollo-angular/http/tests/ssr.spec.ts index 13b43b539..6f6e4cf30 100644 --- a/packages/apollo-angular/http/tests/ssr.spec.ts +++ b/packages/apollo-angular/http/tests/ssr.spec.ts @@ -10,8 +10,9 @@ import { renderModule, ServerModule, } from '@angular/platform-server'; -import { execute, gql } from '@apollo/client/core'; +import { gql } from '@apollo/client'; import { HttpLink } from '../src/http-link'; +import { executeWithDefaultContext as execute } from './utils'; describe.skip('integration', () => { let doc: string; diff --git a/packages/apollo-angular/http/tests/utils.ts b/packages/apollo-angular/http/tests/utils.ts new file mode 100644 index 000000000..177efa97c --- /dev/null +++ b/packages/apollo-angular/http/tests/utils.ts @@ -0,0 +1,19 @@ +import { Observable } from 'rxjs'; +import { ApolloClient, ApolloLink, execute, InMemoryCache } from '@apollo/client'; + +export function createDefaultExecuteContext(): ApolloLink.ExecuteContext { + return { + client: new ApolloClient({ + cache: new InMemoryCache(), + link: ApolloLink.empty(), + }), + }; +} + +export function executeWithDefaultContext( + link: ApolloLink, + request: ApolloLink.Request, + context: ApolloLink.ExecuteContext = createDefaultExecuteContext(), +): Observable { + return execute(link, request, context); +} diff --git a/packages/apollo-angular/ng-package.json b/packages/apollo-angular/ng-package.json index 7a62d03fc..910f87579 100644 --- a/packages/apollo-angular/ng-package.json +++ b/packages/apollo-angular/ng-package.json @@ -2,8 +2,7 @@ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", "dest": "build", "lib": { - "entryFile": "src/index.ts", - "flatModuleFile": "ngApollo" + "entryFile": "src/index.ts" }, "allowedNonPeerDependencies": ["extract-files"] } diff --git a/packages/apollo-angular/package.json b/packages/apollo-angular/package.json index fecb00609..3adbf0c8c 100644 --- a/packages/apollo-angular/package.json +++ b/packages/apollo-angular/package.json @@ -1,19 +1,21 @@ { "name": "apollo-angular", - "version": "10.0.3", + "version": "11.0.0", "type": "module", "description": "Use your GraphQL data in your Angular app, with the Apollo Client", "repository": { "type": "git", - "url": "https://github.com/kamilkisiela/apollo-angular", + "url": "https://github.com/the-guild-org/apollo-angular", "directory": "packages/apollo-angular" }, "homepage": "https://www.apollo-angular.com/", - "author": { - "name": "Kamil Kisiela", - "email": "kamil.kisiela@gmail.com", - "url": "https://github.com/kamilkisiela/" - }, + "contributors": [ + { + "name": "Kamil Kisiela", + "email": "kamil.kisiela@gmail.com", + "url": "https://github.com/kamilkisiela/" + } + ], "license": "MIT", "engines": { "node": ">=16" @@ -36,10 +38,10 @@ "test:schematics": "tsc -p schematics/tsconfig.test.json && node scripts/move-schematics.js && jasmine --config=schematics/jasmine.json" }, "peerDependencies": { - "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0", - "@apollo/client": "^3.13.1", - "graphql": "^15.0.0 || ^16.0.0", - "rxjs": "^6.0.0 || ^7.0.0" + "@angular/core": "^18.0.0 || ^19.0.0 || ^20.0.0", + "@apollo/client": "^4.0.1", + "graphql": "^16.0.0", + "rxjs": "^7.3.0" }, "dependencies": { "tslib": "^2.6.2" diff --git a/packages/apollo-angular/persisted-queries/CHANGELOG.md b/packages/apollo-angular/persisted-queries/CHANGELOG.md index b24722d86..22349ec07 100644 --- a/packages/apollo-angular/persisted-queries/CHANGELOG.md +++ b/packages/apollo-angular/persisted-queries/CHANGELOG.md @@ -21,7 +21,7 @@ ### v1.0.0-beta.2 - Adds `sideEffects: false` (webpack) - ([PR #580](https://github.com/kamilkisiela/apollo-angular/pull/580)) + ([PR #580](https://github.com/the-guild-org/apollo-angular/pull/580)) ### v1.0.0-beta.0 diff --git a/packages/apollo-angular/persisted-queries/ng-package.json b/packages/apollo-angular/persisted-queries/ng-package.json index fa9665628..86fcb8dd2 100644 --- a/packages/apollo-angular/persisted-queries/ng-package.json +++ b/packages/apollo-angular/persisted-queries/ng-package.json @@ -1,7 +1,6 @@ { "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", "lib": { - "entryFile": "src/index.ts", - "flatModuleFile": "ngApolloLinkPersisted" + "entryFile": "src/index.ts" } } diff --git a/packages/apollo-angular/persisted-queries/package.json b/packages/apollo-angular/persisted-queries/package.json index f4804380e..baa5c7a4a 100644 --- a/packages/apollo-angular/persisted-queries/package.json +++ b/packages/apollo-angular/persisted-queries/package.json @@ -2,11 +2,13 @@ "name": "apollo-angular/persisted-queries", "type": "module", "description": "Use persisted queries with Apollo Link", - "author": { - "name": "Kamil Kisiela", - "email": "kamil.kisiela@gmail.com", - "url": "https://github.com/kamilkisiela/" - }, + "contributors": [ + { + "name": "Kamil Kisiela", + "email": "kamil.kisiela@gmail.com", + "url": "https://github.com/kamilkisiela/" + } + ], "license": "MIT", "module": "../build/fesm2020/ngApolloLinkPersisted.mjs", "typings": "../build/persisted-queries/index.d.ts", diff --git a/packages/apollo-angular/persisted-queries/src/index.ts b/packages/apollo-angular/persisted-queries/src/index.ts index f2ec7ce46..f0c0be207 100644 --- a/packages/apollo-angular/persisted-queries/src/index.ts +++ b/packages/apollo-angular/persisted-queries/src/index.ts @@ -1,10 +1,10 @@ -import { setContext } from '@apollo/client/link/context'; -import { ApolloLink } from '@apollo/client/link/core'; -import { createPersistedQueryLink as _createPersistedQueryLink } from '@apollo/client/link/persisted-queries'; +import { ApolloLink } from '@apollo/client/link'; +import { SetContextLink } from '@apollo/client/link/context'; +import { PersistedQueryLink } from '@apollo/client/link/persisted-queries'; -export type Options = Parameters[0]; +export type Options = PersistedQueryLink.Options; -const transformLink = setContext((_, context) => { +const transformLink = new SetContextLink(context => { const ctx: any = {}; if (context.http) { @@ -19,5 +19,5 @@ const transformLink = setContext((_, context) => { return ctx; }); -export const createPersistedQueryLink = (options: Options) => - ApolloLink.from([_createPersistedQueryLink(options), transformLink as any]); +export const createPersistedQueryLink = (options: PersistedQueryLink.Options) => + ApolloLink.from([new PersistedQueryLink(options), transformLink]); diff --git a/packages/apollo-angular/persisted-queries/tests/persisted-queries.spec.ts b/packages/apollo-angular/persisted-queries/tests/persisted-queries.spec.ts index 7e06a7761..05b3a1dec 100644 --- a/packages/apollo-angular/persisted-queries/tests/persisted-queries.spec.ts +++ b/packages/apollo-angular/persisted-queries/tests/persisted-queries.spec.ts @@ -1,6 +1,12 @@ import { Observable } from 'rxjs'; import { describe, expect, test, vi } from 'vitest'; -import { ApolloLink, execute, FetchResult, gql, Operation } from '@apollo/client/core'; +import { + ApolloClient, + ApolloLink, + execute as executeLink, + gql, + InMemoryCache, +} from '@apollo/client'; import { createPersistedQueryLink } from '../src'; const query = gql` @@ -13,6 +19,12 @@ const query = gql` `; const data = { heroes: [{ name: 'Foo', __typename: 'Hero' }] }; +function execute(link: ApolloLink, request: ApolloLink.Request) { + return executeLink(link, request, { + client: new ApolloClient({ cache: new InMemoryCache(), link: ApolloLink.empty() }), + }); +} + class MockLink extends ApolloLink { public showNotFound: boolean = true; @@ -24,8 +36,8 @@ class MockLink extends ApolloLink { : data; } - public request(operation: Operation) { - return new Observable(observer => { + public request(operation: ApolloLink.Operation) { + return new Observable(observer => { const request: any = {}; if (operation.getContext().includeQuery) { @@ -55,7 +67,7 @@ describe('createPersistedQueryLink', () => { query, }).subscribe(() => { const firstReq = spyRequester.calls[0][0] as any; - const secondOp = spyRequest.calls[1][0] as Operation; + const secondOp = spyRequest.calls[1][0] as ApolloLink.Operation; const secondReq = spyRequester.calls[1][0] as any; const secondContext = secondOp.getContext(); @@ -87,7 +99,7 @@ describe('createPersistedQueryLink', () => { execute(link, { query, }).subscribe(() => { - const op = spyRequest.calls[1][0] as Operation; + const op = spyRequest.calls[1][0] as ApolloLink.Operation; const ctx = op.getContext(); // should be compatible with apollo-angular-link-http diff --git a/packages/apollo-angular/schematics/install/files/module/graphql.module.ts b/packages/apollo-angular/schematics/install/files/module/graphql.module.ts index f1eea19fd..7bc609bda 100644 --- a/packages/apollo-angular/schematics/install/files/module/graphql.module.ts +++ b/packages/apollo-angular/schematics/install/files/module/graphql.module.ts @@ -1,9 +1,9 @@ import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject, NgModule } from '@angular/core'; -import { ApolloClientOptions, InMemoryCache } from '@apollo/client/core'; +import { ApolloClient, InMemoryCache } from '@apollo/client'; -export function createApollo(): ApolloClientOptions { +export function createApollo(): ApolloClient.Options { const uri = '<%= endpoint %>'; // <-- add the URL of the GraphQL server here const httpLink = inject(HttpLink); diff --git a/packages/apollo-angular/schematics/install/index.cts b/packages/apollo-angular/schematics/install/index.cts index 0894c4c21..ef6937648 100644 --- a/packages/apollo-angular/schematics/install/index.cts +++ b/packages/apollo-angular/schematics/install/index.cts @@ -33,8 +33,8 @@ export function factory(options: Schema): Rule { export function createDependenciesMap(options: Schema): Record { return { - 'apollo-angular': '^7.0.0', - '@apollo/client': '^3.0.0', + 'apollo-angular': '^9.0.0', + '@apollo/client': '^4.0.1', graphql: `^${options.graphql ?? '16.0.0'}`, }; } @@ -98,7 +98,7 @@ function includeAsyncIterableLib(): Rule { '\n' + tags.stripIndent` We couldn't find '${requiredLib}' in the list of library files to be included in the compilation. - It's required by '@apollo/client/core' package so please add it to your tsconfig. + It's required by '@apollo/client' package so please add it to your tsconfig. ` + '\n', ); @@ -151,7 +151,7 @@ function allowSyntheticDefaultImports(): Rule { '\n' + tags.stripIndent` We couldn't enable 'allowSyntheticDefaultImports' flag. - It's required by '@apollo/client/core' package so please add it to your tsconfig. + It's required by '@apollo/client' package so please add it to your tsconfig. ` + '\n', ); @@ -201,7 +201,7 @@ function importSetup(options: Schema): Rule { link: httpLink.create({ uri: '<%= endpoint %>', }), - cache: new ${external('InMemoryCache', '@apollo/client/core')}(), + cache: new ${external('InMemoryCache', '@apollo/client')}(), }; })`; }); diff --git a/packages/apollo-angular/src/apollo-module.ts b/packages/apollo-angular/src/apollo-module.ts index 889c48ccc..49fcb62c8 100644 --- a/packages/apollo-angular/src/apollo-module.ts +++ b/packages/apollo-angular/src/apollo-module.ts @@ -1,11 +1,11 @@ import { Provider } from '@angular/core'; -import { ApolloClientOptions } from '@apollo/client/core'; +import { ApolloClient } from '@apollo/client'; import { Apollo } from './apollo'; import { APOLLO_FLAGS, APOLLO_NAMED_OPTIONS, APOLLO_OPTIONS } from './tokens'; import { Flags, NamedOptions } from './types'; -export function provideApollo( - optionsFactory: () => ApolloClientOptions, +export function provideApollo( + optionsFactory: () => ApolloClient.Options, flags: Flags = {}, ): Provider { return [ diff --git a/packages/apollo-angular/src/apollo.ts b/packages/apollo-angular/src/apollo.ts index a439332f9..da82f2863 100644 --- a/packages/apollo-angular/src/apollo.ts +++ b/packages/apollo-angular/src/apollo.ts @@ -1,65 +1,93 @@ import { Observable } from 'rxjs'; import { Inject, Injectable, NgZone, Optional } from '@angular/core'; -import type { - ApolloClientOptions, - ApolloQueryResult, - FetchResult, - ObservableQuery, - OperationVariables, - QueryOptions, - SubscriptionOptions, - WatchFragmentResult, -} from '@apollo/client/core'; -import { ApolloClient } from '@apollo/client/core'; +import type { OperationVariables } from '@apollo/client'; +import { ApolloClient } from '@apollo/client'; import { QueryRef } from './query-ref'; import { APOLLO_FLAGS, APOLLO_NAMED_OPTIONS, APOLLO_OPTIONS } from './tokens'; -import type { - EmptyObject, - ExtraSubscriptionOptions, - Flags, - MutationOptions, - MutationResult, - NamedOptions, - WatchFragmentOptions, - WatchQueryOptions, -} from './types'; +import type { EmptyObject, Flags, NamedOptions } from './types'; import { fromLazyPromise, useMutationLoading, wrapWithZone } from './utils'; -export class ApolloBase { +export declare namespace Apollo { + export type WatchQueryOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = ApolloClient.WatchQueryOptions; + + export type QueryOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = ApolloClient.QueryOptions; + + export type QueryResult = ApolloClient.QueryResult; + + export type MutateOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = ApolloClient.MutateOptions & { + /** + * Observable starts with `{ loading: true }`. + * + * Disabled by default + */ + useMutationLoading?: boolean; + }; + + export type MutateResult = ApolloClient.MutateResult & { + loading?: boolean; + }; + + export type SubscribeOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = ApolloClient.SubscribeOptions & { + useZone?: boolean; + }; + + export type SubscribeResult = ApolloClient.SubscribeResult; + + export interface WatchFragmentOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > extends ApolloClient.WatchFragmentOptions { + useZone?: boolean; + } + + export type WatchFragmentResult = ApolloClient.WatchFragmentResult; +} + +export class ApolloBase { private useMutationLoading: boolean; constructor( protected readonly ngZone: NgZone, protected readonly flags?: Flags, - protected _client?: ApolloClient, + protected _client?: ApolloClient, ) { this.useMutationLoading = flags?.useMutationLoading ?? false; } public watchQuery( - options: WatchQueryOptions, + options: Apollo.WatchQueryOptions, ): QueryRef { return new QueryRef( - this.ensureClient().watchQuery({ - ...options, - }) as ObservableQuery, + this.ensureClient().watchQuery({ ...options }), this.ngZone, ); } - public query( - options: QueryOptions, - ): Observable> { - return fromLazyPromise>(() => - this.ensureClient().query({ ...options }), + public query( + options: Apollo.QueryOptions, + ): Observable> { + return fromLazyPromise>(() => + this.ensureClient().query({ ...options }), ); } - public mutate( - options: MutationOptions, - ): Observable> { + public mutate( + options: Apollo.MutateOptions, + ): Observable> { return useMutationLoading( - fromLazyPromise(() => this.ensureClient().mutate({ ...options })), + fromLazyPromise(() => this.ensureClient().mutate({ ...options })), options.useMutationLoading ?? this.useMutationLoading, ); } @@ -68,27 +96,29 @@ export class ApolloBase { TFragmentData = unknown, TVariables extends OperationVariables = EmptyObject, >( - options: WatchFragmentOptions, - extra?: ExtraSubscriptionOptions, - ): Observable> { - const obs = this.ensureClient().watchFragment({ ...options }); + options: Apollo.WatchFragmentOptions, + ): Observable> { + const { useZone, ...opts } = options; + const obs = this.ensureClient().watchFragment({ ...opts }); - return extra && extra.useZone !== true ? obs : wrapWithZone(obs, this.ngZone); + return useZone !== true ? obs : wrapWithZone(obs, this.ngZone); } - public subscribe( - options: SubscriptionOptions, - extra?: ExtraSubscriptionOptions, - ): Observable> { - const obs = this.ensureClient().subscribe({ ...options }); + public subscribe( + options: Apollo.SubscribeOptions, + ): Observable> { + const { useZone, ...opts } = options; + const obs = this.ensureClient().subscribe({ + ...opts, + } as ApolloClient.SubscribeOptions); - return extra && extra.useZone !== true ? obs : wrapWithZone(obs, this.ngZone); + return useZone !== true ? obs : wrapWithZone(obs, this.ngZone); } /** * Get an instance of ApolloClient */ - public get client(): ApolloClient { + public get client(): ApolloClient { return this.ensureClient(); } @@ -98,7 +128,7 @@ export class ApolloBase { * * @param client ApolloClient instance */ - public set client(client: ApolloClient) { + public set client(client: ApolloClient) { if (this._client) { throw new Error('Client has been already defined'); } @@ -106,13 +136,13 @@ export class ApolloBase { this._client = client; } - private ensureClient(): ApolloClient { + private ensureClient(): ApolloClient { this.checkInstance(); return this._client!; } - private checkInstance(): this is { _client: ApolloClient } { + private checkInstance(): this is { _client: ApolloClient } { if (this._client) { return true; } else { @@ -122,14 +152,14 @@ export class ApolloBase { } @Injectable() -export class Apollo extends ApolloBase { - private map: Map> = new Map>(); +export class Apollo extends ApolloBase { + private map: Map = new Map(); constructor( ngZone: NgZone, @Optional() @Inject(APOLLO_OPTIONS) - apolloOptions?: ApolloClientOptions, + apolloOptions?: ApolloClient.Options, @Inject(APOLLO_NAMED_OPTIONS) @Optional() apolloNamedOptions?: NamedOptions, @Inject(APOLLO_FLAGS) @Optional() flags?: Flags, ) { @@ -154,18 +184,18 @@ export class Apollo extends ApolloBase { * @param options Options required to create ApolloClient * @param name client's name */ - public create(options: ApolloClientOptions, name?: string): void { + public create(options: ApolloClient.Options, name?: string): void { if (isNamed(name)) { - this.createNamed(name, options); + this.createNamed(name, options); } else { - this.createDefault(options); + this.createDefault(options); } } /** * Use a default ApolloClient */ - public default(): ApolloBase { + public default(): ApolloBase { return this; } @@ -173,7 +203,7 @@ export class Apollo extends ApolloBase { * Use a named ApolloClient * @param name client's name */ - public use(name: string): ApolloBase { + public use(name: string): ApolloBase { if (isNamed(name)) { return this.map.get(name)!; } else { @@ -185,12 +215,12 @@ export class Apollo extends ApolloBase { * Create a default ApolloClient, same as `apollo.create(options)` * @param options ApolloClient's options */ - public createDefault(options: ApolloClientOptions): void { + public createDefault(options: ApolloClient.Options): void { if (this._client) { throw new Error('Apollo has been already created.'); } - this.client = this.ngZone.runOutsideAngular(() => new ApolloClient(options)); + this.client = this.ngZone.runOutsideAngular(() => new ApolloClient(options)); } /** @@ -198,7 +228,7 @@ export class Apollo extends ApolloBase { * @param name client's name * @param options ApolloClient's options */ - public createNamed(name: string, options: ApolloClientOptions): void { + public createNamed(name: string, options: ApolloClient.Options): void { if (this.map.has(name)) { throw new Error(`Client ${name} has been already created`); } @@ -207,7 +237,7 @@ export class Apollo extends ApolloBase { new ApolloBase( this.ngZone, this.flags, - this.ngZone.runOutsideAngular(() => new ApolloClient(options)), + this.ngZone.runOutsideAngular(() => new ApolloClient(options)), ), ); } diff --git a/packages/apollo-angular/src/gql.ts b/packages/apollo-angular/src/gql.ts index e58ff8d95..b2363efeb 100644 --- a/packages/apollo-angular/src/gql.ts +++ b/packages/apollo-angular/src/gql.ts @@ -1,4 +1,4 @@ -import { gql as gqlTag, TypedDocumentNode } from '@apollo/client/core'; +import { gql as gqlTag, TypedDocumentNode } from '@apollo/client'; const typedGQLTag: ( literals: ReadonlyArray | Readonly, diff --git a/packages/apollo-angular/src/index.ts b/packages/apollo-angular/src/index.ts index 0b4484e53..1fb141f72 100644 --- a/packages/apollo-angular/src/index.ts +++ b/packages/apollo-angular/src/index.ts @@ -1,4 +1,4 @@ -export type { TypedDocumentNode } from '@apollo/client/core'; +export type { TypedDocumentNode } from '@apollo/client'; export { provideApollo, provideNamedApollo } from './apollo-module'; export { Apollo, ApolloBase } from './apollo'; export { QueryRef, QueryRefFromDocument } from './query-ref'; @@ -6,17 +6,5 @@ export { Query } from './query'; export { Mutation } from './mutation'; export { Subscription } from './subscription'; export { APOLLO_OPTIONS, APOLLO_NAMED_OPTIONS, APOLLO_FLAGS } from './tokens'; -export type { - ExtraSubscriptionOptions, - Flags, - MutationOptionsAlone, - MutationResult, - NamedOptions, - QueryOptionsAlone, - ResultOf, - SubscriptionOptionsAlone, - VariablesOf, - WatchQueryOptions, - WatchQueryOptionsAlone, -} from './types'; +export type { Flags, NamedOptions, ResultOf, VariablesOf } from './types'; export { gql } from './gql'; diff --git a/packages/apollo-angular/src/mutation.ts b/packages/apollo-angular/src/mutation.ts index 7d706ece6..9f79ddc44 100644 --- a/packages/apollo-angular/src/mutation.ts +++ b/packages/apollo-angular/src/mutation.ts @@ -1,25 +1,35 @@ import type { DocumentNode } from 'graphql'; import type { Observable } from 'rxjs'; import { Injectable } from '@angular/core'; -import type { OperationVariables, TypedDocumentNode } from '@apollo/client/core'; +import type { OperationVariables, TypedDocumentNode } from '@apollo/client'; import { Apollo } from './apollo'; -import type { EmptyObject, MutationOptionsAlone, MutationResult } from './types'; +import type { EmptyObject } from './types'; + +export declare namespace Mutation { + export type MutateOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = Omit, 'mutation'>; +} @Injectable() -export abstract class Mutation { - public abstract readonly document: DocumentNode | TypedDocumentNode; +export abstract class Mutation< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, +> { + public abstract readonly document: DocumentNode | TypedDocumentNode; public client = 'default'; constructor(protected readonly apollo: Apollo) {} public mutate( - variables?: V, - options?: MutationOptionsAlone, - ): Observable> { - return this.apollo.use(this.client).mutate({ + ...[options]: {} extends TVariables + ? [options?: Mutation.MutateOptions] + : [options: Mutation.MutateOptions] + ): Observable> { + return this.apollo.use(this.client).mutate({ ...options, - variables, mutation: this.document, - }); + } as Apollo.MutateOptions); } } diff --git a/packages/apollo-angular/src/query-ref.ts b/packages/apollo-angular/src/query-ref.ts index 67504666f..0f336e057 100644 --- a/packages/apollo-angular/src/query-ref.ts +++ b/packages/apollo-angular/src/query-ref.ts @@ -1,31 +1,28 @@ -import { Observable } from 'rxjs'; +import { from, Observable } from 'rxjs'; import { NgZone } from '@angular/core'; import type { - ApolloQueryResult, - FetchMoreQueryOptions, + ApolloClient, MaybeMasked, ObservableQuery, OperationVariables, - SubscribeToMoreOptions, TypedDocumentNode, - Unmasked, -} from '@apollo/client/core'; +} from '@apollo/client'; import { EmptyObject } from './types'; -import { fromObservableQuery, wrapWithZone } from './utils'; +import { wrapWithZone } from './utils'; export type QueryRefFromDocument = - T extends TypedDocumentNode ? QueryRef : never; + T extends TypedDocumentNode + ? QueryRef + : never; export class QueryRef { - public readonly valueChanges: Observable>; - public readonly queryId: ObservableQuery['queryId']; + public readonly valueChanges: Observable>; constructor( private readonly obsQuery: ObservableQuery, ngZone: NgZone, ) { - this.valueChanges = wrapWithZone(fromObservableQuery(this.obsQuery), ngZone); - this.queryId = this.obsQuery.queryId; + this.valueChanges = wrapWithZone(from(this.obsQuery), ngZone); } // ObservableQuery's methods @@ -38,26 +35,10 @@ export class QueryRef['result']> { - return this.obsQuery.result(); - } - public getCurrentResult(): ReturnType['getCurrentResult']> { return this.obsQuery.getCurrentResult(); } - public getLastResult(): ReturnType['getLastResult']> { - return this.obsQuery.getLastResult(); - } - - public getLastError(): ReturnType['getLastError']> { - return this.obsQuery.getLastError(); - } - - public resetLastResults(): ReturnType['resetLastResults']> { - return this.obsQuery.resetLastResults(); - } - public refetch( variables?: Parameters['refetch']>[0], ): ReturnType['refetch']> { @@ -65,16 +46,8 @@ export class QueryRef( - fetchMoreOptions: FetchMoreQueryOptions & { - updateQuery?: ( - previousQueryResult: Unmasked, - options: { - fetchMoreResult: Unmasked; - variables: TFetchVars; - }, - ) => Unmasked; - }, - ): Promise>> { + fetchMoreOptions: ObservableQuery.FetchMoreOptions, + ): Promise>> { return this.obsQuery.fetchMore(fetchMoreOptions); } @@ -82,7 +55,12 @@ export class QueryRef( - options: SubscribeToMoreOptions, + options: ObservableQuery.SubscribeToMoreOptions< + TData, + TSubscriptionVariables, + TSubscriptionData, + TVariables + >, ): ReturnType['subscribeToMore']> { return this.obsQuery.subscribeToMore(options); } @@ -103,15 +81,15 @@ export class QueryRef['setOptions']>[0], - ): ReturnType['setOptions']> { - return this.obsQuery.setOptions(opts); - } - public setVariables( variables: Parameters['setVariables']>[0], ): ReturnType['setVariables']> { return this.obsQuery.setVariables(variables); } + + public reobserve( + options: ObservableQuery.Options, + ): ReturnType['reobserve']> { + return this.obsQuery.reobserve(options); + } } diff --git a/packages/apollo-angular/src/query.ts b/packages/apollo-angular/src/query.ts index 00b2a5d82..4b165a6fa 100644 --- a/packages/apollo-angular/src/query.ts +++ b/packages/apollo-angular/src/query.ts @@ -1,31 +1,49 @@ import type { DocumentNode } from 'graphql'; import type { Observable } from 'rxjs'; import { Injectable } from '@angular/core'; -import type { ApolloQueryResult, OperationVariables, TypedDocumentNode } from '@apollo/client/core'; +import type { OperationVariables, TypedDocumentNode } from '@apollo/client'; import { Apollo } from './apollo'; import { QueryRef } from './query-ref'; -import { EmptyObject, QueryOptionsAlone, WatchQueryOptionsAlone } from './types'; +import { EmptyObject } from './types'; + +export declare namespace Query { + export type WatchOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = Omit, 'query'>; + + export type FetchOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = Omit, 'query'>; +} @Injectable() -export abstract class Query { - public abstract readonly document: DocumentNode | TypedDocumentNode; +export abstract class Query { + public abstract readonly document: DocumentNode | TypedDocumentNode; public client = 'default'; constructor(protected readonly apollo: Apollo) {} - public watch(variables?: V, options?: WatchQueryOptionsAlone): QueryRef { - return this.apollo.use(this.client).watchQuery({ + public watch( + ...[options]: {} extends TVariables + ? [options?: Query.WatchOptions] + : [options: Query.WatchOptions] + ): QueryRef { + return this.apollo.use(this.client).watchQuery({ ...options, - variables, query: this.document, - }); + } as Apollo.WatchQueryOptions); } - public fetch(variables?: V, options?: QueryOptionsAlone): Observable> { - return this.apollo.use(this.client).query({ + public fetch( + ...[options]: {} extends TVariables + ? [options?: Query.FetchOptions] + : [options: Query.FetchOptions] + ): Observable> { + return this.apollo.use(this.client).query({ ...options, - variables, query: this.document, - }); + } as Apollo.QueryOptions); } } diff --git a/packages/apollo-angular/src/subscription.ts b/packages/apollo-angular/src/subscription.ts index 5468529c7..912de96a6 100644 --- a/packages/apollo-angular/src/subscription.ts +++ b/packages/apollo-angular/src/subscription.ts @@ -1,29 +1,35 @@ import type { DocumentNode } from 'graphql'; import type { Observable } from 'rxjs'; import { Injectable } from '@angular/core'; -import type { FetchResult, OperationVariables, TypedDocumentNode } from '@apollo/client/core'; +import type { OperationVariables, TypedDocumentNode } from '@apollo/client'; import { Apollo } from './apollo'; -import { EmptyObject, ExtraSubscriptionOptions, SubscriptionOptionsAlone } from './types'; +import { EmptyObject } from './types'; + +export declare namespace Subscription { + export type SubscribeOptions< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, + > = Omit, 'query'>; +} @Injectable() -export abstract class Subscription { - public abstract readonly document: DocumentNode | TypedDocumentNode; +export abstract class Subscription< + TData = unknown, + TVariables extends OperationVariables = EmptyObject, +> { + public abstract readonly document: DocumentNode | TypedDocumentNode; public client = 'default'; constructor(protected readonly apollo: Apollo) {} public subscribe( - variables?: V, - options?: SubscriptionOptionsAlone, - extra?: ExtraSubscriptionOptions, - ): Observable> { - return this.apollo.use(this.client).subscribe( - { - ...options, - variables, - query: this.document, - }, - extra, - ); + ...[options]: {} extends TVariables + ? [options?: Subscription.SubscribeOptions] + : [options: Subscription.SubscribeOptions] + ): Observable> { + return this.apollo.use(this.client).subscribe({ + ...options, + query: this.document, + } as Apollo.SubscribeOptions); } } diff --git a/packages/apollo-angular/src/tokens.ts b/packages/apollo-angular/src/tokens.ts index b4bfcd303..0a8bda2f2 100644 --- a/packages/apollo-angular/src/tokens.ts +++ b/packages/apollo-angular/src/tokens.ts @@ -1,9 +1,9 @@ import { InjectionToken } from '@angular/core'; -import type { ApolloClientOptions } from '@apollo/client/core'; +import type { ApolloClient } from '@apollo/client'; import type { Flags, NamedOptions } from './types'; export const APOLLO_FLAGS = new InjectionToken('APOLLO_FLAGS'); -export const APOLLO_OPTIONS = new InjectionToken>('APOLLO_OPTIONS'); +export const APOLLO_OPTIONS = new InjectionToken('APOLLO_OPTIONS'); export const APOLLO_NAMED_OPTIONS = new InjectionToken('APOLLO_NAMED_OPTIONS'); diff --git a/packages/apollo-angular/src/types.ts b/packages/apollo-angular/src/types.ts index 972d4605f..dc45338e0 100644 --- a/packages/apollo-angular/src/types.ts +++ b/packages/apollo-angular/src/types.ts @@ -1,14 +1,4 @@ -import type { - ApolloClientOptions, - MutationOptions as CoreMutationOptions, - QueryOptions as CoreQueryOptions, - SubscriptionOptions as CoreSubscriptionOptions, - WatchFragmentOptions as CoreWatchFragmentOptions, - WatchQueryOptions as CoreWatchQueryOptions, - FetchResult, - OperationVariables, - TypedDocumentNode, -} from '@apollo/client/core'; +import type { ApolloClient, TypedDocumentNode } from '@apollo/client'; export type EmptyObject = { [key: string]: any; @@ -19,48 +9,9 @@ export type ResultOf = export type VariablesOf = T extends TypedDocumentNode ? V : never; -export interface ExtraSubscriptionOptions { - useZone?: boolean; -} - -export type MutationResult = FetchResult & { - loading?: boolean; -}; - export type Omit = Pick>; -export interface WatchQueryOptionsAlone< - TVariables extends OperationVariables = EmptyObject, - TData = any, -> extends Omit, 'query' | 'variables'> {} - -export interface QueryOptionsAlone - extends Omit, 'query' | 'variables'> {} - -export interface MutationOptionsAlone - extends Omit, 'mutation' | 'variables'> {} - -export interface SubscriptionOptionsAlone - extends Omit, 'query' | 'variables'> {} - -export interface WatchQueryOptions - extends CoreWatchQueryOptions {} - -export interface MutationOptions - extends CoreMutationOptions { - /** - * Observable starts with `{ loading: true }`. - * There's a big chance the next major version will enable that by default. - * - * Disabled by default - */ - useMutationLoading?: boolean; -} - -export interface WatchFragmentOptions - extends CoreWatchFragmentOptions {} - -export type NamedOptions = Record>; +export type NamedOptions = Record; export type Flags = { /** diff --git a/packages/apollo-angular/src/utils.ts b/packages/apollo-angular/src/utils.ts index 6c5ebb0e1..d4db5d3d8 100644 --- a/packages/apollo-angular/src/utils.ts +++ b/packages/apollo-angular/src/utils.ts @@ -1,8 +1,8 @@ import { Observable, queueScheduler, SchedulerAction, SchedulerLike, Subscription } from 'rxjs'; import { map, observeOn, startWith } from 'rxjs/operators'; import { NgZone } from '@angular/core'; -import type { ApolloQueryResult, FetchResult, ObservableQuery } from '@apollo/client/core'; -import { MutationResult } from './types'; +import type { ApolloClient } from '@apollo/client'; +import { Apollo } from './apollo'; /** * Like RxJS's `fromPromise()`, but starts the promise only when the observable is subscribed to. @@ -27,10 +27,13 @@ export function fromLazyPromise(promiseFn: () => Promise): Observable { }); } -export function useMutationLoading(source: Observable>, enabled: boolean) { +export function useMutationLoading( + source: Observable>, + enabled: boolean, +) { if (!enabled) { return source.pipe( - map, MutationResult>(result => ({ + map, Apollo.MutateResult>(result => ({ ...result, loading: false, })), @@ -38,13 +41,14 @@ export function useMutationLoading(source: Observable>, enable } return source.pipe( - startWith>({ - loading: true, - }), - map, MutationResult>(result => ({ + map, Apollo.MutateResult>(result => ({ ...result, - loading: !!result.loading, + loading: false, })), + startWith>({ + data: undefined, + loading: true, + }), ); } @@ -62,14 +66,6 @@ export class ZoneScheduler implements SchedulerLike { } } -export function fromObservableQuery( - obsQuery: ObservableQuery, -): Observable> { - return new Observable(subscriber => { - return obsQuery.subscribe(subscriber); - }); -} - export function wrapWithZone(obs: Observable, ngZone: NgZone): Observable { return obs.pipe(observeOn(new ZoneScheduler(ngZone))); } diff --git a/packages/apollo-angular/test-utils/ObservableStream.ts b/packages/apollo-angular/test-utils/ObservableStream.ts new file mode 100644 index 000000000..4603d3903 --- /dev/null +++ b/packages/apollo-angular/test-utils/ObservableStream.ts @@ -0,0 +1,169 @@ +/** + * Adapted from + * https://github.com/apollographql/apollo-client/blob/1d165ba37eca7e5d667055553aacc4c26be56065/src/testing/internal/ObservableStream.ts + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +import { ReadableStream } from 'node:stream/web'; +import type { Observable, Subscribable, Unsubscribable } from 'rxjs'; +import { expect } from 'vitest'; +import { equals, iterableEquality, JEST_MATCHERS_OBJECT } from '@vitest/expect'; +import { printDiffOrStringify } from '@vitest/utils/diff'; + +export interface TakeOptions { + timeout?: number; +} +type ObservableEvent = + | { type: 'next'; value: T } + | { type: 'error'; error: any } + | { type: 'complete' }; + +function formatMessage(expected: ObservableEvent, actual: ObservableEvent) { + return printDiffOrStringify(expected, actual, { expand: true }); +} + +export class EventMismatchError extends Error { + static is(error: unknown): error is EventMismatchError { + return error instanceof Error && error.name === 'EventMismatchError'; + } + + constructor(expected: ObservableEvent, actual: ObservableEvent) { + super(formatMessage(expected, actual)); + this.name = 'EventMismatchError'; + + Object.setPrototypeOf(this, EventMismatchError.prototype); + } +} + +export class ObservableStream { + private reader: ReadableStreamDefaultReader>; + private subscription!: Unsubscribable; + private readerQueue: Array>> = []; + + constructor(observable: Observable | Subscribable) { + this.unsubscribe = this.unsubscribe.bind(this); + this.reader = new ReadableStream>({ + start: controller => { + this.subscription = observable.subscribe({ + next: value => controller.enqueue({ type: 'next', value }), + error: error => controller.enqueue({ type: 'error', error }), + complete: () => controller.enqueue({ type: 'complete' }), + }); + }, + }).getReader(); + } + + peek({ timeout = 100 }: TakeOptions = {}) { + // Calling `peek` multiple times in a row should not advance the reader + // multiple times until this value has been consumed. + let readerPromise = this.readerQueue[0]; + + if (!readerPromise) { + // Since this.reader.read() advances the reader in the stream, we don't + // want to consume this promise entirely, otherwise we will miss it when + // calling `take`. Instead, we push it into a queue that can be consumed + // by `take` the next time its called so that we avoid advancing the + // reader until we are finished processing all peeked values. + readerPromise = this.readNextValue(); + this.readerQueue.push(readerPromise); + } + + return Promise.race([ + readerPromise, + new Promise>((_, reject) => { + setTimeout(reject, timeout, new Error('Timeout waiting for next event')); + }), + ]); + } + + take({ timeout = 100 }: TakeOptions = {}) { + return Promise.race([ + this.readerQueue.shift() || this.readNextValue(), + new Promise>((_, reject) => { + setTimeout(reject, timeout, new Error('Timeout waiting for next event')); + }), + ]).then(value => { + if (value.type === 'next') { + this.current = value.value; + } + return value; + }); + } + + [Symbol.dispose]() { + this.unsubscribe(); + } + + unsubscribe() { + this.subscription.unsubscribe(); + } + + async takeNext(options?: TakeOptions): Promise { + const event = await this.take(options); + if (event.type !== 'next') { + throw new EventMismatchError({ type: 'next', value: expect.anything() }, event); + } + return (event as ObservableEvent & { type: 'next' }).value; + } + + async takeError(options?: TakeOptions): Promise { + const event = await this.take(options); + validateEquals(event, { type: 'error', error: expect.anything() }); + return (event as ObservableEvent & { type: 'error' }).error; + } + + async takeComplete(options?: TakeOptions): Promise { + const event = await this.take(options); + validateEquals(event, { type: 'complete' }); + } + + private async readNextValue() { + return this.reader.read().then(result => result.value!); + } + + private current?: T; + getCurrent() { + return this.current; + } +} + +// Lightweight expect(...).toEqual(...) check that avoids using `expect` so that +// `expect.assertions(num)` does not double count assertions when using the take* +// functions inside of expect(stream).toEmit* matchers. +function validateEquals(actualEvent: ObservableEvent, expectedEvent: ObservableEvent) { + // Uses the same matchers as expect(...).toEqual(...) + // https://github.com/vitest-dev/vitest/blob/438c44e7fb8f3a6a36db8ff504f852c01963ba88/packages/expect/src/jest-expect.ts#L107-L110 + const isEqual = equals(actualEvent, expectedEvent, [ + ...getCustomEqualityTesters(), + iterableEquality, + ]); + + if (!isEqual) { + throw new EventMismatchError(expectedEvent, actualEvent); + } +} + +// https://github.com/vitest-dev/vitest/blob/438c44e7fb8f3a6a36db8ff504f852c01963ba88/packages/expect/src/jest-matcher-utils.ts#L157-L159 +function getCustomEqualityTesters() { + return (globalThis as any)[JEST_MATCHERS_OBJECT].customEqualityTesters; +} diff --git a/packages/apollo-angular/test-utils/matchers.ts b/packages/apollo-angular/test-utils/matchers.ts new file mode 100644 index 000000000..2385bebc8 --- /dev/null +++ b/packages/apollo-angular/test-utils/matchers.ts @@ -0,0 +1,6 @@ +import { expect } from 'vitest'; +import { toEmitAnything } from './matchers/toEmitAnything'; + +expect.extend({ + toEmitAnything, +}); diff --git a/packages/apollo-angular/test-utils/matchers/toEmitAnything.ts b/packages/apollo-angular/test-utils/matchers/toEmitAnything.ts new file mode 100644 index 000000000..a4f6730cb --- /dev/null +++ b/packages/apollo-angular/test-utils/matchers/toEmitAnything.ts @@ -0,0 +1,61 @@ +/** + * Adapted from + * https://github.com/apollographql/apollo-client/blob/1d165ba37eca7e5d667055553aacc4c26be56065/src/testing/matchers/toEmitAnything.ts + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +import { ObservableStream, TakeOptions } from 'test-utils/ObservableStream'; +import { RawMatcherFn } from '@vitest/expect'; + +export const toEmitAnything: RawMatcherFn = async function toEmitAnything( + actual, + options?: TakeOptions, +) { + const stream = actual as ObservableStream; + const hint = this.utils.matcherHint('toEmitAnything', 'stream'); + + try { + const value = await stream.peek(options); + + return { + pass: true, + message: () => { + return ( + hint + + '\n\nExpected stream not to emit anything but it did.' + + '\n\nReceived:\n' + + this.utils.printReceived(value) + ); + }, + }; + } catch (error) { + if (error instanceof Error && error.message === 'Timeout waiting for next event') { + return { + pass: false, + message: () => hint + '\n\nExpected stream to emit an event but it did not.', + }; + } else { + throw error; + } + } +}; diff --git a/packages/apollo-angular/testing/ng-package.json b/packages/apollo-angular/testing/ng-package.json index 4810eba94..86fcb8dd2 100644 --- a/packages/apollo-angular/testing/ng-package.json +++ b/packages/apollo-angular/testing/ng-package.json @@ -1,7 +1,6 @@ { "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", "lib": { - "entryFile": "src/index.ts", - "flatModuleFile": "ngApolloTesting" + "entryFile": "src/index.ts" } } diff --git a/packages/apollo-angular/testing/package.json b/packages/apollo-angular/testing/package.json index 68b1ba3ea..5aff38b60 100644 --- a/packages/apollo-angular/testing/package.json +++ b/packages/apollo-angular/testing/package.json @@ -2,7 +2,13 @@ "name": "apollo-angular/testing", "type": "module", "description": "A testing backend for Apollo", - "author": "Kamil Kisiela (http://github.com/kamilkisiela/)", + "contributors": [ + { + "name": "Kamil Kisiela", + "email": "kamil.kisiela@gmail.com", + "url": "https://github.com/kamilkisiela/" + } + ], "license": "MIT", "module": "../build/fesm2020/ngApolloTesting.mjs", "typings": "../build/testing/index.d.ts", diff --git a/packages/apollo-angular/testing/src/backend.ts b/packages/apollo-angular/testing/src/backend.ts index 908b89dc3..b1a03c89d 100644 --- a/packages/apollo-angular/testing/src/backend.ts +++ b/packages/apollo-angular/testing/src/backend.ts @@ -1,7 +1,8 @@ import { DocumentNode, print } from 'graphql'; import { Observable, Observer } from 'rxjs'; import { Injectable } from '@angular/core'; -import { FetchResult } from '@apollo/client/core'; +import { ApolloLink } from '@apollo/client'; +import { addTypenameToDocument } from '@apollo/client/utilities'; import { ApolloTestingController, MatchOperation } from './controller'; import { Operation, TestOperation } from './operation'; @@ -23,7 +24,7 @@ export class ApolloTestingBackend implements ApolloTestingController { /** * Handle an incoming operation by queueing it in the list of open operations. */ - public handle(op: Operation): Observable { + public handle(op: Operation): Observable { return new Observable((observer: Observer) => { const testOp = new TestOperation(op, observer); this.open.push(testOp); @@ -40,7 +41,9 @@ export class ApolloTestingBackend implements ApolloTestingController { return this.open.filter(testOp => match(testOp.operation)); } else { if (this.isDocumentNode(match)) { - return this.open.filter(testOp => print(testOp.operation.query) === print(match)); + return this.open.filter( + testOp => print(testOp.operation.query) === print(addTypenameToDocument(match)), + ); } return this.open.filter(testOp => this.matchOp(match, testOp)); @@ -54,7 +57,7 @@ export class ApolloTestingBackend implements ApolloTestingController { const sameName = this.compare(match.operationName, testOp.operation.operationName); const sameVariables = this.compare(variables, testOp.operation.variables); - const sameQuery = print(testOp.operation.query) === print(match.query); + const sameQuery = print(testOp.operation.query) === print(addTypenameToDocument(match.query)); const sameExtensions = this.compare(extensions, testOp.operation.extensions); diff --git a/packages/apollo-angular/testing/src/module.ts b/packages/apollo-angular/testing/src/module.ts index f7d9de163..9269d0cd1 100644 --- a/packages/apollo-angular/testing/src/module.ts +++ b/packages/apollo-angular/testing/src/module.ts @@ -1,20 +1,13 @@ import { Apollo } from 'apollo-angular'; import { Inject, InjectionToken, NgModule, Optional } from '@angular/core'; -import { - ApolloCache, - ApolloLink, - InMemoryCache, - Operation as LinkOperation, -} from '@apollo/client/core'; +import { ApolloCache, ApolloLink, InMemoryCache } from '@apollo/client'; import { ApolloTestingBackend } from './backend'; import { ApolloTestingController } from './controller'; import { Operation } from './operation'; -export type NamedCaches = Record | undefined | null>; +export type NamedCaches = Record; -export const APOLLO_TESTING_CACHE = new InjectionToken>( - 'apollo-angular/testing cache', -); +export const APOLLO_TESTING_CACHE = new InjectionToken('apollo-angular/testing cache'); export const APOLLO_TESTING_NAMED_CACHE = new InjectionToken( 'apollo-angular/testing named cache', @@ -24,7 +17,7 @@ export const APOLLO_TESTING_CLIENTS = new InjectionToken( 'apollo-angular/testing named clients', ); -function addClient(name: string, op: LinkOperation): Operation { +function addClient(name: string, op: ApolloLink.Operation): Operation { (op as Operation).clientName = name; return op as Operation; @@ -46,12 +39,12 @@ export class ApolloTestingModuleCore { namedClients?: string[], @Optional() @Inject(APOLLO_TESTING_CACHE) - cache?: ApolloCache, + cache?: ApolloCache, @Optional() @Inject(APOLLO_TESTING_NAMED_CACHE) namedCaches?: NamedCaches, ) { - function createOptions(name: string, c?: ApolloCache | null) { + function createOptions(name: string, c?: ApolloCache | null) { return { connectToDevTools: false, link: new ApolloLink(operation => backend.handle(addClient(name, operation))), diff --git a/packages/apollo-angular/testing/src/operation.ts b/packages/apollo-angular/testing/src/operation.ts index 4be45d4e0..1f11257b0 100644 --- a/packages/apollo-angular/testing/src/operation.ts +++ b/packages/apollo-angular/testing/src/operation.ts @@ -1,33 +1,26 @@ -import { FormattedExecutionResult, GraphQLError, Kind, OperationTypeNode } from 'graphql'; +import { GraphQLFormattedError, OperationTypeNode } from 'graphql'; import { Observer } from 'rxjs'; -import { ApolloError, FetchResult, Operation as LinkOperation } from '@apollo/client/core'; -import { getMainDefinition } from '@apollo/client/utilities'; +import { ApolloLink, ErrorLike } from '@apollo/client'; +import { isErrorLike } from '@apollo/client/errors'; -const isApolloError = (err: any): err is ApolloError => err && err.hasOwnProperty('graphQLErrors'); - -export type Operation = LinkOperation & { +export type Operation = ApolloLink.Operation & { clientName: string; }; export class TestOperation { constructor( public readonly operation: Operation, - private readonly observer: Observer>, + private readonly observer: Observer>, ) {} - public flush(result: FormattedExecutionResult | ApolloError): void { - if (isApolloError(result)) { + public flush(result: ApolloLink.Result | ErrorLike): void { + if (isErrorLike(result)) { this.observer.error(result); } else { const fetchResult = result ? { ...result } : result; this.observer.next(fetchResult); - const definition = getMainDefinition(this.operation.query); - - if ( - definition.kind === Kind.OPERATION_DEFINITION && - definition.operation !== OperationTypeNode.SUBSCRIPTION - ) { + if (this.operation.operationType !== OperationTypeNode.SUBSCRIPTION) { this.complete(); } } @@ -38,20 +31,14 @@ export class TestOperation { } public flushData(data: T | null): void { - this.flush({ - data, - }); + this.flush({ data }); } - public networkError(error: Error): void { - const apolloError = new ApolloError({ - networkError: error, - }); - - this.flush(apolloError); + public networkError(error: ErrorLike): void { + this.flush(error); } - public graphqlErrors(errors: GraphQLError[]): void { + public graphqlErrors(errors: GraphQLFormattedError[]): void { this.flush({ errors, }); diff --git a/packages/apollo-angular/testing/tests/integration.spec.ts b/packages/apollo-angular/testing/tests/integration.spec.ts index b4452489b..f88ff42ef 100644 --- a/packages/apollo-angular/testing/tests/integration.spec.ts +++ b/packages/apollo-angular/testing/tests/integration.spec.ts @@ -1,7 +1,7 @@ import { print } from 'graphql'; import { afterEach, beforeEach, describe, expect, test } from 'vitest'; import { TestBed } from '@angular/core/testing'; -import { gql } from '@apollo/client/core'; +import { gql } from '@apollo/client'; import { addTypenameToDocument } from '@apollo/client/utilities'; import { Apollo } from '../../src'; import { ApolloTestingController, ApolloTestingModule } from '../src'; @@ -39,6 +39,7 @@ describe('Integration', () => { heroes: [ { name: 'Superman', + __typename: 'Character', }, ], }; @@ -73,6 +74,7 @@ describe('Integration', () => { heroes: [ { name: 'Superman', + __typename: 'Character', }, ], }; @@ -107,6 +109,7 @@ describe('Integration', () => { heroes: [ { name: 'Superman', + __typename: 'Character', }, ], }; @@ -145,6 +148,7 @@ describe('Integration', () => { heroes: [ { name: 'Superman', + __typename: 'Character', }, ], }; diff --git a/packages/apollo-angular/testing/tests/module.spec.ts b/packages/apollo-angular/testing/tests/module.spec.ts index 0ff46f824..81dc4fb86 100644 --- a/packages/apollo-angular/testing/tests/module.spec.ts +++ b/packages/apollo-angular/testing/tests/module.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from 'vitest'; import { TestBed } from '@angular/core/testing'; -import { gql, InMemoryCache } from '@apollo/client/core'; +import { gql, InMemoryCache } from '@apollo/client'; import { Apollo } from '../../src'; import { APOLLO_TESTING_CACHE, ApolloTestingController, ApolloTestingModule } from '../src'; diff --git a/packages/apollo-angular/testing/tests/operation.spec.ts b/packages/apollo-angular/testing/tests/operation.spec.ts index 4dc586d9f..1cd24075e 100644 --- a/packages/apollo-angular/testing/tests/operation.spec.ts +++ b/packages/apollo-angular/testing/tests/operation.spec.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, test } from 'vitest'; -import { ApolloLink, execute, FetchResult, gql } from '@apollo/client/core'; +import { ApolloLink, gql } from '@apollo/client'; import { ApolloTestingBackend } from '../src/backend'; -import { buildOperationForLink } from './utils'; +import { buildOperationForLink, executeWithDefaultContext as execute } from './utils'; const testQuery = gql` query allHeroes { @@ -73,7 +73,7 @@ describe('TestOperation', () => { test('should leave the operation open for a subscription', () => new Promise(done => { const operation = buildOperationForLink(testSubscription, {}); - const emittedResults: FetchResult[] = []; + const emittedResults: ApolloLink.Result[] = []; execute(link, operation).subscribe({ next(result) { @@ -112,7 +112,7 @@ describe('TestOperation', () => { test('should close the operation after a query', () => new Promise(done => { const operation = buildOperationForLink(testQuery, {}); - const emittedResults: FetchResult[] = []; + const emittedResults: ApolloLink.Result[] = []; execute(link, operation).subscribe({ next(result) { @@ -144,7 +144,7 @@ describe('TestOperation', () => { test('should close the operation after a mutation', () => new Promise(done => { const operation = buildOperationForLink(testMutation, { hero: 'firstHero' }); - const emittedResults: FetchResult[] = []; + const emittedResults: ApolloLink.Result[] = []; execute(link, operation).subscribe({ next(result) { diff --git a/packages/apollo-angular/testing/tests/utils.ts b/packages/apollo-angular/testing/tests/utils.ts index 3305e6e49..3140b29c9 100644 --- a/packages/apollo-angular/testing/tests/utils.ts +++ b/packages/apollo-angular/testing/tests/utils.ts @@ -1,15 +1,33 @@ import { DocumentNode } from 'graphql'; -import type { GraphQLRequest } from '@apollo/client/link/core/types'; -import { getOperationName } from '@apollo/client/utilities'; +import { Observable } from 'rxjs'; +import { ApolloClient, execute, InMemoryCache, OperationVariables } from '@apollo/client'; +import { ApolloLink } from '@apollo/client/link'; +import { addTypenameToDocument } from '@apollo/client/utilities'; -export function buildOperationForLink>( +export function buildOperationForLink( document: DocumentNode, - variables: TVariables, -): GraphQLRequest { + variables: OperationVariables | undefined, +): ApolloLink.Request { return { - query: document, + query: addTypenameToDocument(document), variables, - operationName: getOperationName(document) || undefined, context: {}, }; } + +export function createDefaultExecuteContext(): ApolloLink.ExecuteContext { + return { + client: new ApolloClient({ + cache: new InMemoryCache(), + link: ApolloLink.empty(), + }), + }; +} + +export function executeWithDefaultContext( + link: ApolloLink, + request: ApolloLink.Request, + context: ApolloLink.ExecuteContext = createDefaultExecuteContext(), +): Observable { + return execute(link, request, context); +} diff --git a/packages/apollo-angular/tests/Apollo.spec.ts b/packages/apollo-angular/tests/Apollo.spec.ts index a123f0ffa..953bcd257 100644 --- a/packages/apollo-angular/tests/Apollo.spec.ts +++ b/packages/apollo-angular/tests/Apollo.spec.ts @@ -3,11 +3,12 @@ import { mergeMap } from 'rxjs/operators'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { NgZone } from '@angular/core'; import { TestBed } from '@angular/core/testing'; -import { ApolloLink, InMemoryCache, NetworkStatus } from '@apollo/client/core'; -import { mockSingleLink } from '@apollo/client/testing'; +import { ApolloLink, InMemoryCache, NetworkStatus } from '@apollo/client'; +import { MockLink } from '@apollo/client/testing'; import { Apollo, ApolloBase } from '../src/apollo'; import { gql } from '../src/gql'; import { ZoneScheduler } from '../src/utils'; +import { ObservableStream } from '../test-utils/ObservableStream'; function mockApollo(link: ApolloLink, _ngZone: NgZone) { const apollo = new Apollo(_ngZone); @@ -40,7 +41,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -55,7 +56,7 @@ describe('Apollo', () => { apollo.create( { - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }, 'extra', @@ -71,7 +72,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -90,73 +91,77 @@ describe('Apollo', () => { expect(client.watchQuery).toBeCalledWith(options); }); - test('should be able to refetch', () => - new Promise(done => { - expect.assertions(3); - const query = gql` - query refetch($first: Int) { - heroes(first: $first) { - name - __typename - } + test('should be able to refetch', async () => { + const query = gql` + query refetch($first: Int) { + heroes(first: $first) { + name + __typename } - `; + } + `; - const data1 = { heroes: [{ name: 'Foo', __typename: 'Hero' }] }; - const variables1 = { first: 0 }; + const data1 = { heroes: [{ name: 'Foo', __typename: 'Hero' }] }; + const variables1 = { first: 0 }; - const data2 = { heroes: [{ name: 'Bar', __typename: 'Hero' }] }; - const variables2 = { first: 1 }; + const data2 = { heroes: [{ name: 'Bar', __typename: 'Hero' }] }; + const variables2 = { first: 1 }; - const link = mockSingleLink( - { - request: { query, variables: variables1 }, - result: { data: data1 }, - }, - { - request: { query, variables: variables2 }, - result: { data: data2 }, - }, - ); + const link = new MockLink([ + { + request: { query, variables: variables1 }, + result: { data: data1 }, + }, + { + request: { query, variables: variables2 }, + result: { data: data2 }, + }, + ]); - const apollo = mockApollo(link, ngZone); - const options = { query, variables: variables1 }; - const obs = apollo.watchQuery(options); + const apollo = mockApollo(link, ngZone); + const options = { query, variables: variables1 }; + const obs = apollo.watchQuery(options); - let calls = 0; + const stream = new ObservableStream(obs.valueChanges); - obs.valueChanges.subscribe({ - next: ({ data }) => { - calls++; + await expect(stream.takeNext()).resolves.toEqual({ + data: undefined, + dataState: 'empty', + loading: true, + networkStatus: NetworkStatus.loading, + partial: true, + }); - try { - if (calls === 1) { - expect(data).toMatchObject(data1); - } else if (calls === 2) { - expect(data).toMatchObject(data2); - done(); - } else if (calls > 2) { - throw new Error('Called third time'); - } - } catch (e: any) { - throw e; - } - }, - error: err => { - throw err; - }, - }); + await expect(stream.takeNext()).resolves.toEqual({ + data: data1, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); - setTimeout(() => { - obs.refetch(variables2).then(({ data }) => { - try { - expect(data).toMatchObject(data2); - } catch (e: any) { - throw e; - } - }); - }); - })); + await expect(stream).not.toEmitAnything(); + + await expect(obs.refetch(variables2)).resolves.toEqual({ data: data2 }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: undefined, + dataState: 'empty', + loading: true, + networkStatus: NetworkStatus.refetch, + partial: true, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: data2, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + + await expect(stream).not.toEmitAnything(); + }); }); describe('query()', () => { @@ -166,7 +171,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -195,13 +200,13 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); const client = apollo.client; - client.query = vi.fn(options => { + client.query = vi.fn((options: { used: boolean }) => { if (options.used) { throw new Error('options was reused'); } @@ -235,7 +240,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -254,52 +259,6 @@ describe('Apollo', () => { }, }); })); - - test('should NOT useInitialLoading by default', () => - new Promise(done => { - expect.assertions(2); - const apollo = testBed.inject(Apollo); - const query = gql` - query heroes { - heroes { - name - __typename - } - } - `; - const data = { - heroes: [ - { - name: 'Superman', - __typename: 'Hero', - }, - ], - }; - - // create - apollo.create({ - link: mockSingleLink({ request: { query }, result: { data } }), - cache: new InMemoryCache(), - }); - - // query - apollo - .query({ - query, - }) - .subscribe({ - next: result => { - expect(result.loading).toBe(false); - expect(result.data).toMatchObject(data); - setTimeout(() => { - return done(); - }, 3000); - }, - error: e => { - throw e; - }, - }); - })); }); describe('mutate()', () => { @@ -309,7 +268,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -353,13 +312,13 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); const client = apollo.client; - client.mutate = vi.fn(options => { + client.mutate = vi.fn((options: { used: boolean }) => { if (options.used) { throw new Error('options was reused'); } @@ -393,7 +352,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -440,7 +399,7 @@ describe('Apollo', () => { }; apollo.create({ - link: mockSingleLink( + link: new MockLink([ { request: op1, result: { data: data1 }, @@ -449,7 +408,7 @@ describe('Apollo', () => { request: op2, result: { data: data2 }, }, - ), + ]), cache: new InMemoryCache(), }); @@ -472,101 +431,79 @@ describe('Apollo', () => { }); })); - test('should NOT useMutationLoading by default', () => - new Promise(done => { - expect.assertions(2); - const apollo = testBed.inject(Apollo); - const query = gql` - mutation addRandomHero { - addRandomHero { - name - __typename - } + test('should NOT useMutationLoading by default', async () => { + const apollo = testBed.inject(Apollo); + const query = gql` + mutation addRandomHero { + addRandomHero { + name + __typename } - `; - const data = { - addRandomHero: { - name: 'Superman', - __typename: 'Hero', - }, - }; + } + `; + const data = { + addRandomHero: { + name: 'Superman', + __typename: 'Hero', + }, + }; - // create - apollo.create({ - link: mockSingleLink({ request: { query }, result: { data } }), - cache: new InMemoryCache(), - }); + apollo.create({ + link: new MockLink([{ request: { query }, result: { data } }]), + cache: new InMemoryCache(), + }); - // mutation - apollo - .mutate({ - mutation: query, - }) - .subscribe({ - next: result => { - expect(result.loading).toBe(false); - expect(result.data).toMatchObject(data); - setTimeout(() => { - return done(); - }, 3000); - }, - error: e => { - throw e; - }, - }); - })); + const stream = new ObservableStream(apollo.mutate({ mutation: query })); - test('should useMutationLoading on demand', () => - new Promise(done => { - expect.assertions(3); - const apollo = testBed.inject(Apollo); - const query = gql` - mutation addRandomHero { - addRandomHero { - name - __typename - } + await expect(stream.takeNext()).resolves.toEqual({ + data, + loading: false, + }); + + await expect(stream).not.toEmitAnything(); + }); + + test('should useMutationLoading on demand', async () => { + const apollo = testBed.inject(Apollo); + const query = gql` + mutation addRandomHero { + addRandomHero { + name + __typename } - `; - const data = { - addRandomHero: { - name: 'Superman', - __typename: 'Hero', - }, - }; + } + `; + const data = { + addRandomHero: { + name: 'Superman', + __typename: 'Hero', + }, + }; - let alreadyCalled = false; + apollo.create({ + link: new MockLink([{ request: { query }, result: { data } }]), + cache: new InMemoryCache(), + }); - // create - apollo.create({ - link: mockSingleLink({ request: { query }, result: { data } }), - cache: new InMemoryCache(), - }); + const stream = new ObservableStream( + apollo.mutate({ + mutation: query, + useMutationLoading: true, + }), + ); - // mutation - apollo - .mutate({ - mutation: query, - useMutationLoading: true, - }) - .subscribe({ - next: result => { - if (alreadyCalled) { - expect(result.loading).toBe(false); - expect(result.data).toMatchObject(data); - setTimeout(() => { - return done(); - }, 3000); - } else { - expect(result.loading).toBe(true); - alreadyCalled = true; - } - }, - error: e => { - throw e; - }, - }); - })); + await expect(stream.takeNext()).resolves.toEqual({ + data: undefined, + loading: true, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data, + loading: false, + }); + + await expect(stream).not.toEmitAnything(); + }); }); describe('subscribe', () => { @@ -576,7 +513,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -609,7 +546,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -628,7 +565,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -637,7 +574,7 @@ describe('Apollo', () => { client.subscribe = vi.fn().mockReturnValue(['subscription']); - const obs = apollo.subscribe(options, { useZone: false }); + const obs = apollo.subscribe({ ...options, useZone: false }); const operator = (obs as any).operator; expect(operator).toBeUndefined(); @@ -649,7 +586,7 @@ describe('Apollo', () => { const apollo = new Apollo(ngZone); apollo.create({ - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); @@ -677,166 +614,197 @@ describe('Apollo', () => { }); describe('query updates', () => { - test('should update a query after mutation', () => - new Promise(done => { - expect.assertions(3); - const query = gql` - query heroes { - allHeroes { - name - __typename - } + test('should update a query after mutation', async () => { + const query = gql` + query heroes { + allHeroes { + name + __typename } - `; - const mutation = gql` - mutation addHero($name: String!) { - addHero(name: $name) { - name - __typename - } + } + `; + const mutation = gql` + mutation addHero($name: String!) { + addHero(name: $name) { + name + __typename } - `; - const variables = { name: 'Bar' }; - // tslint:disable:variable-name - const __typename = 'Hero'; + } + `; + const variables = { name: 'Bar' }; + // tslint:disable:variable-name + const __typename = 'Hero'; - const FooHero = { name: 'Foo', __typename }; - const BarHero = { name: 'Bar', __typename }; + const FooHero = { name: 'Foo', __typename }; + const BarHero = { name: 'Bar', __typename }; - const data1 = { allHeroes: [FooHero] }; - const dataMutation = { addHero: BarHero }; - const data2 = { allHeroes: [FooHero, BarHero] }; + const data1 = { allHeroes: [FooHero] }; + const dataMutation = { addHero: BarHero }; + const data2 = { allHeroes: [FooHero, BarHero] }; - const link = mockSingleLink( - { - request: { query }, - result: { data: data1 }, - }, - { - request: { query: mutation, variables }, - result: { data: dataMutation }, + const link = new MockLink([ + { + request: { query }, + result: { data: data1 }, + }, + { + request: { query: mutation, variables }, + result: { data: dataMutation }, + }, + ]); + const apollo = mockApollo(link, ngZone); + + const obs = apollo.watchQuery({ query }); + const stream = new ObservableStream(obs.valueChanges); + + await expect(stream.takeNext()).resolves.toEqual({ + data: undefined, + dataState: 'empty', + loading: true, + networkStatus: NetworkStatus.loading, + partial: true, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: data1, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + + const mutationStream = new ObservableStream( + apollo.mutate({ + mutation, + variables, + updateQueries: { + heroes: (prev: any, { mutationResult }: any) => { + return { + allHeroes: [...prev.allHeroes, mutationResult.data.addHero], + }; + }, }, - ); - const apollo = mockApollo(link, ngZone); - - const obs = apollo.watchQuery({ query }); - - let calls = 0; - obs.valueChanges.subscribe(({ data }) => { - calls++; - - if (calls === 1) { - expect(data).toMatchObject(data1); - - apollo - .mutate({ - mutation, - variables, - updateQueries: { - heroes: (prev: any, { mutationResult }: any) => { - return { - allHeroes: [...prev.allHeroes, mutationResult.data.addHero], - }; - }, - }, - }) - .subscribe({ - next: result => { - expect(result.data.addHero).toMatchObject(BarHero); - }, - error(error) { - throw error.message; - }, - }); - } else if (calls === 2) { - expect(data).toMatchObject(data2); - done(); - } - }); - })); + }), + ); - test('should update a query with Optimistic Response after mutation', () => - new Promise(done => { - expect.assertions(3); - const query = gql` - query heroes { - allHeroes { - id - name - __typename - } + await expect(mutationStream.takeNext()).resolves.toEqual({ + data: { addHero: BarHero }, + loading: false, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: data2, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + + await expect(stream).not.toEmitAnything(); + }); + + test('should update a query with Optimistic Response after mutation', async () => { + const query = gql` + query heroes { + allHeroes { + id + name + __typename } - `; - const mutation = gql` - mutation addHero($name: String!) { - addHero(name: $name) { - id - name - __typename - } + } + `; + const mutation = gql` + mutation addHero($name: String!) { + addHero(name: $name) { + id + name + __typename } - `; - const variables = { name: 'Bar' }; - const __typename = 'Hero'; + } + `; + const variables = { name: 'Bar' }; + const __typename = 'Hero'; - const FooHero = { id: 1, name: 'Foo', __typename }; - const BarHero = { id: 2, name: 'Bar', __typename }; - const OptimisticHero = { id: null, name: 'Temp', __typename }; + const FooHero = { id: 1, name: 'Foo', __typename }; + const BarHero = { id: 2, name: 'Bar', __typename }; + const OptimisticHero = { id: null, name: 'Temp', __typename }; - const data1 = { allHeroes: [FooHero] }; - const dataMutation = { addHero: BarHero }; - const data2 = { allHeroes: [FooHero, OptimisticHero] }; - const data3 = { allHeroes: [FooHero, BarHero] }; + const data1 = { allHeroes: [FooHero] }; + const dataMutation = { addHero: BarHero }; + const data2 = { allHeroes: [FooHero, OptimisticHero] }; + const data3 = { allHeroes: [FooHero, BarHero] }; - const link = mockSingleLink( - { - request: { query }, - result: { data: data1 }, + const link = new MockLink([ + { + request: { query }, + result: { data: data1 }, + }, + { + request: { query: mutation, variables }, + result: { data: dataMutation }, + }, + ]); + const apollo = mockApollo(link, ngZone); + + const obs = apollo.watchQuery({ query }); + const stream = new ObservableStream(obs.valueChanges); + + await expect(stream.takeNext()).resolves.toEqual({ + data: undefined, + dataState: 'empty', + loading: true, + networkStatus: NetworkStatus.loading, + partial: true, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: data1, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + + apollo + .mutate({ + mutation, + variables, + optimisticResponse: { + addHero: OptimisticHero, + }, + updateQueries: { + heroes: (prev: any, { mutationResult }: any) => { + return { + allHeroes: [...prev.allHeroes, mutationResult.data.addHero], + }; + }, }, - { - request: { query: mutation, variables }, - result: { data: dataMutation }, + }) + .subscribe({ + error(error) { + throw error.message; }, - ); - const apollo = mockApollo(link, ngZone); - - const obs = apollo.watchQuery({ query }); - - let calls = 0; - obs.valueChanges.subscribe(({ data }) => { - calls++; - - if (calls === 1) { - expect(data).toMatchObject(data1); - - apollo - .mutate({ - mutation, - variables, - optimisticResponse: { - addHero: OptimisticHero, - }, - updateQueries: { - heroes: (prev: any, { mutationResult }: any) => { - return { - allHeroes: [...prev.allHeroes, mutationResult.data.addHero], - }; - }, - }, - }) - .subscribe({ - error(error) { - throw error.message; - }, - }); - } else if (calls === 2) { - expect(data).toMatchObject(data2); - } else if (calls === 3) { - expect(data).toMatchObject(data3); - done(); - } }); - })); + + // optimistic response + await expect(stream.takeNext()).resolves.toEqual({ + data: data2, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: data3, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + + await expect(stream).not.toEmitAnything(); + }); }); test('should use HttpClient', () => @@ -864,8 +832,8 @@ describe('Apollo', () => { }; // create - apollo.create({ - link: mockSingleLink({ request: op, result: { data } }), + apollo.create({ + link: new MockLink([{ request: op, result: { data } }]), cache: new InMemoryCache(), }); @@ -881,123 +849,6 @@ describe('Apollo', () => { }); })); - test('should useInitialLoading', () => - new Promise(done => { - expect.assertions(3); - const apollo = testBed.inject(Apollo); - const query = gql` - query heroes { - heroes { - name - __typename - } - } - `; - const data = { - heroes: [ - { - name: 'Superman', - __typename: 'Hero', - }, - ], - }; - - let alreadyCalled = false; - - // create - apollo.create({ - link: mockSingleLink({ request: { query }, result: { data } }), - cache: new InMemoryCache(), - }); - - // query - apollo - .watchQuery({ - query, - useInitialLoading: true, - }) - .valueChanges.subscribe({ - next: result => { - if (alreadyCalled) { - expect(result.data).toMatchObject(data); - setTimeout(() => { - return done(); - }, 3000); - } else { - expect(result.loading).toBe(true); - expect(result.networkStatus).toBe(NetworkStatus.loading); - alreadyCalled = true; - } - }, - error: e => { - throw e; - }, - }); - })); - - test('useInitialLoading should emit false once when data is already available', () => - new Promise(done => { - expect.assertions(4); - const apollo = testBed.inject(Apollo); - const query = gql` - query heroes { - heroes { - name - __typename - } - } - `; - const data = { - heroes: [ - { - name: 'Superman', - __typename: 'Hero', - }, - ], - }; - - let calls = 0; - - const cache = new InMemoryCache(); - - cache.writeQuery({ - query: query, - data, - }); - - // create - apollo.create({ - link: mockSingleLink({ request: { query }, result: { data } }), - cache, - }); - - // query - apollo - .watchQuery({ - query, - notifyOnNetworkStatusChange: true, - useInitialLoading: true, - }) - .valueChanges.subscribe({ - next: result => { - calls++; - - if (calls === 1) { - setTimeout(() => { - expect(calls).toEqual(1); - expect(result.loading).toEqual(false); - expect(result.networkStatus).toEqual(NetworkStatus.ready); - expect(result.data).toEqual(data); - return done(); - }, 3000); - } - }, - error: e => { - throw e; - }, - }); - })); - test('should emit cached result only once', () => new Promise(done => { expect.assertions(3); @@ -1029,8 +880,8 @@ describe('Apollo', () => { }); // create - apollo.create({ - link: mockSingleLink({ request: { query }, result: { data } }), + apollo.create({ + link: new MockLink([{ request: { query }, result: { data } }]), cache, }); @@ -1061,11 +912,11 @@ describe('Apollo', () => { test('should create default client with named options', () => { const apollo = new Apollo(ngZone, undefined, { default: { - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }, test: { - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }, }); @@ -1075,7 +926,7 @@ describe('Apollo', () => { }); test('should remove default client', () => { - const apollo = mockApollo(mockSingleLink(), ngZone); + const apollo = mockApollo(new MockLink([]), ngZone); expect(apollo.client).toBeDefined(); @@ -1085,10 +936,10 @@ describe('Apollo', () => { }); test('should remove named client', () => { - const apollo = mockApollo(mockSingleLink(), ngZone); + const apollo = mockApollo(new MockLink([]), ngZone); apollo.createNamed('test', { - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }); diff --git a/packages/apollo-angular/tests/Mutation.spec.ts b/packages/apollo-angular/tests/Mutation.spec.ts index 76a51ac1c..523396534 100644 --- a/packages/apollo-angular/tests/Mutation.spec.ts +++ b/packages/apollo-angular/tests/Mutation.spec.ts @@ -61,7 +61,7 @@ describe('Mutation', () => { }); test('should pass variables to Apollo.mutate', () => { - addHero.mutate({ foo: 1 }); + addHero.mutate({ variables: { foo: 1 } }); expect(apolloMock.mutate).toBeCalled(); expect(apolloMock.mutate.mock.calls[0][0]).toMatchObject({ @@ -70,7 +70,7 @@ describe('Mutation', () => { }); test('should pass options to Apollo.mutate', () => { - addHero.mutate({}, { fetchPolicy: 'no-cache' }); + addHero.mutate({ fetchPolicy: 'no-cache' }); expect(apolloMock.mutate).toBeCalled(); expect(apolloMock.mutate.mock.calls[0][0]).toMatchObject({ @@ -79,7 +79,7 @@ describe('Mutation', () => { }); test('should not overwrite query when options object is provided', () => { - addHero.mutate({}, { query: 'asd', fetchPolicy: 'cache-first' } as any); + addHero.mutate({ mutation: 'asd', fetchPolicy: 'cache-first' } as any); expect(apolloMock.mutate).toBeCalled(); expect(apolloMock.mutate.mock.calls[0][0]).toMatchObject({ diff --git a/packages/apollo-angular/tests/Query.spec.ts b/packages/apollo-angular/tests/Query.spec.ts index 019a1648a..fd0736237 100644 --- a/packages/apollo-angular/tests/Query.spec.ts +++ b/packages/apollo-angular/tests/Query.spec.ts @@ -84,7 +84,7 @@ describe('Query', () => { }); test('should pass variables to Apollo.watchQuery', () => { - heroesQuery.watch({ foo: 1 }); + heroesQuery.watch({ variables: { foo: 1 } }); expect(apolloMock.watchQuery).toBeCalled(); expect(apolloMock.watchQuery.mock.calls[0][0]).toMatchObject({ @@ -93,7 +93,7 @@ describe('Query', () => { }); test('should pass options to Apollo.watchQuery', () => { - heroesQuery.watch({}, { fetchPolicy: 'network-only' }); + heroesQuery.watch({ fetchPolicy: 'network-only' }); expect(apolloMock.watchQuery).toBeCalled(); expect(apolloMock.watchQuery.mock.calls[0][0]).toMatchObject({ @@ -102,7 +102,7 @@ describe('Query', () => { }); test('should not overwrite query when options object is provided', () => { - heroesQuery.watch({}, { query: 'asd', fetchPolicy: 'cache-first' } as any); + heroesQuery.watch({ query: 'asd', fetchPolicy: 'cache-first' } as any); expect(apolloMock.watchQuery).toBeCalled(); expect(apolloMock.watchQuery.mock.calls[0][0]).toMatchObject({ @@ -133,7 +133,7 @@ describe('Query', () => { }); test('should pass variables to Apollo.query', () => { - heroesQuery.fetch({ foo: 1 }); + heroesQuery.fetch({ variables: { foo: 1 } }); expect(apolloMock.query).toBeCalled(); expect(apolloMock.query.mock.calls[0][0]).toMatchObject({ @@ -142,7 +142,7 @@ describe('Query', () => { }); test('should pass options to Apollo.query', () => { - heroesQuery.fetch({}, { fetchPolicy: 'network-only' }); + heroesQuery.fetch({ fetchPolicy: 'network-only' }); expect(apolloMock.query).toBeCalled(); expect(apolloMock.query.mock.calls[0][0]).toMatchObject({ @@ -151,7 +151,7 @@ describe('Query', () => { }); test('should not overwrite query when options object is provided', () => { - heroesQuery.fetch({}, { query: 'asd', fetchPolicy: 'cache-first' } as any); + heroesQuery.fetch({ query: 'asd', fetchPolicy: 'cache-first' } as any); expect(apolloMock.query).toBeCalled(); expect(apolloMock.query.mock.calls[0][0]).toMatchObject({ diff --git a/packages/apollo-angular/tests/QueryRef.spec.ts b/packages/apollo-angular/tests/QueryRef.spec.ts index b84d47223..a65efd73e 100644 --- a/packages/apollo-angular/tests/QueryRef.spec.ts +++ b/packages/apollo-angular/tests/QueryRef.spec.ts @@ -2,10 +2,17 @@ import { Subject } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; import { beforeEach, describe, expect, test, vi } from 'vitest'; import { NgZone } from '@angular/core'; -import { ApolloClient, ApolloLink, InMemoryCache, ObservableQuery } from '@apollo/client/core'; -import { mockSingleLink } from '@apollo/client/testing'; +import { + ApolloClient, + ApolloLink, + InMemoryCache, + NetworkStatus, + ObservableQuery, +} from '@apollo/client'; +import { MockLink } from '@apollo/client/testing'; import { gql } from '../src/gql'; import { QueryRef } from '../src/query-ref'; +import { ObservableStream } from '../test-utils/ObservableStream'; const createClient = (link: ApolloLink) => new ApolloClient({ @@ -23,7 +30,6 @@ const heroesOperation = { } `, variables: {}, - operationName: 'allHeroes', }; // tslint:disable:variable-name @@ -40,13 +46,13 @@ const Batman = { describe('QueryRef', () => { let ngZone: NgZone; - let client: ApolloClient; + let client: ApolloClient; let obsQuery: ObservableQuery; let queryRef: QueryRef; beforeEach(() => { ngZone = { run: vi.fn(cb => cb()) } as any; - const mockedLink = mockSingleLink( + const mockedLink = new MockLink([ { request: heroesOperation, result: { data: { heroes: [Superman] } }, @@ -55,25 +61,21 @@ describe('QueryRef', () => { request: heroesOperation, result: { data: { heroes: [Superman, Batman] } }, }, - ); + ]); client = createClient(mockedLink); obsQuery = client.watchQuery(heroesOperation); queryRef = new QueryRef(obsQuery, ngZone); }); - test('should listen to changes', () => - new Promise(done => { - queryRef.valueChanges.subscribe({ - next: result => { - expect(result.data).toBeDefined(); - done(); - }, - error: e => { - throw e; - }, - }); - })); + test('should listen to changes', async () => { + const stream = new ObservableStream(queryRef.valueChanges); + + await expect(stream.takeNext()).resolves.toMatchObject({ loading: true }); + + const result = await stream.takeNext(); + expect(result.data).toBeDefined(); + }); test('should be able to call refetch', () => { const mockCallback = vi.fn(); @@ -84,62 +86,59 @@ describe('QueryRef', () => { expect(mockCallback.mock.calls.length).toBe(1); }); - test('should be able refetch and receive new results', () => - new Promise(done => { - let calls = 0; - - queryRef.valueChanges.subscribe({ - next: result => { - calls++; - - expect(result.data).toBeDefined(); - - if (calls === 2) { - done(); - } - }, - error: e => { - throw e; - }, - complete: () => { - throw 'Should not be here'; - }, - }); + test('should be able refetch and receive new results', async () => { + const stream = new ObservableStream(queryRef.valueChanges); + + await expect(stream.takeNext()).resolves.toEqual({ + data: undefined, + dataState: 'empty', + loading: true, + networkStatus: NetworkStatus.loading, + partial: true, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: { heroes: [Superman] }, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); - setTimeout(() => { - queryRef.refetch(); - }, 200); - })); + queryRef.refetch(); - test('should be able refetch and receive new results after using rxjs operator', () => - new Promise(done => { - let calls = 0; - const obs = queryRef.valueChanges; + await expect(stream.takeNext()).resolves.toEqual({ + data: { heroes: [Superman] }, + dataState: 'complete', + loading: true, + networkStatus: NetworkStatus.refetch, + partial: false, + }); + + await expect(stream.takeNext()).resolves.toEqual({ + data: { heroes: [Superman, Batman] }, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + + await expect(stream).not.toEmitAnything(); + }); - obs.pipe(map(result => result.data)).subscribe({ - next: result => { - calls++; + test('should be able refetch and receive new results after using rxjs operator', async () => { + const obs = queryRef.valueChanges.pipe(map(result => result.data)); + const stream = new ObservableStream(obs); - if (calls === 1) { - expect(result.heroes.length).toBe(1); - } else if (calls === 2) { - expect(result.heroes.length).toBe(2); + await expect(stream.takeNext()).resolves.toBeUndefined(); + await expect(stream.takeNext()).resolves.toEqual({ heroes: [Superman] }); - done(); - } - }, - error: e => { - throw e; - }, - complete: () => { - throw 'Should not be here'; - }, - }); + queryRef.refetch(); - setTimeout(() => { - queryRef.refetch(); - }, 200); - })); + await expect(stream.takeNext()).resolves.toEqual({ heroes: [Superman] }); + await expect(stream.takeNext()).resolves.toEqual({ heroes: [Superman, Batman] }); + await expect(stream).not.toEmitAnything(); + }); test('should be able to call updateQuery()', () => { const mockCallback = vi.fn(); @@ -152,72 +151,68 @@ describe('QueryRef', () => { expect(mockCallback.mock.calls[0][0]).toBe(mapFn); }); - test('should be able to call result()', () => { - const mockCallback = vi.fn(); - obsQuery.result = mockCallback.mockReturnValue('expected'); + test('should be able to call getCurrentResult() and get updated results', async () => { + const stream = new ObservableStream(queryRef.valueChanges); - const result = queryRef.result(); + { + const result = await stream.takeNext(); + const currentResult = queryRef.getCurrentResult(); - expect(result).toBe('expected'); - expect(mockCallback.mock.calls.length).toBe(1); - }); - - test('should be able to call getCurrentResult() and get updated results', () => - new Promise(done => { - let calls = 0; - const obs = queryRef.valueChanges; - - obs.pipe(map(result => result.data)).subscribe({ - next: result => { - calls++; - const currentResult = queryRef.getCurrentResult(); - expect(currentResult.data.heroes.length).toBe(result.heroes.length); - - if (calls === 2) { - done(); - } - }, - error: e => { - throw e; - }, - complete: () => { - throw 'Should not be here'; - }, + expect(currentResult).toEqual(result); + expect(currentResult).toEqual({ + data: undefined, + dataState: 'empty', + loading: true, + networkStatus: NetworkStatus.loading, + partial: true, }); + } - setTimeout(() => { - queryRef.refetch(); - }, 200); - })); - - test('should be able to call getLastResult()', () => { - const mockCallback = vi.fn(); - obsQuery.getLastResult = mockCallback.mockReturnValue('expected'); - - const result = queryRef.getLastResult(); - - expect(result).toBe('expected'); - expect(mockCallback.mock.calls.length).toBe(1); - }); - - test('should be able to call getLastError()', () => { - const mockCallback = vi.fn(); - obsQuery.getLastError = mockCallback.mockReturnValue('expected'); - - const result = queryRef.getLastError(); + { + const result = await stream.takeNext(); + const currentResult = queryRef.getCurrentResult(); + + expect(currentResult).toEqual(result); + expect(currentResult).toEqual({ + data: { heroes: [Superman] }, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + } - expect(result).toBe('expected'); - expect(mockCallback.mock.calls.length).toBe(1); - }); + queryRef.refetch(); - test('should be able to call resetLastResults()', () => { - const mockCallback = vi.fn(); - obsQuery.resetLastResults = mockCallback.mockReturnValue('expected'); + { + const result = await stream.takeNext(); + const currentResult = queryRef.getCurrentResult(); + + expect(currentResult).toEqual(result); + expect(currentResult).toEqual({ + data: { heroes: [Superman] }, + dataState: 'complete', + loading: true, + networkStatus: NetworkStatus.refetch, + partial: false, + }); + } - const result = queryRef.resetLastResults(); + { + const result = await stream.takeNext(); + const currentResult = queryRef.getCurrentResult(); + + expect(currentResult).toEqual(result); + expect(currentResult).toEqual({ + data: { heroes: [Superman, Batman] }, + dataState: 'complete', + loading: false, + networkStatus: NetworkStatus.ready, + partial: false, + }); + } - expect(result).toBe('expected'); - expect(mockCallback.mock.calls.length).toBe(1); + await expect(stream).not.toEmitAnything(); }); test('should be able to call fetchMore()', () => { @@ -262,18 +257,6 @@ describe('QueryRef', () => { expect(mockCallback.mock.calls[0][0]).toBe(3000); }); - test('should be able to call setOptions()', () => { - const mockCallback = vi.fn(); - const opts = {}; - obsQuery.setOptions = mockCallback.mockReturnValue('expected'); - - const result = queryRef.setOptions(opts); - - expect(result).toBe('expected'); - expect(mockCallback.mock.calls.length).toBe(1); - expect(mockCallback.mock.calls[0][0]).toBe(opts); - }); - test('should be able to call setVariables()', () => { const mockCallback = vi.fn(); const variables = {}; @@ -300,7 +283,8 @@ describe('QueryRef', () => { next: result => { calls.first++; - expect(result.data).toBeDefined(); + // Initial loading state + expect(result.data).not.toBeDefined(); }, error: e => { throw e; @@ -314,7 +298,8 @@ describe('QueryRef', () => { next: result => { calls.second++; - expect(result.data).toBeDefined(); + // Initial loading state + expect(result.data).not.toBeDefined(); setTimeout(() => { subSecond.unsubscribe(); @@ -346,17 +331,16 @@ describe('QueryRef', () => { test('should unsubscribe', () => new Promise(done => { const obs = queryRef.valueChanges; - const id = queryRef.queryId; const sub = obs.subscribe(() => { // }); - expect(client['queryManager'].queries.get(id)).toBeDefined(); + expect(client.getObservableQueries().size).toBe(1); setTimeout(() => { sub.unsubscribe(); - expect(client['queryManager'].queries.get(id)).toBeUndefined(); + expect(client.getObservableQueries().size).toBe(0); done(); }); })); @@ -365,17 +349,16 @@ describe('QueryRef', () => { new Promise(done => { const gate = new Subject(); const obs = queryRef.valueChanges.pipe(takeUntil(gate)); - const id = queryRef.queryId; obs.subscribe(() => { // }); - expect(client['queryManager'].queries.get(id)).toBeDefined(); + expect(client.getObservableQueries().size).toBe(1); gate.next(); - expect(client['queryManager'].queries.get(id)).toBeUndefined(); + expect(client.getObservableQueries().size).toBe(0); done(); })); }); diff --git a/packages/apollo-angular/tests/Subscription.spec.ts b/packages/apollo-angular/tests/Subscription.spec.ts index 4559b6f44..64903d1f5 100644 --- a/packages/apollo-angular/tests/Subscription.spec.ts +++ b/packages/apollo-angular/tests/Subscription.spec.ts @@ -60,7 +60,7 @@ describe('Subscription', () => { }); test('should pass variables to Apollo.subscribe', () => { - heroes.subscribe({ foo: 1 }); + heroes.subscribe({ variables: { foo: 1 } }); expect(apolloMock.subscribe).toBeCalled(); expect(apolloMock.subscribe.mock.calls[0][0]).toMatchObject({ @@ -69,7 +69,7 @@ describe('Subscription', () => { }); test('should pass options to Apollo.subscribe', () => { - heroes.subscribe({}, { fetchPolicy: 'network-only' }); + heroes.subscribe({ fetchPolicy: 'network-only' }); expect(apolloMock.subscribe).toBeCalled(); expect(apolloMock.subscribe.mock.calls[0][0]).toMatchObject({ @@ -78,7 +78,7 @@ describe('Subscription', () => { }); test('should not overwrite query when options object is provided', () => { - heroes.subscribe({}, { query: 'asd', fetchPolicy: 'cache-first' } as any); + heroes.subscribe({ query: 'asd', fetchPolicy: 'cache-first' } as any); expect(apolloMock.subscribe).toBeCalled(); expect(apolloMock.subscribe.mock.calls[0][0]).toMatchObject({ diff --git a/packages/apollo-angular/tests/integration.spec.ts b/packages/apollo-angular/tests/integration.spec.ts index 88170abe0..b07264c32 100644 --- a/packages/apollo-angular/tests/integration.spec.ts +++ b/packages/apollo-angular/tests/integration.spec.ts @@ -1,8 +1,8 @@ import { beforeEach, describe, expect, test } from 'vitest'; import { provideHttpClient } from '@angular/common/http'; import { TestBed } from '@angular/core/testing'; -import { InMemoryCache } from '@apollo/client/core'; -import { mockSingleLink } from '@apollo/client/testing'; +import { InMemoryCache } from '@apollo/client'; +import { MockLink } from '@apollo/client/testing'; import { Apollo, provideApollo } from '../src'; describe('Integration', () => { @@ -13,7 +13,7 @@ describe('Integration', () => { provideHttpClient(), provideApollo(() => { return { - link: mockSingleLink(), + link: new MockLink([]), cache: new InMemoryCache(), }; }), diff --git a/packages/apollo-angular/tests/test-setup.ts b/packages/apollo-angular/tests/test-setup.ts index b28aa1910..2e2d02241 100644 --- a/packages/apollo-angular/tests/test-setup.ts +++ b/packages/apollo-angular/tests/test-setup.ts @@ -1,4 +1,5 @@ import '@analogjs/vitest-angular/setup-zone'; +import '../test-utils/matchers'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, diff --git a/packages/apollo-angular/tests/vitest.d.ts b/packages/apollo-angular/tests/vitest.d.ts new file mode 100644 index 000000000..de05459d6 --- /dev/null +++ b/packages/apollo-angular/tests/vitest.d.ts @@ -0,0 +1,11 @@ +import 'vitest'; +import type { TakeOptions } from '../test-utils/ObservableStream'; + +interface CustomMatchers { + toEmitAnything: (options?: TakeOptions) => Promise; +} + +declare module 'vitest' { + interface Assertion extends CustomMatchers {} + interface AsymmetricMatchersContaining extends CustomMatchers {} +} diff --git a/packages/apollo-angular/tsconfig.json b/packages/apollo-angular/tsconfig.json index 8bc35a98b..1a56cfd7e 100644 --- a/packages/apollo-angular/tsconfig.json +++ b/packages/apollo-angular/tsconfig.json @@ -14,6 +14,7 @@ "persisted-queries/**/*.ts", "src/**/*.ts", "testing/**/*.ts", - "tests/**/*.ts" + "tests/**/*.ts", + "test-utils/**/*.ts" ] } diff --git a/packages/demo/src/app/app.config.ts b/packages/demo/src/app/app.config.ts index 8dec6e286..03ce48c66 100644 --- a/packages/demo/src/app/app.config.ts +++ b/packages/demo/src/app/app.config.ts @@ -3,7 +3,7 @@ import { HttpLink } from 'apollo-angular/http'; import { provideHttpClient } from '@angular/common/http'; import { ApplicationConfig, inject, provideZoneChangeDetection } from '@angular/core'; import { provideRouter } from '@angular/router'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; import { routes } from './app.routes'; export const appConfig: ApplicationConfig = { diff --git a/packages/demo/src/app/pages/movie/movie-page.component.ts b/packages/demo/src/app/pages/movie/movie-page.component.ts index d95842eab..813a183a9 100644 --- a/packages/demo/src/app/pages/movie/movie-page.component.ts +++ b/packages/demo/src/app/pages/movie/movie-page.component.ts @@ -1,8 +1,8 @@ import { Apollo, gql } from 'apollo-angular'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { filter, map } from 'rxjs/operators'; import { AsyncPipe } from '@angular/common'; -import { Component, OnInit } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { ActivatedRoute, RouterLink } from '@angular/router'; interface Character { @@ -21,6 +21,10 @@ interface Query { film: Film; } +interface Variables { + id: string; +} + @Component({ selector: 'author-page', template: ` @@ -43,21 +47,13 @@ interface Query { }) export class MoviePageComponent implements OnInit { film$!: Observable; - - constructor( - private readonly apollo: Apollo, - private readonly route: ActivatedRoute, - ) {} + private readonly apollo = inject(Apollo); + private readonly route = inject(ActivatedRoute); ngOnInit() { this.film$ = this.apollo - .watchQuery< - Query, - { - id: string; - } - >({ - query: gql` + .watchQuery({ + query: gql` query FilmCharacters($id: ID) { film(id: $id) { title @@ -74,6 +70,9 @@ export class MoviePageComponent implements OnInit { id: this.route.snapshot.paramMap.get('id')!, }, }) - .valueChanges.pipe(map(result => result.data!.film)); + .valueChanges.pipe( + map(result => (result.dataState === 'complete' ? result.data.film : null)), + filter(Boolean), + ); } } diff --git a/packages/demo/src/app/pages/movies/movies-page.component.ts b/packages/demo/src/app/pages/movies/movies-page.component.ts index 532bee1ff..e7e3e3e9d 100644 --- a/packages/demo/src/app/pages/movies/movies-page.component.ts +++ b/packages/demo/src/app/pages/movies/movies-page.component.ts @@ -1,8 +1,8 @@ import { Apollo, gql } from 'apollo-angular'; import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { filter, map } from 'rxjs/operators'; import { AsyncPipe } from '@angular/common'; -import { Component, OnInit } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { RouterLink } from '@angular/router'; interface Film { @@ -16,6 +16,8 @@ interface Query { allFilms: { films: Film[] }; } +type Variables = Record; + @Component({ selector: 'movies-page', template: ` @@ -37,13 +39,12 @@ interface Query { }) export class MoviesPageComponent implements OnInit { films$!: Observable; - - constructor(private readonly apollo: Apollo) {} + private readonly apollo = inject(Apollo); ngOnInit() { this.films$ = this.apollo - .watchQuery({ - query: gql` + .watchQuery({ + query: gql` query AllFilms { allFilms { films { @@ -56,6 +57,9 @@ export class MoviesPageComponent implements OnInit { } `, }) - .valueChanges.pipe(map(result => result.data!.allFilms.films)) as any; + .valueChanges.pipe( + map(result => (result.dataState == 'complete' ? result.data.allFilms.films : null)), + filter(Boolean), + ); } } diff --git a/scripts/prepare-e2e.js b/scripts/prepare-e2e.js index f3ee2c9ff..d5994d1f1 100755 --- a/scripts/prepare-e2e.js +++ b/scripts/prepare-e2e.js @@ -8,12 +8,19 @@ const [, , name, version] = process.argv; function updateComponent() { let filepath = path.join(cwd, `./${name}/src/app/app.component.ts`); + let suffix = 'Component'; + + if (!fs.existsSync(filepath)) { + filepath = path.join(cwd, `./${name}/src/app/app.ts`); + suffix = ''; + } + const code = `import { Apollo } from 'apollo-angular';\n` + `import { versionInfo } from 'graphql';\n` + fs .readFileSync(filepath, 'utf8') - .replace('AppComponent {', 'AppComponent { constructor(private readonly apollo: Apollo) {}') + + .replace(`App${suffix} {`, `App${suffix} { constructor(private readonly apollo: Apollo) {}`) + `\n (window as any).GRAPHQL_VERSION = versionInfo.major;`; fs.writeFileSync(filepath, code, 'utf8'); diff --git a/website/src/pages/docs/caching/advanced-topics.mdx b/website/src/pages/docs/caching/advanced-topics.mdx index 41dc021e5..f781d8c5f 100644 --- a/website/src/pages/docs/caching/advanced-topics.mdx +++ b/website/src/pages/docs/caching/advanced-topics.mdx @@ -314,7 +314,7 @@ a different query, Apollo Client doesn't know that. To tell Apollo Client where existing `book` data, we can define a field policy `read` function for the `book` field: ```ts -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; const cache = new InMemoryCache({ typePolicies: { @@ -383,7 +383,7 @@ write to the cache with a short configurable debounce interval. ```ts import { LocalStorageWrapper, persistCacheSync } from 'apollo3-cache-persist'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; const cache = new InMemoryCache(); diff --git a/website/src/pages/docs/caching/configuration.mdx b/website/src/pages/docs/caching/configuration.mdx index 0da05440e..5caca1672 100644 --- a/website/src/pages/docs/caching/configuration.mdx +++ b/website/src/pages/docs/caching/configuration.mdx @@ -28,7 +28,7 @@ Create an `InMemoryCache` object and provide to Apollo options, like so: import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpLink = inject(HttpLink); @@ -167,7 +167,7 @@ If you need to define a single fallback `keyFields` function that isn't specific `__typename`, you can use the `dataIdFromObject` function that was introduced in Apollo Client 2.x: ```ts -import { defaultDataIdFromObject } from '@apollo/client/core'; +import { defaultDataIdFromObject } from '@apollo/client'; const cache = new InMemoryCache({ dataIdFromObject(responseObject) { diff --git a/website/src/pages/docs/data/mutations.mdx b/website/src/pages/docs/data/mutations.mdx index 1a37c5e72..c477146c6 100644 --- a/website/src/pages/docs/data/mutations.mdx +++ b/website/src/pages/docs/data/mutations.mdx @@ -258,7 +258,7 @@ can enable `useMutationLoading` flag in configuration. import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo( () => { diff --git a/website/src/pages/docs/data/network.mdx b/website/src/pages/docs/data/network.mdx index 4afcf37f1..429bf1520 100644 --- a/website/src/pages/docs/data/network.mdx +++ b/website/src/pages/docs/data/network.mdx @@ -24,7 +24,7 @@ easier testing. import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpLink = inject(HttpLink); @@ -96,7 +96,7 @@ apollo.query({ import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpLink = inject(HttpLink); @@ -128,7 +128,7 @@ import { HttpLink } from 'apollo-angular/http'; import extractFiles from 'extract-files/extractFiles.mjs'; import isExtractableFile from 'extract-files/isExtractableFile.mjs'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpLink = inject(HttpLink); @@ -162,7 +162,7 @@ import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { HttpHeaders } from '@angular/common/http'; import { inject } from '@angular/core'; -import { ApolloLink, InMemoryCache } from '@apollo/client/core'; +import { ApolloLink, InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpLink = inject(HttpLink); @@ -194,7 +194,7 @@ provideApollo(() => { import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; import { onError } from '@apollo/client/link/error'; provideApollo(() => { @@ -226,7 +226,7 @@ An Apollo Link to combine multiple GraphQL operations into single HTTP request. import { provideApollo } from 'apollo-angular'; import { HttpBatchLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpBatchLink = inject(HttpBatchLink); diff --git a/website/src/pages/docs/data/pagination.mdx b/website/src/pages/docs/data/pagination.mdx index 176e0b7f5..251f4cb15 100644 --- a/website/src/pages/docs/data/pagination.mdx +++ b/website/src/pages/docs/data/pagination.mdx @@ -34,7 +34,7 @@ field policy for every relevant list field. This example uses `offsetLimitPagination` to generate a field policy for `Query.posts`: ```typescript -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; import { offsetLimitPagination } from '@apollo/client/utilities'; const cache = new InMemoryCache({ @@ -197,7 +197,7 @@ class FeedComponent { ``` ```ts -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; const cache = new InMemoryCache({ typePolicies: { diff --git a/website/src/pages/docs/data/queries.mdx b/website/src/pages/docs/data/queries.mdx index ae7c044fd..105bd0273 100644 --- a/website/src/pages/docs/data/queries.mdx +++ b/website/src/pages/docs/data/queries.mdx @@ -369,30 +369,31 @@ to render partial results. ## Loading State -Every response you get from `Apollo.watchQuery()` contains `loading` property. By default, it's -always `false` and the first result is emitted with the response from the ApolloLink execution -chain. In order to correct it you can enable `useInitialLoading` flag in configuration. +Every response you get from `Apollo.watchQuery()` contains the `loading` property. The option +[`notifyOnNetworkStatusChange`](https://www.apollographql.com/docs/react/data/queries#queryhookoptions-interface-notifyonnetworkstatuschange) +defaults to `true`. That means the observable will emit immediately and synchronously with +`loading: true` and `data: undefined`. When the XHR is completed, the observable will emit with +`loading: false` and with a defined `result`. + +If you prefer to be notified only when result is available, and you are not interested in loading +state, then you can configure `notifyOnNetworkStatusChange` to `false`, globally when constructing +`ApolloClient` of for a specific query only. Something like this: ```ts filename="app.config.ts" import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; - -provideApollo( - () => { - return { - link: inject(HttpLink).create({ uri: '/graphql' }), - cache: new InMemoryCache(), - }; - }, - { - useInitialLoading: true, // enable it here - }, -); +import { InMemoryCache } from '@apollo/client'; + +provideApollo(() => { + return { + link: inject(HttpLink).create({ uri: '/graphql' }), + cache: new InMemoryCache(), + defaultOptions: { + watchQuery: { + notifyOnNetworkStatusChange: false, + }, + }, + }; +}); ``` - - - `useInitialLoading` is disabled to avoid any breaking changes, this may be enabled in next major - version. - diff --git a/website/src/pages/docs/data/subscriptions.mdx b/website/src/pages/docs/data/subscriptions.mdx index b2204c894..92f2d6999 100644 --- a/website/src/pages/docs/data/subscriptions.mdx +++ b/website/src/pages/docs/data/subscriptions.mdx @@ -105,7 +105,7 @@ import { HttpLink } from 'apollo-angular/http'; import { Kind, OperationTypeNode } from 'graphql'; import { createClient } from 'graphql-ws'; import { inject } from '@angular/core'; -import { InMemoryCache, split } from '@apollo/client/core'; +import { InMemoryCache, split } from '@apollo/client'; import { GraphQLWsLink } from '@apollo/client/link/subscriptions'; import { getMainDefinition } from '@apollo/client/utilities'; @@ -180,7 +180,7 @@ class CommentsComponent { apollo.subscribe({ query: COMMENTS_SUBSCRIPTION, variables: { - repoName: `kamilkisiela/apollo-angular` + repoName: `Ecodev/apollo-angular` }, /* accepts options like `errorPolicy` and `fetchPolicy` diff --git a/website/src/pages/docs/development-and-testing/client-schema-mocking.mdx b/website/src/pages/docs/development-and-testing/client-schema-mocking.mdx index b43290ca3..dd992fe9b 100644 --- a/website/src/pages/docs/development-and-testing/client-schema-mocking.mdx +++ b/website/src/pages/docs/development-and-testing/client-schema-mocking.mdx @@ -30,7 +30,7 @@ data: import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; const typeDefs = gql` extend type Rocket { diff --git a/website/src/pages/docs/development-and-testing/testing.mdx b/website/src/pages/docs/development-and-testing/testing.mdx index 685e40291..d49060021 100644 --- a/website/src/pages/docs/development-and-testing/testing.mdx +++ b/website/src/pages/docs/development-and-testing/testing.mdx @@ -298,7 +298,7 @@ can provide the `APOLLO_TESTING_CACHE` token: ```ts import { APOLLO_TESTING_CACHE, ApolloTestingModule } from 'apollo-angular/testing'; import { TestBed } from '@angular/core/testing'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; beforeEach(() => { TestBed.configureTestingModule({ @@ -322,7 +322,7 @@ And for named clients: ```ts import { APOLLO_TESTING_NAMED_CACHE, ApolloTestingModule } from 'apollo-angular/testing'; import { TestBed } from '@angular/core/testing'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; beforeEach(() => { TestBed.configureTestingModule({ diff --git a/website/src/pages/docs/get-started.mdx b/website/src/pages/docs/get-started.mdx index 78c9358a6..3da9670f2 100644 --- a/website/src/pages/docs/get-started.mdx +++ b/website/src/pages/docs/get-started.mdx @@ -54,7 +54,7 @@ import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { provideHttpClient } from '@angular/common/http'; import { ApplicationConfig, inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; export const appConfig: ApplicationConfig = { providers: [ @@ -76,7 +76,7 @@ Take a closer look what we did there: 1. With `apollo-angular/http` and `HttpLink` service we connect our client to an external GraphQL Server -1. Thanks to `@apollo/client/core` and `InMemoryCache` we have a place to store data in +1. Thanks to `@apollo/client` and `InMemoryCache` we have a place to store data in ## Links and Cache diff --git a/website/src/pages/docs/performance/server-side-rendering.mdx b/website/src/pages/docs/performance/server-side-rendering.mdx index 8a75a494b..ad5dd3499 100644 --- a/website/src/pages/docs/performance/server-side-rendering.mdx +++ b/website/src/pages/docs/performance/server-side-rendering.mdx @@ -28,7 +28,7 @@ import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { provideHttpClient } from '@angular/common/http'; import { ApplicationConfig, inject, InjectionToken } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; const MY_APOLLO_CACHE = new InjectionToken('apollo-cache'); @@ -84,7 +84,7 @@ import { makeStateKey, TransferState, } from '@angular/core'; -import { InMemoryCache, NormalizedCacheObject } from '@apollo/client/core'; +import { InMemoryCache, NormalizedCacheObject } from '@apollo/client'; const MY_APOLLO_CACHE = new InjectionToken('apollo-cache'); const STATE_KEY = makeStateKey('apollo.state'); diff --git a/website/src/pages/docs/recipes/authentication.mdx b/website/src/pages/docs/recipes/authentication.mdx index 3ca48b72b..f5800684a 100644 --- a/website/src/pages/docs/recipes/authentication.mdx +++ b/website/src/pages/docs/recipes/authentication.mdx @@ -24,7 +24,7 @@ backend, it is very easy to tell your network interface to send the cookie along import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpLink = inject(HttpLink); @@ -60,7 +60,7 @@ pull the login token from `localStorage` every time a request is sent. import { provideApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { ApolloLink, InMemoryCache } from '@apollo/client/core'; +import { ApolloLink, InMemoryCache } from '@apollo/client'; import { setContext } from '@apollo/client/link/context'; provideApollo(() => { diff --git a/website/src/pages/docs/recipes/automatic-persisted-queries.mdx b/website/src/pages/docs/recipes/automatic-persisted-queries.mdx index 7dcea5c8e..5ea4a2105 100644 --- a/website/src/pages/docs/recipes/automatic-persisted-queries.mdx +++ b/website/src/pages/docs/recipes/automatic-persisted-queries.mdx @@ -58,7 +58,7 @@ import { HttpLink } from 'apollo-angular/http'; import { createPersistedQueryLink } from 'apollo-angular/persisted-queries'; import { sha256 } from 'crypto-hash'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideApollo(() => { const httpLink = inject(HttpLink); diff --git a/website/src/pages/docs/recipes/multiple-clients.mdx b/website/src/pages/docs/recipes/multiple-clients.mdx index e7a98c890..c0dc8c074 100644 --- a/website/src/pages/docs/recipes/multiple-clients.mdx +++ b/website/src/pages/docs/recipes/multiple-clients.mdx @@ -58,7 +58,7 @@ In our `app.config.ts` file use `provideNamedApollo()` token to configure Apollo import { provideNamedApollo } from 'apollo-angular'; import { HttpLink } from 'apollo-angular/http'; import { inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; provideNamedApollo(() => { const httpLink = inject(HttpLink); diff --git a/website/src/pages/docs/recipes/nativescript.mdx b/website/src/pages/docs/recipes/nativescript.mdx index b77d651ce..9a1f0a9cf 100644 --- a/website/src/pages/docs/recipes/nativescript.mdx +++ b/website/src/pages/docs/recipes/nativescript.mdx @@ -27,7 +27,7 @@ import { HttpLink } from 'apollo-angular/http'; import { NativeScriptHttpClientModule } from 'nativescript-angular/http-client'; import { NativeScriptModule } from 'nativescript-angular/nativescript.module'; import { ApplicationConfig, importProvidersFrom, inject } from '@angular/core'; -import { InMemoryCache } from '@apollo/client/core'; +import { InMemoryCache } from '@apollo/client'; export const appConfig: ApplicationConfig = { providers: [ diff --git a/website/theme.config.tsx b/website/theme.config.tsx index 14a7c5cea..f61f838d2 100644 --- a/website/theme.config.tsx +++ b/website/theme.config.tsx @@ -2,7 +2,7 @@ import { defineConfig, PRODUCTS } from '@theguild/components'; export default defineConfig({ - docsRepositoryBase: 'https://github.com/kamilkisiela/apollo-angular/tree/master/website', + docsRepositoryBase: 'https://github.com/the-guild-org/apollo-angular/tree/master/website', main({ children }) { return <>{children}; }, diff --git a/yarn.lock b/yarn.lock index cfd8f73b8..d653fb408 100644 --- a/yarn.lock +++ b/yarn.lock @@ -264,22 +264,10 @@ dependencies: tslib "^2.3.0" -"@apollo/client@https://pkg.pr.new/@apollo/client@12221": - version "4.0.0-alpha.0" - resolved "https://pkg.pr.new/@apollo/client@12221#d8a470f1993539909177eba396eb583572382185" - dependencies: - "@graphql-typed-document-node/core" "^3.1.1" - "@wry/caches" "^1.0.0" - "@wry/equality" "^0.5.6" - "@wry/trie" "^0.5.0" - graphql-tag "^2.12.6" - optimism "^0.18.0" - rehackt "^0.1.0" - tslib "^2.3.0" - -"@apollo/client@https://pkg.pr.new/@apollo/client@12384": - version "3.13.0" - resolved "https://pkg.pr.new/@apollo/client@12384#8fb6746f15541854a956115c6a8610e3da7858d8" +"@apollo/client@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-4.0.1.tgz#00fe65c518de241126b3664307ccb26bc5314abc" + integrity sha512-qBW2d6++wmNeVkYuCfcw9vQi2kG007wdwdohLc+NXs2Ojz3XPiTb4r9gPTAjwAF9JXN9i7WSQ45fdcN9JAom8Q== dependencies: "@graphql-typed-document-node/core" "^3.1.1" "@wry/caches" "^1.0.0" @@ -287,8 +275,6 @@ "@wry/trie" "^0.5.0" graphql-tag "^2.12.6" optimism "^0.18.0" - rehackt "^0.1.0" - ts-invariant "^0.10.3" tslib "^2.3.0" "@asamuzakjp/css-color@^2.8.2": @@ -2298,6 +2284,108 @@ resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz#0aa5502d547b57abfc4ac492de68e2006e417242" integrity sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ== +"@napi-rs/nice-android-arm-eabi@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-android-arm-eabi/-/nice-android-arm-eabi-1.0.4.tgz#d6b0194f10b1fac2b49d303aeab920651abf10f7" + integrity sha512-OZFMYUkih4g6HCKTjqJHhMUlgvPiDuSLZPbPBWHLjKmFTv74COzRlq/gwHtmEVaR39mJQ6ZyttDl2HNMUbLVoA== + +"@napi-rs/nice-android-arm64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-android-arm64/-/nice-android-arm64-1.0.4.tgz#254ecc462693698ecf597c792d57b6b1b1a9467f" + integrity sha512-k8u7cjeA64vQWXZcRrPbmwjH8K09CBnNaPnI9L1D5N6iMPL3XYQzLcN6WwQonfcqCDv5OCY3IqX89goPTV4KMw== + +"@napi-rs/nice-darwin-arm64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-darwin-arm64/-/nice-darwin-arm64-1.0.4.tgz#7db12e6babb8fae50289ab604401501a7c2c452a" + integrity sha512-GsLdQvUcuVzoyzmtjsThnpaVEizAqH5yPHgnsBmq3JdVoVZHELFo7PuJEdfOH1DOHi2mPwB9sCJEstAYf3XCJA== + +"@napi-rs/nice-darwin-x64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-darwin-x64/-/nice-darwin-x64-1.0.4.tgz#f1f11a045934a4d4a2a22064cd3550fd20d5e2cb" + integrity sha512-1y3gyT3e5zUY5SxRl3QDtJiWVsbkmhtUHIYwdWWIQ3Ia+byd/IHIEpqAxOGW1nhhnIKfTCuxBadHQb+yZASVoA== + +"@napi-rs/nice-freebsd-x64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-freebsd-x64/-/nice-freebsd-x64-1.0.4.tgz#79672daa873cd070d94118f0674d77e24ed65062" + integrity sha512-06oXzESPRdXUuzS8n2hGwhM2HACnDfl3bfUaSqLGImM8TA33pzDXgGL0e3If8CcFWT98aHows5Lk7xnqYNGFeA== + +"@napi-rs/nice-linux-arm-gnueabihf@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm-gnueabihf/-/nice-linux-arm-gnueabihf-1.0.4.tgz#ebd0fe94ecbf1a05be29aa04928eea8f97f57550" + integrity sha512-CgklZ6g8WL4+EgVVkxkEvvsi2DSLf9QIloxWO0fvQyQBp6VguUSX3eHLeRpqwW8cRm2Hv/Q1+PduNk7VK37VZw== + +"@napi-rs/nice-linux-arm64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm64-gnu/-/nice-linux-arm64-gnu-1.0.4.tgz#714d62af0ec354a60b134e8c3bbc018667248b5a" + integrity sha512-wdAJ7lgjhAlsANUCv0zi6msRwq+D4KDgU+GCCHssSxWmAERZa2KZXO0H2xdmoJ/0i03i6YfK/sWaZgUAyuW2oQ== + +"@napi-rs/nice-linux-arm64-musl@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm64-musl/-/nice-linux-arm64-musl-1.0.4.tgz#fa068003a1e18289b7ee9e58dfceb77a0f0b1d08" + integrity sha512-4b1KYG+sriufhFrpUS9uNOEYYJqSfcbnwGx6uGX7JjrH8tELG90cOpCawz5THNIwlS3DhLgnCOcn0+4p6z26QA== + +"@napi-rs/nice-linux-ppc64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-ppc64-gnu/-/nice-linux-ppc64-gnu-1.0.4.tgz#8e4ae1b53c200e6bfe80b31751685e97d4feb368" + integrity sha512-iaf3vMRgr23oe1PUaKpxaH3DS0IMN0+N9iEiWVwYPm/U15vZFYdqVegGfN2PzrZLUl5lc8ZxbmEKDfuqslhAMA== + +"@napi-rs/nice-linux-riscv64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-riscv64-gnu/-/nice-linux-riscv64-gnu-1.0.4.tgz#5de54f35ad57663b0121bcb8705ecc11e7f0bbda" + integrity sha512-UXoREY6Yw6rHrGuTwQgBxpfjK34t6mTjibE9/cXbefL9AuUCJ9gEgwNKZiONuR5QGswChqo9cnthjdKkYyAdDg== + +"@napi-rs/nice-linux-s390x-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-s390x-gnu/-/nice-linux-s390x-gnu-1.0.4.tgz#6fa0fe90d97278ce30f556165bdaaffca8d5bf15" + integrity sha512-eFbgYCRPmsqbYPAlLYU5hYTNbogmIDUvknilehHsFhCH1+0/kN87lP+XaLT0Yeq4V/rpwChSd9vlz4muzFArtw== + +"@napi-rs/nice-linux-x64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-x64-gnu/-/nice-linux-x64-gnu-1.0.4.tgz#2b94c9dc0116c906dbbe0e3509075365e44e1081" + integrity sha512-4T3E6uTCwWT6IPnwuPcWVz3oHxvEp/qbrCxZhsgzwTUBEwu78EGNXGdHfKJQt3soth89MLqZJw+Zzvnhrsg1mQ== + +"@napi-rs/nice-linux-x64-musl@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-x64-musl/-/nice-linux-x64-musl-1.0.4.tgz#5c8a7b1305b154747b47c7f9a69ae25441891179" + integrity sha512-NtbBkAeyBPLvCBkWtwkKXkNSn677eaT0cX3tygq+2qVv71TmHgX4gkX6o9BXjlPzdgPGwrUudavCYPT9tzkEqQ== + +"@napi-rs/nice-win32-arm64-msvc@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-arm64-msvc/-/nice-win32-arm64-msvc-1.0.4.tgz#95e2920ae08b11ae61dbdbc55320013391af01f9" + integrity sha512-vubOe3i+YtSJGEk/++73y+TIxbuVHi+W8ZzrRm2eETCjCRwNlgbfToQZ85dSA+4iBB/NJRGNp+O4hfdbbttZWA== + +"@napi-rs/nice-win32-ia32-msvc@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-ia32-msvc/-/nice-win32-ia32-msvc-1.0.4.tgz#ceed828b2ef32675430c69f110eb49e80d7c0aa7" + integrity sha512-BMOVrUDZeg1RNRKVlh4eyLv5djAAVLiSddfpuuQ47EFjBcklg0NUeKMFKNrKQR4UnSn4HAiACLD7YK7koskwmg== + +"@napi-rs/nice-win32-x64-msvc@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-x64-msvc/-/nice-win32-x64-msvc-1.0.4.tgz#38148eac5fb12244e39dceef6e291d0aa5ba763d" + integrity sha512-kCNk6HcRZquhw/whwh4rHsdPyOSCQCgnVDVik+Y9cuSVTDy3frpiCJTScJqPPS872h4JgZKkr/+CwcwttNEo9Q== + +"@napi-rs/nice@^1.0.1": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice/-/nice-1.0.4.tgz#a5dbd1d4ab1767108f9bbe55e482e03c62845f60" + integrity sha512-Sqih1YARrmMoHlXGgI9JrrgkzxcaaEso0AH+Y7j8NHonUs+xe4iDsgC3IBIDNdzEewbNpccNN6hip+b5vmyRLw== + optionalDependencies: + "@napi-rs/nice-android-arm-eabi" "1.0.4" + "@napi-rs/nice-android-arm64" "1.0.4" + "@napi-rs/nice-darwin-arm64" "1.0.4" + "@napi-rs/nice-darwin-x64" "1.0.4" + "@napi-rs/nice-freebsd-x64" "1.0.4" + "@napi-rs/nice-linux-arm-gnueabihf" "1.0.4" + "@napi-rs/nice-linux-arm64-gnu" "1.0.4" + "@napi-rs/nice-linux-arm64-musl" "1.0.4" + "@napi-rs/nice-linux-ppc64-gnu" "1.0.4" + "@napi-rs/nice-linux-riscv64-gnu" "1.0.4" + "@napi-rs/nice-linux-s390x-gnu" "1.0.4" + "@napi-rs/nice-linux-x64-gnu" "1.0.4" + "@napi-rs/nice-linux-x64-musl" "1.0.4" + "@napi-rs/nice-win32-arm64-msvc" "1.0.4" + "@napi-rs/nice-win32-ia32-msvc" "1.0.4" + "@napi-rs/nice-win32-x64-msvc" "1.0.4" + "@napi-rs/simple-git-android-arm-eabi@0.1.9": version "0.1.9" resolved "https://registry.yarnpkg.com/@napi-rs/simple-git-android-arm-eabi/-/simple-git-android-arm-eabi-0.1.9.tgz#0326fbc4ffafb678bda3474018e2a24a8d2a21b6" @@ -2540,6 +2628,95 @@ proc-log "^4.0.0" which "^4.0.0" +"@parcel/watcher-android-arm64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz#507f836d7e2042f798c7d07ad19c3546f9848ac1" + integrity sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA== + +"@parcel/watcher-darwin-arm64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz#3d26dce38de6590ef79c47ec2c55793c06ad4f67" + integrity sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw== + +"@parcel/watcher-darwin-x64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz#99f3af3869069ccf774e4ddfccf7e64fd2311ef8" + integrity sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg== + +"@parcel/watcher-freebsd-x64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz#14d6857741a9f51dfe51d5b08b7c8afdbc73ad9b" + integrity sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ== + +"@parcel/watcher-linux-arm-glibc@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz#43c3246d6892381db473bb4f663229ad20b609a1" + integrity sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA== + +"@parcel/watcher-linux-arm-musl@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz#663750f7090bb6278d2210de643eb8a3f780d08e" + integrity sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q== + +"@parcel/watcher-linux-arm64-glibc@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz#ba60e1f56977f7e47cd7e31ad65d15fdcbd07e30" + integrity sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w== + +"@parcel/watcher-linux-arm64-musl@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz#f7fbcdff2f04c526f96eac01f97419a6a99855d2" + integrity sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg== + +"@parcel/watcher-linux-x64-glibc@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz#4d2ea0f633eb1917d83d483392ce6181b6a92e4e" + integrity sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A== + +"@parcel/watcher-linux-x64-musl@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz#277b346b05db54f55657301dd77bdf99d63606ee" + integrity sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg== + +"@parcel/watcher-win32-arm64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz#7e9e02a26784d47503de1d10e8eab6cceb524243" + integrity sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw== + +"@parcel/watcher-win32-ia32@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz#2d0f94fa59a873cdc584bf7f6b1dc628ddf976e6" + integrity sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ== + +"@parcel/watcher-win32-x64@2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz#ae52693259664ba6f2228fa61d7ee44b64ea0947" + integrity sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA== + +"@parcel/watcher@^2.4.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.5.1.tgz#342507a9cfaaf172479a882309def1e991fb1200" + integrity sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg== + dependencies: + detect-libc "^1.0.3" + is-glob "^4.0.3" + micromatch "^4.0.5" + node-addon-api "^7.0.0" + optionalDependencies: + "@parcel/watcher-android-arm64" "2.5.1" + "@parcel/watcher-darwin-arm64" "2.5.1" + "@parcel/watcher-darwin-x64" "2.5.1" + "@parcel/watcher-freebsd-x64" "2.5.1" + "@parcel/watcher-linux-arm-glibc" "2.5.1" + "@parcel/watcher-linux-arm-musl" "2.5.1" + "@parcel/watcher-linux-arm64-glibc" "2.5.1" + "@parcel/watcher-linux-arm64-musl" "2.5.1" + "@parcel/watcher-linux-x64-glibc" "2.5.1" + "@parcel/watcher-linux-x64-musl" "2.5.1" + "@parcel/watcher-win32-arm64" "2.5.1" + "@parcel/watcher-win32-ia32" "2.5.1" + "@parcel/watcher-win32-x64" "2.5.1" + "@pkgjs/parseargs@^0.11.0": version "0.11.0" resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" @@ -2562,19 +2739,7 @@ dependencies: "@rollup/pluginutils" "^5.1.0" -"@rollup/plugin-node-resolve@^15.2.3": - version "15.2.3" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz#e5e0b059bd85ca57489492f295ce88c2d4b0daf9" - integrity sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ== - dependencies: - "@rollup/pluginutils" "^5.0.1" - "@types/resolve" "1.20.2" - deepmerge "^4.2.2" - is-builtin-module "^3.2.1" - is-module "^1.0.0" - resolve "^1.22.1" - -"@rollup/pluginutils@^5.0.1", "@rollup/pluginutils@^5.1.0": +"@rollup/pluginutils@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== @@ -2593,6 +2758,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.9.tgz#661a45a4709c70e59e596ec78daa9cb8b8d27604" integrity sha512-qZdlImWXur0CFakn2BJ2znJOdqYZKiedEPEVNTBrpfPjc/YuTGcaYZcdmNFTkUj3DU0ZM/AElcM8Ybww3xVLzA== +"@rollup/rollup-android-arm-eabi@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.44.2.tgz#6819b7f1e41a49af566f629a1556eaeea774d043" + integrity sha512-g0dF8P1e2QYPOj1gu7s/3LVP6kze9A7m6x0BZ9iTdXK8N5c2V7cpBKHV3/9A4Zd8xxavdhK0t4PnqjkqVmUc9Q== + "@rollup/rollup-android-arm64@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz#97255ef6384c5f73f4800c0de91f5f6518e21203" @@ -2603,6 +2773,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.9.tgz#128fe8dd510d880cf98b4cb6c7add326815a0c4b" integrity sha512-4KW7P53h6HtJf5Y608T1ISKvNIYLWRKMvfnG0c44M6In4DQVU58HZFEVhWINDZKp7FZps98G3gxwC1sb0wXUUg== +"@rollup/rollup-android-arm64@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.44.2.tgz#7bd5591af68c64a75be1779e2b20f187878daba9" + integrity sha512-Yt5MKrOosSbSaAK5Y4J+vSiID57sOvpBNBR6K7xAaQvk3MkcNVV0f9fE20T+41WYN8hDn6SGFlFrKudtx4EoxA== + "@rollup/rollup-darwin-arm64@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz#b6dd74e117510dfe94541646067b0545b42ff096" @@ -2613,6 +2788,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.9.tgz#363467bc49fd0b1e17075798ac8e9ad1e1e29535" integrity sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ== +"@rollup/rollup-darwin-arm64@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.44.2.tgz#e216c333e448c67973386e46dbfe8e381aafb055" + integrity sha512-EsnFot9ZieM35YNA26nhbLTJBHD0jTwWpPwmRVDzjylQT6gkar+zenfb8mHxWpRrbn+WytRRjE0WKsfaxBkVUA== + "@rollup/rollup-darwin-x64@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz#e07d76de1cec987673e7f3d48ccb8e106d42c05c" @@ -2623,16 +2803,31 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.9.tgz#c2fe3d85fffe47f0ed0f076b3563ada22c8af19c" integrity sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q== +"@rollup/rollup-darwin-x64@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.44.2.tgz#202f80eea3acfe3f67496fedffa006a5f1ce7f5a" + integrity sha512-dv/t1t1RkCvJdWWxQ2lWOO+b7cMsVw5YFaS04oHpZRWehI1h0fV1gF4wgGCTyQHHjJDfbNpwOi6PXEafRBBezw== + "@rollup/rollup-freebsd-arm64@4.34.9": version "4.34.9" resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.9.tgz#d95bd8f6eaaf829781144fc8bd2d5d71d9f6a9f5" integrity sha512-2lzjQPJbN5UnHm7bHIUKFMulGTQwdvOkouJDpPysJS+QFBGDJqcfh+CxxtG23Ik/9tEvnebQiylYoazFMAgrYw== +"@rollup/rollup-freebsd-arm64@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.44.2.tgz#4880f9769f1a7eec436b9c146e1d714338c26567" + integrity sha512-W4tt4BLorKND4qeHElxDoim0+BsprFTwb+vriVQnFFtT/P6v/xO5I99xvYnVzKWrK6j7Hb0yp3x7V5LUbaeOMg== + "@rollup/rollup-freebsd-x64@4.34.9": version "4.34.9" resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.9.tgz#c3576c6011656e4966ded29f051edec636b44564" integrity sha512-SLl0hi2Ah2H7xQYd6Qaiu01kFPzQ+hqvdYSoOtHYg/zCIFs6t8sV95kaoqjzjFwuYQLtOI0RZre/Ke0nPaQV+g== +"@rollup/rollup-freebsd-x64@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.44.2.tgz#647d6e333349b1c0fb322c2827ba1a53a0f10301" + integrity sha512-tdT1PHopokkuBVyHjvYehnIe20fxibxFCEhQP/96MDSOcyjM/shlTkZZLOufV3qO6/FQOSiJTBebhVc12JyPTA== + "@rollup/rollup-linux-arm-gnueabihf@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz#9f1a6d218b560c9d75185af4b8bb42f9f24736b8" @@ -2643,6 +2838,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.9.tgz#48c87d0dee4f8dc9591a416717f91b4a89d77e3d" integrity sha512-88I+D3TeKItrw+Y/2ud4Tw0+3CxQ2kLgu3QvrogZ0OfkmX/DEppehus7L3TS2Q4lpB+hYyxhkQiYPJ6Mf5/dPg== +"@rollup/rollup-linux-arm-gnueabihf@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.44.2.tgz#7ba5c97a7224f49618861d093c4a7b40fa50867b" + integrity sha512-+xmiDGGaSfIIOXMzkhJ++Oa0Gwvl9oXUeIiwarsdRXSe27HUIvjbSIpPxvnNsRebsNdUo7uAiQVgBD1hVriwSQ== + "@rollup/rollup-linux-arm-musleabihf@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz#53618b92e6ffb642c7b620e6e528446511330549" @@ -2653,6 +2853,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.9.tgz#f4c4e7c03a7767f2e5aa9d0c5cfbf5c0f59f2d41" integrity sha512-3qyfWljSFHi9zH0KgtEPG4cBXHDFhwD8kwg6xLfHQ0IWuH9crp005GfoUUh/6w9/FWGBwEHg3lxK1iHRN1MFlA== +"@rollup/rollup-linux-arm-musleabihf@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.44.2.tgz#f858dcf498299d6c625ec697a5191e0e41423905" + integrity sha512-bDHvhzOfORk3wt8yxIra8N4k/N0MnKInCW5OGZaeDYa/hMrdPaJzo7CSkjKZqX4JFUWjUGm88lI6QJLCM7lDrA== + "@rollup/rollup-linux-arm64-gnu@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz#99a7ba5e719d4f053761a698f7b52291cefba577" @@ -2663,6 +2868,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.9.tgz#1015c9d07a99005025d13b8622b7600029d0b52f" integrity sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw== +"@rollup/rollup-linux-arm64-gnu@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.44.2.tgz#c0f1fc20c50666c61f574536a00cdd486b6aaae1" + integrity sha512-NMsDEsDiYghTbeZWEGnNi4F0hSbGnsuOG+VnNvxkKg0IGDvFh7UVpM/14mnMwxRxUf9AdAVJgHPvKXf6FpMB7A== + "@rollup/rollup-linux-arm64-musl@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz#f53db99a45d9bc00ce94db8a35efa7c3c144a58c" @@ -2673,11 +2883,21 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.9.tgz#8f895eb5577748fc75af21beae32439626e0a14c" integrity sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A== +"@rollup/rollup-linux-arm64-musl@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.44.2.tgz#0214efc3e404ddf108e946ad5f7e4ee2792a155a" + integrity sha512-lb5bxXnxXglVq+7imxykIp5xMq+idehfl+wOgiiix0191av84OqbjUED+PRC5OA8eFJYj5xAGcpAZ0pF2MnW+A== + "@rollup/rollup-linux-loongarch64-gnu@4.34.9": version "4.34.9" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.9.tgz#c9cd5dbbdc6b3ca4dbeeb0337498cf31949004a0" integrity sha512-dRAgTfDsn0TE0HI6cmo13hemKpVHOEyeciGtvlBTkpx/F65kTvShtY/EVyZEIfxFkV5JJTuQ9tP5HGBS0hfxIg== +"@rollup/rollup-linux-loongarch64-gnu@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.44.2.tgz#8303c4ea2ae7bcbb96b2c77cfb53527d964bfceb" + integrity sha512-Yl5Rdpf9pIc4GW1PmkUGHdMtbx0fBLE1//SxDmuf3X0dUC57+zMepow2LK0V21661cjXdTn8hO2tXDdAWAqE5g== + "@rollup/rollup-linux-powerpc64le-gnu@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz#cbb0837408fe081ce3435cf3730e090febafc9bf" @@ -2688,6 +2908,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.9.tgz#7ebb5b4441faa17843a210f7d0583a20c93b40e4" integrity sha512-PHcNOAEhkoMSQtMf+rJofwisZqaU8iQ8EaSps58f5HYll9EAY5BSErCZ8qBDMVbq88h4UxaNPlbrKqfWP8RfJA== +"@rollup/rollup-linux-powerpc64le-gnu@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.44.2.tgz#4197ffbc61809629094c0fccf825e43a40fbc0ca" + integrity sha512-03vUDH+w55s680YYryyr78jsO1RWU9ocRMaeV2vMniJJW/6HhoTBwyyiiTPVHNWLnhsnwcQ0oH3S9JSBEKuyqw== + "@rollup/rollup-linux-riscv64-gnu@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz#8ed09c1d1262ada4c38d791a28ae0fea28b80cc9" @@ -2698,6 +2923,16 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.9.tgz#10f5d7349fbd2fe78f9e36ecc90aab3154435c8d" integrity sha512-Z2i0Uy5G96KBYKjeQFKbbsB54xFOL5/y1P5wNBsbXB8yE+At3oh0DVMjQVzCJRJSfReiB2tX8T6HUFZ2k8iaKg== +"@rollup/rollup-linux-riscv64-gnu@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.44.2.tgz#bcb99c9004c9b91e3704a6a70c892cb0599b1f42" + integrity sha512-iYtAqBg5eEMG4dEfVlkqo05xMOk6y/JXIToRca2bAWuqjrJYJlx/I7+Z+4hSrsWU8GdJDFPL4ktV3dy4yBSrzg== + +"@rollup/rollup-linux-riscv64-musl@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.44.2.tgz#3e943bae9b8b4637c573c1922392beb8a5e81acb" + integrity sha512-e6vEbgaaqz2yEHqtkPXa28fFuBGmUJ0N2dOJK8YUfijejInt9gfCSA7YDdJ4nYlv67JfP3+PSWFX4IVw/xRIPg== + "@rollup/rollup-linux-s390x-gnu@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz#938138d3c8e0c96f022252a28441dcfb17afd7ec" @@ -2708,6 +2943,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.9.tgz#196347d2fa20593ab09d0b7e2589fb69bdf742c6" integrity sha512-U+5SwTMoeYXoDzJX5dhDTxRltSrIax8KWwfaaYcynuJw8mT33W7oOgz0a+AaXtGuvhzTr2tVKh5UO8GVANTxyQ== +"@rollup/rollup-linux-s390x-gnu@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.44.2.tgz#dc43fb467bff9547f5b9937f38668da07fa8fa9f" + integrity sha512-evFOtkmVdY3udE+0QKrV5wBx7bKI0iHz5yEVx5WqDJkxp9YQefy4Mpx3RajIVcM6o7jxTvVd/qpC1IXUhGc1Mw== + "@rollup/rollup-linux-x64-gnu@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz#1a7481137a54740bee1ded4ae5752450f155d942" @@ -2718,6 +2958,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.9.tgz#7193cbd8d128212b8acda37e01b39d9e96259ef8" integrity sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A== +"@rollup/rollup-linux-x64-gnu@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.44.2.tgz#0699c560fa6ce6b846581a7e6c30c85c22a3f0da" + integrity sha512-/bXb0bEsWMyEkIsUL2Yt5nFB5naLAwyOWMEviQfQY1x3l5WsLKgvZf66TM7UTfED6erckUVUJQ/jJ1FSpm3pRQ== + "@rollup/rollup-linux-x64-musl@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz#f1186afc601ac4f4fc25fac4ca15ecbee3a1874d" @@ -2728,6 +2973,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.9.tgz#29a6867278ca0420b891574cfab98ecad70c59d1" integrity sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA== +"@rollup/rollup-linux-x64-musl@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.44.2.tgz#9fb1becedcdc9e227d4748576eb8ba2fad8d2e29" + integrity sha512-3D3OB1vSSBXmkGEZR27uiMRNiwN08/RVAcBKwhUYPaiZ8bcvdeEwWPvbnXvvXHY+A/7xluzcN+kaiOFNiOZwWg== + "@rollup/rollup-win32-arm64-msvc@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz#ed6603e93636a96203c6915be4117245c1bd2daf" @@ -2738,6 +2988,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.9.tgz#89427dcac0c8e3a6d32b13a03a296a275d0de9a9" integrity sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q== +"@rollup/rollup-win32-arm64-msvc@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.44.2.tgz#fcf3e62edd76c560252b819f69627685f65887d7" + integrity sha512-VfU0fsMK+rwdK8mwODqYeM2hDrF2WiHaSmCBrS7gColkQft95/8tphyzv2EupVxn3iE0FI78wzffoULH1G+dkw== + "@rollup/rollup-win32-ia32-msvc@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz#14e0b404b1c25ebe6157a15edb9c46959ba74c54" @@ -2748,6 +3003,11 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.9.tgz#ecb9711ba2b6d2bf6ee51265abe057ab90913deb" integrity sha512-KB48mPtaoHy1AwDNkAJfHXvHp24H0ryZog28spEs0V48l3H1fr4i37tiyHsgKZJnCmvxsbATdZGBpbmxTE3a9w== +"@rollup/rollup-win32-ia32-msvc@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.44.2.tgz#45a5304491d6da4666f6159be4f739d4d43a283f" + integrity sha512-+qMUrkbUurpE6DVRjiJCNGZBGo9xM4Y0FXU5cjgudWqIBWbcLkjE3XprJUsOFgC6xjBClwVa9k6O3A7K3vxb5Q== + "@rollup/rollup-win32-x64-msvc@4.18.0": version "4.18.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz#5d694d345ce36b6ecf657349e03eb87297e68da4" @@ -2758,12 +3018,17 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.9.tgz#1973871850856ae72bc678aeb066ab952330e923" integrity sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw== -"@rollup/wasm-node@^4.18.0": - version "4.18.0" - resolved "https://registry.yarnpkg.com/@rollup/wasm-node/-/wasm-node-4.18.0.tgz#d79efa30475d44d476bdb19a2f1af4623dba8dce" - integrity sha512-DkLoyblRMhJw9ZogW9zCpyH0CNJ+7GaM7Ty+Vl+G21z/Gr7uKBaXqcJqwWUiNYVxTOgxZrxhDG6pmOFxOuswvw== +"@rollup/rollup-win32-x64-msvc@4.44.2": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.44.2.tgz#660018c9696ad4f48abe8c5d56db53c81aadba25" + integrity sha512-3+QZROYfJ25PDcxFF66UEk8jGWigHJeecZILvkPkyQN7oc5BvFo4YEXFkOs154j3FTMp9mn9Ky8RCOwastduEA== + +"@rollup/wasm-node@^4.24.0": + version "4.44.2" + resolved "https://registry.yarnpkg.com/@rollup/wasm-node/-/wasm-node-4.44.2.tgz#6fb5c6c14fbca7efc4c560c895606c7e794eab3c" + integrity sha512-bKl9rKDle9BbO/Tb5RFU4PDYtRcxNdllUL2cC6vixXkxV0U5XOIoi11KUNVoKyB2RLRSk3BHouMfw9fJdMsJkg== dependencies: - "@types/estree" "1.0.5" + "@types/estree" "1.0.8" optionalDependencies: fsevents "~2.3.2" @@ -3023,6 +3288,11 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== +"@types/estree@1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" + integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== + "@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.33": version "4.19.5" resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz#218064e321126fcf9048d1ca25dd2465da55d9c6" @@ -3162,11 +3432,6 @@ "@types/prop-types" "*" csstype "^3.0.2" -"@types/resolve@1.20.2": - version "1.20.2" - resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" - integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== - "@types/retry@0.12.2": version "0.12.2" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a" @@ -3559,7 +3824,7 @@ ajv-keywords@^5.1.0: dependencies: fast-deep-equal "^3.1.3" -ajv@8.13.0, ajv@^8.0.0, ajv@^8.12.0, ajv@^8.9.0: +ajv@8.13.0, ajv@^8.0.0, ajv@^8.9.0: version "8.13.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.13.0.tgz#a3939eaec9fb80d217ddf0c3376948c023f28c91" integrity sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA== @@ -3579,6 +3844,16 @@ ajv@^6.12.4, ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" + integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== + dependencies: + fast-deep-equal "^3.1.3" + fast-uri "^3.0.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + ansi-colors@4.1.3, ansi-colors@^4.1.1, ansi-colors@^4.1.3: version "4.1.3" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" @@ -3882,11 +4157,6 @@ buffer@^5.5.0: base64-js "^1.3.1" ieee754 "^1.1.13" -builtin-modules@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" - integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== - bundle-name@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-4.1.0.tgz#f3b96b34160d6431a19d7688135af7cfb8797889" @@ -4070,6 +4340,13 @@ check-error@^2.1.1: optionalDependencies: fsevents "~2.3.2" +chokidar@^4.0.0, chokidar@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.3.tgz#7be37a4c03c9aee1ecfe862a4a23b2c70c205d30" + integrity sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA== + dependencies: + readdirp "^4.0.1" + chownr@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" @@ -4229,10 +4506,10 @@ commander@9.2.0: resolved "https://registry.yarnpkg.com/commander/-/commander-9.2.0.tgz#6e21014b2ed90d8b7c9647230d8b7a94a4a419a9" integrity sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w== -commander@^12.0.0, commander@~12.1.0: - version "12.1.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" - integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== +commander@^13.0.0: + version "13.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-13.1.0.tgz#776167db68c78f38dcce1f9b8d7b8b9a488abf46" + integrity sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw== commander@^2.20.0: version "2.20.3" @@ -4249,6 +4526,11 @@ commander@^8.3.0: resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== +commander@~12.1.0: + version "12.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" + integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== + common-path-prefix@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" @@ -4894,7 +5176,7 @@ deep-eql@^5.0.1: resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-5.0.2.tgz#4b756d8d770a9257300825d52a2c2cff99c3a341" integrity sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q== -deepmerge@^4.0.0, deepmerge@^4.2.2: +deepmerge@^4.0.0: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== @@ -4987,6 +5269,11 @@ detect-indent@^6.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== +detect-libc@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== + detect-libc@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" @@ -5238,7 +5525,7 @@ esbuild-wasm@0.21.3: resolved "https://registry.yarnpkg.com/esbuild-wasm/-/esbuild-wasm-0.21.3.tgz#d883e270cf6b3b17f9379ef736a0f8da790833fa" integrity sha512-DMOV+eeVra0yVq3XIojfczdEQsz+RiFnpEj7lqs8Gux9mlTpN7yIbw0a4KzLspn0Uhw6UVEH3nUAidSqc/rcQg== -esbuild@0.21.3, esbuild@^0.21.3: +esbuild@0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.21.3.tgz#cbb10b100c768b0cfb35d61d9e70324553437c38" integrity sha512-Kgq0/ZsAPzKrbOjCQcjoSmPoWhlcVnGAUo7jvaLHoxW1Drto0KGkR1xBNg2Cp43b9ImvxmPEJZ9xkfcnqPsfBw== @@ -5599,7 +5886,7 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@3.3.2, fast-glob@^3.2.11, fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0, fast-glob@^3.3.1: +fast-glob@3.3.2, fast-glob@^3.2.11, fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -5626,6 +5913,11 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== +fast-uri@^3.0.1: + version "3.0.6" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.6.tgz#88f130b77cfaea2378d56bf970dea21257a68748" + integrity sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw== + fastq@^1.6.0: version "1.17.1" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" @@ -6470,6 +6762,11 @@ immutable@^4.0.0: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.6.tgz#6a05f7858213238e587fb83586ffa3b4b27f0447" integrity sha512-Ju0+lEMyzMVZarkTn/gqRpdqd5dOPaz1mCZ0SH3JV6iFw81PldE/PEB1hWVEA288HPt4WXW8O7AWxB10M+03QQ== +immutable@^5.0.2: + version "5.1.3" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-5.1.3.tgz#e6486694c8b76c37c063cca92399fa64098634d4" + integrity sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg== + import-fresh@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" @@ -6612,13 +6909,6 @@ is-buffer@^2.0.0: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== -is-builtin-module@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" - integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== - dependencies: - builtin-modules "^3.3.0" - is-core-module@^2.13.0: version "2.14.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.14.0.tgz#43b8ef9f46a6a08888db67b1ffd4ec9e3dfd59d1" @@ -6697,11 +6987,6 @@ is-lambda@^1.0.1: resolved "https://registry.yarnpkg.com/is-lambda/-/is-lambda-1.0.1.tgz#3d9877899e6a53efc0160504cde15f82e6f061d5" integrity sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ== -is-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" - integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g== - is-network-error@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-network-error/-/is-network-error-1.1.0.tgz#d26a760e3770226d11c169052f266a4803d9c997" @@ -6958,11 +7243,16 @@ json5@^2.1.2, json5@^2.2.3: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== -jsonc-parser@3.2.1, jsonc-parser@^3.2.0: +jsonc-parser@3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== +jsonc-parser@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz#f2a524b4f7fd11e3d791e559977ad60b98b798b4" + integrity sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -8506,6 +8796,11 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" +nanoid@^3.3.11: + version "3.3.11" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b" + integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w== + nanoid@^3.3.6, nanoid@^3.3.7: version "3.3.7" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" @@ -8634,35 +8929,33 @@ nextra@3.0.0-alpha.22: zod "^3.22.3" zod-validation-error "^1.5.0" -ng-packagr@^18.0.0: - version "18.0.0" - resolved "https://registry.yarnpkg.com/ng-packagr/-/ng-packagr-18.0.0.tgz#559221e27b353e597dba3feb20ac9978eab8f9b1" - integrity sha512-fIkMk2nOAuhsLGOiCQUVdXpOI2WUdnMX/u8VXMRWVD0i+nLJdcWb1mmRb4TAYgqimy7M47OgQFKQrv/SBMgqGQ== +ng-packagr@^19.0.0: + version "19.2.2" + resolved "https://registry.yarnpkg.com/ng-packagr/-/ng-packagr-19.2.2.tgz#4c7403fff3cd2f0c7ae4089c2dbceabec363ce4a" + integrity sha512-dFuwFsDJMBSd1YtmLLcX5bNNUCQUlRqgf34aXA+79PmkOP+0eF8GP2949wq3+jMjmFTNm80Oo8IUYiSLwklKCQ== dependencies: "@rollup/plugin-json" "^6.1.0" - "@rollup/plugin-node-resolve" "^15.2.3" - "@rollup/wasm-node" "^4.18.0" - ajv "^8.12.0" + "@rollup/wasm-node" "^4.24.0" + ajv "^8.17.1" ansi-colors "^4.1.3" browserslist "^4.22.1" - cacache "^18.0.0" - chokidar "^3.5.3" - commander "^12.0.0" + chokidar "^4.0.1" + commander "^13.0.0" convert-source-map "^2.0.0" dependency-graph "^1.0.0" - esbuild "^0.21.3" - fast-glob "^3.3.1" + esbuild "^0.25.0" + fast-glob "^3.3.2" find-cache-dir "^3.3.2" injection-js "^2.4.0" - jsonc-parser "^3.2.0" + jsonc-parser "^3.3.1" less "^4.2.0" ora "^5.1.0" - piscina "^4.4.0" - postcss "^8.4.31" + piscina "^4.7.0" + postcss "^8.4.47" rxjs "^7.8.1" - sass "^1.69.5" + sass "^1.81.0" optionalDependencies: - rollup "^4.18.0" + rollup "^4.24.0" nice-napi@^1.0.2: version "1.0.2" @@ -8689,6 +8982,11 @@ node-addon-api@^6.1.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-6.1.0.tgz#ac8470034e58e67d0c6f1204a18ae6995d9c0d76" integrity sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA== +node-addon-api@^7.0.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-7.1.1.tgz#1aba6693b0f255258a049d621329329322aad558" + integrity sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ== + node-fetch@^2.5.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -9304,13 +9602,20 @@ pirates@^4.0.1: resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== -piscina@4.5.0, piscina@^4.4.0: +piscina@4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/piscina/-/piscina-4.5.0.tgz#739074b03687958d413b226d358727f648805cb0" integrity sha512-iBaLWI56PFP81cfBSomWTmhOo9W2/yhIOL+Tk8O1vBCpK39cM0tGxB+wgYjG31qq4ohGvysfXSdnj8h7g4rZxA== optionalDependencies: nice-napi "^1.0.2" +piscina@^4.7.0: + version "4.9.2" + resolved "https://registry.yarnpkg.com/piscina/-/piscina-4.9.2.tgz#80f2c2375231720337c703e443941adfac8caf75" + integrity sha512-Fq0FERJWFEUpB4eSY59wSNwXD4RYqR+nR/WiEVcZW8IWfVBxJJafcgTEZDQo8k3w0sUarJ8RyVbbUF4GQ2LGbQ== + optionalDependencies: + "@napi-rs/nice" "^1.0.1" + pkg-dir@^4.1.0, pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" @@ -9625,7 +9930,7 @@ postcss@8.4.31: picocolors "^1.0.0" source-map-js "^1.0.2" -postcss@8.4.38, postcss@^8.2.14, postcss@^8.4.23, postcss@^8.4.31, postcss@^8.4.33, postcss@^8.4.38: +postcss@8.4.38, postcss@^8.2.14, postcss@^8.4.23, postcss@^8.4.33, postcss@^8.4.38: version "8.4.38" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== @@ -9634,6 +9939,15 @@ postcss@8.4.38, postcss@^8.2.14, postcss@^8.4.23, postcss@^8.4.31, postcss@^8.4. picocolors "^1.0.0" source-map-js "^1.2.0" +postcss@^8.4.47: + version "8.5.6" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c" + integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg== + dependencies: + nanoid "^3.3.11" + picocolors "^1.1.1" + source-map-js "^1.2.1" + postcss@^8.5.3: version "8.5.3" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.3.tgz#1463b6f1c7fb16fe258736cba29a2de35237eafb" @@ -9857,6 +10171,11 @@ readable-stream@^3.0.6, readable-stream@^3.4.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readdirp@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.1.2.tgz#eb85801435fbf2a7ee58f19e0921b068fc69948d" + integrity sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg== + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -9929,11 +10248,6 @@ regjsparser@^0.9.1: dependencies: jsesc "~0.5.0" -rehackt@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/rehackt/-/rehackt-0.1.0.tgz#a7c5e289c87345f70da8728a7eb878e5d03c696b" - integrity sha512-7kRDOuLHB87D/JESKxQoRwv4DzbIdwkAGQ7p6QKGdVlY1IZheUnVhlk/4UZlNUVxdAXpyxikE3URsG067ybVzw== - rehype-katex@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/rehype-katex/-/rehype-katex-7.0.0.tgz#f5e9e2825981175a7b0a4d58ed9816c33576dfed" @@ -10111,7 +10425,7 @@ resolve-url-loader@5.0.0: postcss "^8.2.14" source-map "0.6.1" -resolve@1.22.8, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.14.2, resolve@^1.22.1, resolve@^1.22.2: +resolve@1.22.8, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.14.2, resolve@^1.22.2: version "1.22.8" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== @@ -10207,7 +10521,7 @@ robust-predicates@^3.0.0: resolved "https://registry.yarnpkg.com/robust-predicates/-/robust-predicates-3.0.2.tgz#d5b28528c4824d20fc48df1928d41d9efa1ad771" integrity sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg== -rollup@^4.13.0, rollup@^4.18.0: +rollup@^4.13.0: version "4.18.0" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.18.0.tgz#497f60f0c5308e4602cf41136339fbf87d5f5dda" integrity sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg== @@ -10232,6 +10546,35 @@ rollup@^4.13.0, rollup@^4.18.0: "@rollup/rollup-win32-x64-msvc" "4.18.0" fsevents "~2.3.2" +rollup@^4.24.0: + version "4.44.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.44.2.tgz#faedb27cb2aa6742530c39668092eecbaf78c488" + integrity sha512-PVoapzTwSEcelaWGth3uR66u7ZRo6qhPHc0f2uRO9fX6XDVNrIiGYS0Pj9+R8yIIYSD/mCx2b16Ws9itljKSPg== + dependencies: + "@types/estree" "1.0.8" + optionalDependencies: + "@rollup/rollup-android-arm-eabi" "4.44.2" + "@rollup/rollup-android-arm64" "4.44.2" + "@rollup/rollup-darwin-arm64" "4.44.2" + "@rollup/rollup-darwin-x64" "4.44.2" + "@rollup/rollup-freebsd-arm64" "4.44.2" + "@rollup/rollup-freebsd-x64" "4.44.2" + "@rollup/rollup-linux-arm-gnueabihf" "4.44.2" + "@rollup/rollup-linux-arm-musleabihf" "4.44.2" + "@rollup/rollup-linux-arm64-gnu" "4.44.2" + "@rollup/rollup-linux-arm64-musl" "4.44.2" + "@rollup/rollup-linux-loongarch64-gnu" "4.44.2" + "@rollup/rollup-linux-powerpc64le-gnu" "4.44.2" + "@rollup/rollup-linux-riscv64-gnu" "4.44.2" + "@rollup/rollup-linux-riscv64-musl" "4.44.2" + "@rollup/rollup-linux-s390x-gnu" "4.44.2" + "@rollup/rollup-linux-x64-gnu" "4.44.2" + "@rollup/rollup-linux-x64-musl" "4.44.2" + "@rollup/rollup-win32-arm64-msvc" "4.44.2" + "@rollup/rollup-win32-ia32-msvc" "4.44.2" + "@rollup/rollup-win32-x64-msvc" "4.44.2" + fsevents "~2.3.2" + rollup@^4.30.1: version "4.34.9" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.34.9.tgz#e1eb397856476778aeb6ac2ac3d09b2ce177a558" @@ -10323,7 +10666,7 @@ sass-loader@14.2.1: dependencies: neo-async "^2.6.2" -sass@1.77.2, sass@^1.69.5: +sass@1.77.2: version "1.77.2" resolved "https://registry.yarnpkg.com/sass/-/sass-1.77.2.tgz#18d4ed2eefc260cdc8099c5439ec1303fd5863aa" integrity sha512-eb4GZt1C3avsX3heBNlrc7I09nyT00IUuo4eFhAbeXWU2fvA7oXI53SxODVAA+zgZCk9aunAZgO+losjR3fAwA== @@ -10332,6 +10675,17 @@ sass@1.77.2, sass@^1.69.5: immutable "^4.0.0" source-map-js ">=0.6.2 <2.0.0" +sass@^1.81.0: + version "1.89.2" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.89.2.tgz#a771716aeae774e2b529f72c0ff2dfd46c9de10e" + integrity sha512-xCmtksBKd/jdJ9Bt9p7nPKiuqrlBMBuuGkQlkhZjjQk3Ty48lv93k5Dq6OPkKt4XwxDJ7tvlfrTa1MPA9bf+QA== + dependencies: + chokidar "^4.0.0" + immutable "^5.0.2" + source-map-js ">=0.6.2 <2.0.0" + optionalDependencies: + "@parcel/watcher" "^2.4.1" + sax@^1.2.4: version "1.4.1" resolved "https://registry.yarnpkg.com/sax/-/sax-1.4.1.tgz#44cc8988377f126304d3b3fc1010c733b929ef0f" @@ -11239,13 +11593,6 @@ ts-interface-checker@^0.1.9: resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== -ts-invariant@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" - integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ== - dependencies: - tslib "^2.1.0" - ts-morph@^21.0.0: version "21.0.1" resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-21.0.1.tgz#712302a0f6e9dbf1aa8d9cf33a4386c4b18c2006"