# Change Log

## 4.5.0

### Minor Changes

- a6a08f0: Run `withAuth` and `authScopes` checks sequentially instead of letting the field's `authScopes` overwrite the scopes from `withAuth`. Fields that use both now require both checks to pass, and chained `withAuth` calls all run. Upgrade `@pothos/core`, `@pothos/plugin-prisma`, `@pothos/plugin-prisma-next` and `@pothos/plugin-drizzle` at the same time.

## 4.4.0

### Minor Changes

- 4cbaa37: Pass type `authScopes` and `grantScopes` functions an `info` object with `parentType` (the object type being checked) and `schema`. Interface scopes, such as a policy on the Relay `Node` interface, can now apply different rules to each implementing type.

## 4.3.0

### Minor Changes

- 21241c7: Scope and grant checks that read the parent can see the full parent row when a plugin such as `@pothos/plugin-prisma` or `@pothos/plugin-drizzle` supplies it, instead of only what the parent field returned. Resolvers still get the original parent.

## 4.2.2

### Patch Changes

- 13ac232: Isolate authorization caches by schema builder when multiple schemas share a request context.
- 9f234e9: Consume pending scope-loader rejections when another loader throws synchronously, including nested scope maps, while preserving the synchronous authorization error.

## 4.2.1

### Patch Changes

- 477c1ef: Cache the names returned by a type grant function, then install those grants at every response path where the object appears. Reusing an object across aliases or list positions no longer denies fields after the first occurrence.
- f86b430: When the same object appears under granted and ungranted response paths, cache the type authorization function result and evaluate its grant requirements at each path. This prevents a granted sibling from authorizing an ungranted sibling while preserving one function invocation per object.

## 4.2.0

### Minor Changes

- 442a029: Cache scope-map results separately for `$any` and `$all`, so shared maps are evaluated with the
  correct strategy regardless of field order.

  With the `all` default strategy, a top-level `$any` now narrows auth contexts to a union rather
  than an intersection. Resolvers that relied on context available in only another branch may no
  longer compile; runtime authorization is unchanged. A `$any` nested in `$all` still uses an
  intersection.

  Apply implementing-object policies to inherited interface fields, alongside the declaring
  interface's policy. Fields without authorization checks or grants keep their default resolver.

  **Inherited fields can newly deny access** when the object's `authScopes` or another implemented
  interface's `authScopes` denies. The same policy applies when querying through an interface.
  `runScopesOnType` on an object or globally retains its behavior. An interface's `runScopesOnType`
  no longer lets inherited fields bypass that interface's policy; the object's interface checks
  now enforce it.

  `skipTypeScopes` on an inherited field skips the declaring interface's and object's own checks.
  `skipInterfaceScopes` on the field or object skips interface checks, including the declaring
  interface, while retaining the object's own check. Deliberately skipped checks are not reintroduced
  through another inheritance path. Grants remain independent of these skip flags.

  Two changes can newly authorize fields: the object's `grantScopes` now reach inherited fields,
  and `skipInterfaceScopes` can suppress the declaring interface's check. Declaring-interface grants
  continue to run when its authorization check is skipped.

## 4.1.7

### Patch Changes

- 76e06e7: Rebuild with TypeScript 7. Source files now use explicit `.js` import extensions (enforced by
  lint) instead of adding them during the build, and declaration files are emitted by TypeScript
  7's compiler. Published output is functionally unchanged.

## 4.1.6

### Patch Changes

- 3403c66: update dependencies

## 4.1.5

### Patch Changes

- 1622740: update dependencies

## 4.1.4

### Patch Changes

- 54555ed: Fix t.authField when used with authScopes returned from a function

## 4.1.3

### Patch Changes

- cd7f309: Update dependencies

## 4.1.2

### Patch Changes

- c2c504b: Fix parent type on on withAuth fields

## 4.1.1

### Patch Changes

- 174c7b0: Bind `authScopes` loaders to returned provider

## 4.1.0

### Minor Changes

- 27af377: replace eslint and prettier with biome

## 4.0.2

### Patch Changes

- Updated dependencies [777f6de]
  - @pothos/core@4.0.2

## 4.0.1

### Patch Changes

- 9bd203e: Fix graphql peer dependency version to match documented minumum version
- Updated dependencies [9bd203e]
  - @pothos/core@4.0.1

## 4.0.0

### Major Changes

- 29841a8: Release Pothos v4 🎉 see https://pothos-graphql.dev/docs/migrations/v4 for more details

### Patch Changes

- c1e6dcb: update readmes
- Updated dependencies [c1e6dcb]
- Updated dependencies [29841a8]
  - @pothos/core@4.0.0

## 4.0.0-next.1

### Patch Changes

