@apollo-elements/mixins
Advanced tools
Comparing version 1.2.0 to 1.2.1
import getGraphQLScriptChildDocument from '@apollo-elements/lib/get-graphql-script-child-document'; | ||
import isValidGql from '@apollo-elements/lib/is-valid-gql'; | ||
import { dedupeMixin } from './dedupe-mixin'; | ||
/** @typedef {import('apollo-client').ApolloClient} ApolloClient */ | ||
/** @typedef {import('graphql').DocumentNode} DocumentNode */ | ||
/** | ||
@@ -13,3 +18,3 @@ * `ApolloElementMixin`: class mixin for apollo custom elements. | ||
*/ | ||
export const ApolloElementMixin = superclass => | ||
export const ApolloElementMixin = dedupeMixin(superclass => | ||
/** | ||
@@ -98,2 +103,2 @@ * Class mixin for apollo elements | ||
} | ||
}; | ||
}); |
@@ -1,7 +0,9 @@ | ||
import { ApolloElementMixin } from './apollo-element-mixin'; | ||
import { ApolloError } from 'apollo-client'; | ||
import { stripUndefinedValues } from '@apollo-elements/lib/helpers.js'; | ||
import compose from 'crocks/helpers/compose'; | ||
import pick from 'crocks/helpers/pick'; | ||
import compose from 'crocks/helpers/compose'; | ||
import { ApolloElementMixin } from './apollo-element-mixin'; | ||
import { dedupeMixin } from './dedupe-mixin'; | ||
/** @typedef {import('apollo-client').ErrorPolicy} ErrorPolicy */ | ||
@@ -38,3 +40,3 @@ /** @typedef {import('apollo-client').FetchPolicy} FetchPolicy */ | ||
*/ | ||
export const ApolloMutationMixin = superclass => | ||
export const ApolloMutationMixin = dedupeMixin(superclass => | ||
/** | ||
@@ -239,2 +241,2 @@ * Class mixin for apollo-mutation elements | ||
onError() { } | ||
}; | ||
}); |
@@ -1,20 +0,8 @@ | ||
import { ApolloElementMixin } from './apollo-element-mixin.js'; | ||
import { stripUndefinedValues } from '@apollo-elements/lib/helpers.js'; | ||
import compose from 'crocks/helpers/compose'; | ||
import hasAllVariables from '@apollo-elements/lib/has-all-variables.js'; | ||
import pick from 'crocks/helpers/pick'; | ||
import compose from 'crocks/helpers/compose'; | ||
/** @typedef {import('apollo-client').ApolloError} ApolloError */ | ||
/** @typedef {import('apollo-client').ApolloQueryResult} ApolloQueryResult */ | ||
/** @typedef {import('apollo-client').ErrorPolicy} ErrorPolicy */ | ||
/** @typedef {import('apollo-client').FetchMoreQueryOptions} FetchMoreQueryOptions */ | ||
/** @typedef {import('apollo-client').FetchPolicy} FetchPolicy */ | ||
/** @typedef {import('apollo-client').ObservableQuery} ObservableQuery */ | ||
/** @typedef {import('apollo-client').QueryOptions} QueryOptions */ | ||
/** @typedef {import('apollo-client').SubscribeToMoreOptions} SubscribeToMoreOptions */ | ||
/** @typedef {import('apollo-client').SubscriptionOptions} SubscriptionOptions */ | ||
/** @typedef {import('apollo-client').WatchQueryOptions} WatchQueryOptions */ | ||
/** @typedef {import('apollo-client/core/watchQueryOptions').ModifiableWatchQueryOptions} ModifiableWatchQueryOptions */ | ||
/** @typedef {import('graphql').DocumentNode} DocumentNode */ | ||
/** @typedef {import('zen-observable')} Observable */ | ||
import { ApolloElementMixin } from './apollo-element-mixin.js'; | ||
import { dedupeMixin } from './dedupe-mixin'; | ||
@@ -57,5 +45,6 @@ const pickExecuteQueryOpts = compose( | ||
* @param {*} superclass | ||
* @return {ApolloQueryMixin~mixin} | ||
* @return {mixin} | ||
*/ | ||
export const ApolloQueryMixin = superclass => | ||
export const ApolloQueryMixin = dedupeMixin(superclass => | ||
/** | ||
@@ -66,5 +55,19 @@ * Class mixin for apollo-query elements | ||
* @template TVariables | ||
* @alias ApolloQueryMixin~mixin | ||
* @alias mixin | ||
*/ | ||
class extends ApolloElementMixin(superclass) { | ||
/** @typedef {import('apollo-client').ApolloError} ApolloError */ | ||
/** @typedef {import('apollo-client').ApolloQueryResult<TData>} ApolloQueryResult */ | ||
/** @typedef {import('apollo-client').ErrorPolicy} ErrorPolicy */ | ||
/** @typedef {import('apollo-client').FetchMoreQueryOptions} FetchMoreQueryOptions */ | ||
/** @typedef {import('apollo-client').FetchPolicy} FetchPolicy */ | ||
/** @typedef {import('apollo-client').ObservableQuery} ObservableQuery */ | ||
/** @typedef {import('apollo-client').QueryOptions} QueryOptions */ | ||
/** @typedef {import('apollo-client').SubscribeToMoreOptions} SubscribeToMoreOptions */ | ||
/** @typedef {import('apollo-client').SubscriptionOptions} SubscriptionOptions */ | ||
/** @typedef {import('apollo-client').WatchQueryOptions} WatchQueryOptions */ | ||
/** @typedef {import('apollo-client/core/watchQueryOptions').ModifiableWatchQueryOptions} ModifiableWatchQueryOptions */ | ||
/** @typedef {import('graphql').DocumentNode} DocumentNode */ | ||
/** @typedef {import('zen-observable')} Observable */ | ||
/** | ||
@@ -94,3 +97,3 @@ * A GraphQL document containing a single query. | ||
* | ||
* @return {Object<string, *>} | ||
* @return {TVariables} | ||
*/ | ||
@@ -350,2 +353,2 @@ get variables() { | ||
onError() {} | ||
}; | ||
}); |
@@ -0,5 +1,7 @@ | ||
import { stripUndefinedValues } from '@apollo-elements/lib/helpers.js'; | ||
import hasAllVariables from '@apollo-elements/lib/has-all-variables.js'; | ||
import isFunction from 'crocks/predicates/isFunction'; | ||
import hasAllVariables from '@apollo-elements/lib/has-all-variables.js'; | ||
import { stripUndefinedValues } from '@apollo-elements/lib/helpers.js'; | ||
import { ApolloElementMixin } from './apollo-element-mixin.js'; | ||
import { dedupeMixin } from './dedupe-mixin'; | ||
@@ -28,9 +30,9 @@ /** @typedef {import('apollo-client').FetchPolicy} FetchPolicy */ | ||
* @param {*} superclass the class to mix in to | ||
* @return {ApolloSubscriptionMixin~mixin} the mixed class | ||
* @return {mixin} the mixed class | ||
*/ | ||
export const ApolloSubscriptionMixin = superclass => | ||
export const ApolloSubscriptionMixin = dedupeMixin(superclass => | ||
/** | ||
* Class mixin for apollo-subscription elements | ||
* @mixin | ||
* @alias ApolloSubscriptionMixin~mixin | ||
* @alias mixin | ||
*/ | ||
@@ -59,3 +61,3 @@ class extends ApolloElementMixin(superclass) { | ||
* | ||
* @return {Object<string, *>} | ||
* @return {TVariables} | ||
*/ | ||
@@ -167,2 +169,2 @@ get variables() { | ||
} | ||
}; | ||
}); |
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.2.1](https://github.com/apollo-elements/apollo-elements/compare/@apollo-elements/mixins@1.2.0...@apollo-elements/mixins@1.2.1) (2020-01-09) | ||
### Performance Improvements | ||
* **mixins:** deduplicate mixins ([3130b0a](https://github.com/apollo-elements/apollo-elements/commit/3130b0a)), closes [#38](https://github.com/apollo-elements/apollo-elements/issues/38) | ||
# [1.2.0](https://github.com/apollo-elements/apollo-elements/compare/@apollo-elements/mixins@1.1.3...@apollo-elements/mixins@1.2.0) (2020-01-09) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@apollo-elements/mixins", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "👩🚀🌛 Custom Element class mixins for Apollo GraphQL 🚀👨🚀", | ||
@@ -36,3 +36,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "3a278c351a6091ece00a5f7eafa921444d5b7c1f" | ||
"gitHead": "6e1bb2ab51a60cebbaed2c8aca86b2e8b2ec9336" | ||
} |
86472
21
1951