@urql/exchange-populate
Advanced tools
Comparing version 1.1.0 to 1.1.1
# @urql/exchange-populate | ||
## 1.1.1 | ||
### Patch Changes | ||
- Upgrade to `wonka@^6.3.0` | ||
Submitted by [@kitten](https://github.com/kitten) (See [#3104](https://github.com/urql-graphql/urql/pull/3104)) | ||
- Add TSDocs for all exchanges, documenting API internals | ||
Submitted by [@kitten](https://github.com/kitten) (See [#3072](https://github.com/urql-graphql/urql/pull/3072)) | ||
- Updated dependencies (See [#3101](https://github.com/urql-graphql/urql/pull/3101), [#3033](https://github.com/urql-graphql/urql/pull/3033), [#3054](https://github.com/urql-graphql/urql/pull/3054), [#3053](https://github.com/urql-graphql/urql/pull/3053), [#3060](https://github.com/urql-graphql/urql/pull/3060), [#3081](https://github.com/urql-graphql/urql/pull/3081), [#3039](https://github.com/urql-graphql/urql/pull/3039), [#3104](https://github.com/urql-graphql/urql/pull/3104), [#3082](https://github.com/urql-graphql/urql/pull/3082), [#3097](https://github.com/urql-graphql/urql/pull/3097), [#3061](https://github.com/urql-graphql/urql/pull/3061), [#3055](https://github.com/urql-graphql/urql/pull/3055), [#3085](https://github.com/urql-graphql/urql/pull/3085), [#3079](https://github.com/urql-graphql/urql/pull/3079), [#3087](https://github.com/urql-graphql/urql/pull/3087), [#3059](https://github.com/urql-graphql/urql/pull/3059), [#3055](https://github.com/urql-graphql/urql/pull/3055), [#3057](https://github.com/urql-graphql/urql/pull/3057), [#3050](https://github.com/urql-graphql/urql/pull/3050), [#3062](https://github.com/urql-graphql/urql/pull/3062), [#3051](https://github.com/urql-graphql/urql/pull/3051), [#3043](https://github.com/urql-graphql/urql/pull/3043), [#3063](https://github.com/urql-graphql/urql/pull/3063), [#3054](https://github.com/urql-graphql/urql/pull/3054), [#3102](https://github.com/urql-graphql/urql/pull/3102), [#3097](https://github.com/urql-graphql/urql/pull/3097), [#3106](https://github.com/urql-graphql/urql/pull/3106), [#3058](https://github.com/urql-graphql/urql/pull/3058), and [#3062](https://github.com/urql-graphql/urql/pull/3062)) | ||
- @urql/core@4.0.0 | ||
## 1.1.0 | ||
@@ -4,0 +15,0 @@ |
@@ -0,10 +1,41 @@ | ||
/*!@ts-ignore*/ | ||
import { IntrospectionQuery } from 'graphql'; | ||
import { Exchange } from '@urql/core'; | ||
/** Configuration options for the {@link populateExchange}'s behaviour */ | ||
interface Options { | ||
/** Prevents populating fields for matching types. | ||
* | ||
* @remarks | ||
* `skipType` may be set to a regular expression that, when matching, | ||
* prevents fields to be added automatically for the given type by the | ||
* `populateExchange`. | ||
* | ||
* @defaultValue `/^PageInfo|(Connection|Edge)$/` - Omit Relay pagination fields | ||
*/ | ||
skipType?: RegExp; | ||
/** Specifies a maximum depth for populated fields. | ||
* | ||
* @remarks | ||
* `maxDepth` may be set to a maximum depth at which fields are populated. | ||
* This may prevent the `populateExchange` from adding infinitely deep | ||
* recursive fields or simply too many fields. | ||
* | ||
* @defaultValue `2` - Omit fields past a depth of 2. | ||
*/ | ||
maxDepth?: number; | ||
} | ||
/** Input parameters for the {@link populateExchange}. */ | ||
interface PopulateExchangeOpts { | ||
/** Introspection data for an API’s schema. | ||
* | ||
* @remarks | ||
* `schema` must be passed Schema Introspection data for the GraphQL API | ||
* this exchange is applied for. | ||
* You may use the `@urql/introspection` package to generate this data. | ||
* | ||
* @see {@link https://spec.graphql.org/October2021/#sec-Schema-Introspection} for the Schema Introspection spec. | ||
*/ | ||
schema: IntrospectionQuery; | ||
/** Configuration options for the {@link populateExchange}'s behaviour */ | ||
options?: Options; | ||
@@ -15,2 +46,4 @@ } | ||
* | ||
* @param options - A {@link PopulateExchangeOpts} configuration object. | ||
* @returns the created populate {@link Exchange}. | ||
* | ||
@@ -28,11 +61,17 @@ * @remarks | ||
* ```ts | ||
* populateExchange({ schema, options: { maxDepth: 3, skipType: /Todo/ }}) | ||
* populateExchange({ | ||
* schema, | ||
* options: { | ||
* maxDepth: 3, | ||
* skipType: /Todo/ | ||
* }, | ||
* }); | ||
* | ||
* const query = gql` | ||
* mutation { addTodo @popualte } | ||
* ` | ||
* `; | ||
* ``` | ||
*/ | ||
declare const populateExchange: ({ schema: ogSchema, options, }: PopulateExchangeOpts) => Exchange; | ||
declare const populateExchange: ({ schema: ogSchema, options }: PopulateExchangeOpts) => Exchange; | ||
export { populateExchange }; | ||
export { Options, PopulateExchangeOpts, populateExchange }; |
@@ -50,7 +50,16 @@ Object.defineProperty(exports, '__esModule', { | ||
} | ||
/** Configuration options for the {@link populateExchange}'s behaviour */ | ||
var makeDict = () => Object.create(null); | ||
/** stores information per each type it finds */ | ||
var SKIP_COUNT_TYPE = /^PageInfo|(Connection|Edge)$/; | ||
/** Creates an `Exchange` handing automatic mutation selection-set population based on the | ||
* query selection-sets seen. | ||
* | ||
* @param options - A {@link PopulateExchangeOpts} configuration object. | ||
* @returns the created populate {@link Exchange}. | ||
* | ||
@@ -68,7 +77,13 @@ * @remarks | ||
* ```ts | ||
* populateExchange({ schema, options: { maxDepth: 3, skipType: /Todo/ }}) | ||
* populateExchange({ | ||
* schema, | ||
* options: { | ||
* maxDepth: 3, | ||
* skipType: /Todo/ | ||
* }, | ||
* }); | ||
* | ||
* const query = gql` | ||
* mutation { addTodo @popualte } | ||
* ` | ||
* `; | ||
* ``` | ||
@@ -91,5 +106,7 @@ */ | ||
var userFragments = makeDict(); | ||
// State of the global types & their fields | ||
var typeFields = new Map(); | ||
var currentVariables = {}; | ||
/** Handle mutation and inject selections + fragments. */ | ||
@@ -313,2 +330,3 @@ var handleIncomingMutation = op => { | ||
}; | ||
/** Handle query and extract fragments. */ | ||
@@ -315,0 +333,0 @@ var handleIncomingQuery = ({ |
{ | ||
"name": "@urql/exchange-populate", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "An exchange that automaticcally populates the mutation selection body", | ||
@@ -40,4 +40,4 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@urql/core": ">=3.2.0", | ||
"wonka": "^6.0.0" | ||
"@urql/core": ">=4.0.0", | ||
"wonka": "^6.3.0" | ||
}, | ||
@@ -49,3 +49,3 @@ "peerDependencies": { | ||
"graphql": "^16.0.0", | ||
"@urql/core": "3.2.0" | ||
"@urql/core": "4.0.0" | ||
}, | ||
@@ -52,0 +52,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148910
768
Updated@urql/core@>=4.0.0
Updatedwonka@^6.3.0