- update readmes
- Updated dependencies
  - @pothos/core@4.0.0-next.1

## 4.0.0-next.0

### Major Changes

- 29841a8: Release Pothos v4 🎉 see https://pothos-graphql.dev/docs/migrations/v4 for more details

### Patch Changes

- Updated dependencies [29841a8]
  - @pothos/core@4.0.0-next.0

## 3.22.1

### Patch Changes

- 1ecea46: revert accidental pinning of graphql peer dependency

## 3.22.0

### Minor Changes

- c78380d: [auth] Allow clearing/resetting scope cache in the middle of a request

## 3.21.1

### Patch Changes

- 8019b47: Fix type issue when inferring SchemaTypes when DefaultAuthStrategy isn't defined

## 3.21.0

### Minor Changes

- 22d4118: Add DefaultAuthStrategy to SchemaTypes to allow improve types when defaultStrategy is set
  to all

## 3.20.0

### Minor Changes

- 09bd29a6: Add new defaultStrategy option to allow enforcing all scopes in a scopeMap without using
  `$all`

## 3.19.2

### Patch Changes

- ce43b442: Fix issue where 2nd argument of authScopes on types would actually be the info object
  when `treatErrorsAsUnauthorized` was enabled

## 3.19.1

### Patch Changes

- 4c6bc638: Add provinance to npm releases

## 3.19.0

### Minor Changes

- 1878d5d9: Allow readonly arrays in more places

## 3.18.0

### Minor Changes

- bf0385ae: Add new PothosError classes

## 3.17.0

### Minor Changes

- 85687927: Added support for running authScopes when a subscroption is created rather than when
  subscription values are resolved

## 3.16.0

### Minor Changes

- d4d41796: Add new `treatErrorsAsUnauthorized` option for better handling of thrown errors

### Patch Changes

- d4d41796: Update dev dependencies

## 3.15.2

### Patch Changes

- 6f00194c: Fix an issue with esm import transform

## 3.15.1

### Patch Changes

- b12f9122: Fix issue with esm build script

## 3.15.0

### Minor Changes

- d350f842: Support functions and $any and $all in authField and withAuth methods

### Patch Changes

- d350f842: update dev deps

## 3.14.4

### Patch Changes

- 9fa27cf7: Transform dynamic type imports in d.ts files

## 3.14.3

### Patch Changes

- 3a82d645: Apply esm transform to esm d.ts definitions

## 3.14.2

### Patch Changes

- 218fc68b: Fix script for copying ems d.ts definitions

## 3.14.1

### Patch Changes

- 67531f1e: Create separate typescript definitions for esm files

## 3.14.0

### Minor Changes

- 11929311: Update type definitions to work with module: "nodeNext"

## 3.13.1

### Patch Changes

- aa18acb7: update dev dependencies

## 3.13.0

### Minor Changes

- d67764b5: Make options objecst on toSchema, queryType, and mutationType optional

## 3.12.0

### Minor Changes

- 50a60d92: Support prisma filtered relations counts

### Patch Changes

- e297e78a: Support typescript@4.8

## 3.11.2

### Patch Changes

- c102f522: Fix withAuth on prismaObject fields builders

## 3.11.1

### Patch Changes

- 3ead60ae: update dev deps

## 3.11.0

### Minor Changes

- 3a7ff291: Refactor internal imports to remove import cycles

### Patch Changes

- 3a7ff291: Update dev dependencies

## 3.10.0

### Minor Changes

- 7311904e: Add withAuth method to return a field builder to allow custom auth context with other
  plugin methods

### Patch Changes

- 7311904e: Update dev deps

## 3.9.1

### Patch Changes

- 4e5756ca: Update dev dependencies

## 3.9.0

### Minor Changes

- ecb2714c: Add types entry to export map in package.json and update dev dependencies

  This should fix compatibility with typescripts new `"moduleResolution": "node12"`

## 3.8.1

### Patch Changes

- 205a8c73: Fix issue with string refs used as interfaces
- 205a8c73: Recactor internal imports to reduce imports from index files

## 3.8.0

### Minor Changes

- ce1063e3: Add new tracinig packages

## 3.7.0

### Minor Changes

- a8e31a70: Improve user experience when srtict mode is disabled

## 3.6.0

### Minor Changes

- 241a385f: Add peer dependency on @pothos/core

## 3.5.0

### Minor Changes

- 6279235f: Update build process to use swc and move type definitions to dts directory

### Patch Changes

- 21a2454e: update dev dependencies

## 3.4.2

### Patch Changes

- cf4a2d14: cleanup style and comments

## 3.4.1

### Patch Changes

- e7d18c41: make error formatter optional for runAuthScopes

## 3.4.0

### Minor Changes

- 6b441da8: Allow running scopemaps directly

## 3.3.1

### Patch Changes

- 03aecf76: update .npmignore

## 3.3.0

### Minor Changes

- 5ade1c8c: Add runScopesOnType option for better type level auth checks
- 43ca3031: Add skipInterfaceScopes option on Object types
- 4ad5f4ff: Add cacheKey option
- 4ad5f4ff: Normalize resolveType and isTypeOf behavior to match graphql spec behavior and allow
  both to be optional

### Patch Changes

- 43ca3031: Update dev dependencies

## 3.2.0

### Minor Changes

- c959d459: Remove args option from global unauthorizedError callback

## 3.1.0

### Minor Changes

- 4234ab3e: Allow Error customization

## 3.0.2

### Patch Changes

- 089af750: Export ForbiddenError for re-use

## 3.0.1

### Patch Changes

- 2d9b21cd: Use workspace:\* for dev dependencies on pothos packages

## 3.0.0

### Major Changes

- 4caad5e4: Rename GiraphQL to Pothos

## 2.15.0

### Minor Changes

- a7c34fe1: Add an unauthorizedResolver option to the scope-auth plugin

## 2.14.0

### Minor Changes

- 9307635a: Migrate build process to use turborepo

## 2.13.3

### Patch Changes

- 2b08f852: Fix syntax highlighting in docs and update npm README.md files"

## 2.13.2

### Patch Changes

- c6aa732: graphql@15 type compatibility fix

## 2.13.1

### Patch Changes

- c85dc33: Add types entry in package.json

## 2.13.0

### Minor Changes

- aeef5e5: Update dependencies

## 2.12.0

### Minor Changes

- 9107f29: Update dependencies (includes graphql 16)

## 2.11.0

### Minor Changes

- 17db3bd: Make type refs extendable by plugins

## 2.10.2

### Patch Changes

- c976bfe: Update dependencies

## 2.10.1

### Patch Changes

- 4150f92: Fixed esm transformer for path-imports from dependencies

## 2.10.0

### Minor Changes

- dc87e68: update esm build process so extensions are added during build rather than in source

## 2.9.1

### Patch Changes

- b4b8381: Updrade deps (typescript 4.4)

## 2.9.0

### Minor Changes

- a4c87cf: Use ".js" extensions everywhere and add module and exports to package.json to better
  support ems in node

## 2.8.2

### Patch Changes

- f13208c: bump to fix latest tag

## 2.8.1

### Patch Changes

- 9ab8fbc: re-release previous version due to build-process issue

## 2.8.0

### Minor Changes

- 3dd3ff14: Updated dev dependencies, switched to pnpm, and added changesets for releases

All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

### 2.7.1 - 2021-08-03

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.7.1-alpha.0 - 2021-08-02

**Note:** Version bump only for package @giraphql/plugin-scope-auth

## 2.7.0 - 2021-07-30

#### 🚀 Updates

- add prisma plugin ([d427c82](https://github.com/hayes/giraphql/commit/d427c82))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.6.0 - 2021-07-23

**Note:** Version bump only for package @giraphql/plugin-scope-auth

## 2.6.0-alpha.0 - 2021-07-17

#### 🚀 Updates

- add authField method ([9e3dc07](https://github.com/hayes/giraphql/commit/9e3dc07))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.5.1 - 2021-07-10

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.5.0 - 2021-07-04

**Note:** Version bump only for package @giraphql/plugin-scope-auth

## 2.5.0-alpha.0 - 2021-07-04

#### 🚀 Updates

- add early warning for undefined refs to simplify debugging of circular import issues
  ([095b68b](https://github.com/hayes/giraphql/commit/095b68b))

#### 📦 Dependencies

- upgrade typescript ([675f6a2](https://github.com/hayes/giraphql/commit/675f6a2))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.4.1 - 2021-07-02

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.4.0 - 2021-06-28

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.4.0-alpha.1 - 2021-06-28

**Note:** Version bump only for package @giraphql/plugin-scope-auth

## 2.4.0-alpha.0 - 2021-06-28

#### 🚀 Updates

- add errors plugin ([88509b4](https://github.com/hayes/giraphql/commit/88509b4))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

## 2.3.0 - 2021-06-11

#### 🚀 Updates

- make field options args optional when empty
  ([ae71648](https://github.com/hayes/giraphql/commit/ae71648))

#### 📦 Dependencies

- update dev deps ([813d9d0](https://github.com/hayes/giraphql/commit/813d9d0))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.2.6 - 2021-06-10

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.2.6-alpha.0 - 2021-06-09

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.2.5 - 2021-05-18

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.2.4 - 2021-05-13

#### 📘 Docs

- add docs for loadableNode ([1ae01e8](https://github.com/hayes/giraphql/commit/1ae01e8))

#### 🛠 Internals

- add tests for loadableNode ([c1b49a0](https://github.com/hayes/giraphql/commit/c1b49a0))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.2.3 - 2021-05-12

#### 🛠 Internals

- udate dev deps ([3251227](https://github.com/hayes/giraphql/commit/3251227))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.2.2 - 2021-05-10

#### 🐞 Fixes

- update ci build command ([7e1d1d2](https://github.com/hayes/giraphql/commit/7e1d1d2))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.2.1 - 2021-05-10

#### 🐞 Fixes

- force new version to fix esm build issue
  ([25f1fd2](https://github.com/hayes/giraphql/commit/25f1fd2))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

## 2.2.0 - 2021-05-10

#### 🚀 Updates

- add esm build for all packages ([d8bbdc9](https://github.com/hayes/giraphql/commit/d8bbdc9))

#### 📘 Docs

- update readmes ([07c727b](https://github.com/hayes/giraphql/commit/07c727b))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.1.0 - 2021-05-05

**Note:** Version bump only for package @giraphql/plugin-scope-auth

## 2.1.0-alpha.0 - 2021-05-05

#### 🚀 Updates

- add script for generating deno compatible files
  ([6dc68c1](https://github.com/hayes/giraphql/commit/6dc68c1))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.0.4 - 2021-05-02

#### 🛠 Internals

- force version bumps and update validation to 2.0 range
  ([07730b3](https://github.com/hayes/giraphql/commit/07730b3))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.0.3 - 2021-05-02

#### 🛠 Internals

- migrate to @beemo/dev for dev tool configs
  ([1da1283](https://github.com/hayes/giraphql/commit/1da1283))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.0.2 - 2021-04-16

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.0.2-alpha.0 - 2021-04-12

#### 📦 Dependencies

- update dev dependencies ([25a15d4](https://github.com/hayes/giraphql/commit/25a15d4))
- update dev deps ([cbfa0a4](https://github.com/hayes/giraphql/commit/cbfa0a4))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

### 2.0.1 - 2021-02-19

**Note:** Version bump only for package @giraphql/plugin-scope-auth

# 2.0.0 - 2021-02-16

#### 💥 Breaking

- update plugin API to avoid modifying args. subGraphs are now build by passing subGraph to toSchema
  ([66d456e](https://github.com/hayes/giraphql/commit/66d456e))
- update plugin exports and names to be more consistent
  ([ee07b35](https://github.com/hayes/giraphql/commit/ee07b35))

#### 📦 Dependencies

- update dependencies and add license files
  ([cb0d102](https://github.com/hayes/giraphql/commit/cb0d102))

#### 📘 Docs

- add more docs o writing plugins ([b996fc6](https://github.com/hayes/giraphql/commit/b996fc6))
- wip - plugin guide ([cf9c6ec](https://github.com/hayes/giraphql/commit/cf9c6ec))

**Note:** Version bump only for package @giraphql/plugin-scope-auth

# 2.0.0-alpha.0 - 2021-02-10

#### 💥 Breaking

- you can no-longer define args on 'exposed' fields
  ([240162b](https://github.com/hayes/giraphql/commit/240162b))

#### 🚀 Updates

- add option to disable scope auth during build
  ([c4f6bee](https://github.com/hayes/giraphql/commit/c4f6bee))
- add support for scopes ([0b10ffd](https://github.com/hayes/giraphql/commit/0b10ffd))
- add support for authScope checks on interfaces
  ([fa6fe1e](https://github.com/hayes/giraphql/commit/fa6fe1e))
- add support for skipping type/interface scopes on specific fields
  ([34c95e3](https://github.com/hayes/giraphql/commit/34c95e3))

#### 🐞 Fixes

- bump auth plugin to 2.0 ([2bbb142](https://github.com/hayes/giraphql/commit/2bbb142))

#### 📘 Docs

- add initial docs for scope auth plugin
  ([15b086d](https://github.com/hayes/giraphql/commit/15b086d))

#### 🛠 Internals

- add some basic scope-auth tests ([7ceb24a](https://github.com/hayes/giraphql/commit/7ceb24a))
- add some caching tests ([0a08760](https://github.com/hayes/giraphql/commit/0a08760))
- add tests for authScope functions on fields
  ([324eb2f](https://github.com/hayes/giraphql/commit/324eb2f))
- add tests for authScope functions on types
  ([aed363a](https://github.com/hayes/giraphql/commit/aed363a))
- add tests for type authScopes ([951a6cd](https://github.com/hayes/giraphql/commit/951a6cd))

**Note:** Version bump only for package @giraphql/plugin-scope-auth
