@ikas/storefront 2.0.0-alpha.15 → 2.0.0-alpha.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/build/__generated__/global-types.d.ts +5 -1
  2. package/build/__generated__/global-types.js +1 -1
  3. package/build/analytics/facebookPixel.js +1 -1
  4. package/build/analytics/googleTagManager.js +1 -1
  5. package/build/analytics/head/index.js +1 -1
  6. package/build/analytics/ikas.js +1 -1
  7. package/build/api/apollo.js +1 -1
  8. package/build/api/blog/__generated__/getBlog.d.ts +14 -16
  9. package/build/api/blog/__generated__/listBlog.d.ts +14 -16
  10. package/build/api/blog/__generated__/listBlogCategory.d.ts +14 -16
  11. package/build/api/blog/__generated__/listBlogMetaData.d.ts +14 -16
  12. package/build/api/brand/__generated__/listProductBrand.d.ts +3 -3
  13. package/build/api/cart/__generated__/getCart.d.ts +2 -4
  14. package/build/api/cart/__generated__/saveItemToCart.d.ts +2 -4
  15. package/build/api/category/__generated__/listCategory.d.ts +3 -3
  16. package/build/api/checkout/__generated__/getCheckoutById.d.ts +2 -4
  17. package/build/api/checkout/__generated__/getOrder.d.ts +5 -11
  18. package/build/api/checkout/__generated__/listCheckoutSettings.d.ts +1 -1
  19. package/build/api/checkout/index.js +1 -1
  20. package/build/api/customer/__generated__/createOrderRefundRequest.d.ts +5 -11
  21. package/build/api/customer/__generated__/customerLogin.d.ts +12 -5
  22. package/build/api/customer/__generated__/customerSocialLogin.d.ts +161 -0
  23. package/build/api/customer/__generated__/getCustomerOrders.d.ts +5 -11
  24. package/build/api/customer/__generated__/getMyCustomer.d.ts +4 -5
  25. package/build/api/customer/__generated__/registerCustomer.d.ts +12 -5
  26. package/build/api/customer/__generated__/saveMyCustomer.d.ts +12 -5
  27. package/build/api/customer/index.d.ts +5 -0
  28. package/build/api/customer/index.js +1 -1
  29. package/build/api/customer-review/__generated__/listCustomerReviews.d.ts +14 -16
  30. package/build/api/product-option-set/index.js +1 -1
  31. package/build/api/variant-type/__generated__/listVariantType.d.ts +3 -7
  32. package/build/components/checkout/components/address-form/index.js +1 -1
  33. package/build/components/checkout/components/address-form/model.d.ts +8 -0
  34. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  35. package/build/components/checkout/components/cart-summary/index.js +1 -1
  36. package/build/components/checkout/components/step-container/index.js +1 -1
  37. package/build/components/checkout/index.js +1 -1
  38. package/build/components/checkout/model.d.ts +2 -0
  39. package/build/components/checkout/model.js +1 -1
  40. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  41. package/build/components/checkout/steps/step-payment/payment-gateways/installments/index.js +1 -1
  42. package/build/components/checkout/steps/step-shipping/index.js +1 -1
  43. package/build/components/checkout/steps/step-success/index.js +1 -1
  44. package/build/components/page/head.js +1 -1
  45. package/build/components/page/index.js +1 -1
  46. package/build/components/page-editor/index.d.ts +1 -1
  47. package/build/components/page-editor/index.js +1 -1
  48. package/build/ext/@apollo/client/cache/inmemory/entityStore.js +1 -1
  49. package/build/ext/@apollo/client/cache/inmemory/inMemoryCache.js +1 -1
  50. package/build/ext/@apollo/client/cache/inmemory/policies.js +1 -1
  51. package/build/ext/@apollo/client/cache/inmemory/readFromStore.js +1 -1
  52. package/build/ext/@apollo/client/cache/inmemory/writeToStore.js +1 -1
  53. package/build/ext/@apollo/client/core/ApolloClient.js +1 -1
  54. package/build/ext/@apollo/client/core/LocalState.js +1 -1
  55. package/build/ext/@apollo/client/core/ObservableQuery.js +1 -1
  56. package/build/ext/@apollo/client/core/QueryManager.js +1 -1
  57. package/build/ext/@apollo/client/errors/index.js +1 -1
  58. package/build/ext/@apollo/client/ext/tslib/tslib.es6.js +15 -0
  59. package/build/ext/@apollo/client/link/context/index.js +1 -1
  60. package/build/ext/@apollo/client/link/core/ApolloLink.js +1 -1
  61. package/build/ext/@apollo/client/link/error/index.js +1 -1
  62. package/build/ext/@apollo/client/link/http/HttpLink.js +1 -1
  63. package/build/ext/@apollo/client/link/http/createHttpLink.js +1 -1
  64. package/build/ext/@apollo/client/link/http/selectHttpOptionsAndBody.js +1 -1
  65. package/build/ext/@apollo/client/link/utils/createOperation.js +1 -1
  66. package/build/ext/@apollo/client/utilities/common/mergeDeep.js +1 -1
  67. package/build/ext/@apollo/client/utilities/graphql/fragments.js +1 -1
  68. package/build/ext/@apollo/client/utilities/graphql/transform.js +1 -1
  69. package/build/ext/@apollo/client/utilities/observables/Concast.js +1 -1
  70. package/build/ext/ts-invariant/ext/tslib/tslib.es6.js +15 -0
  71. package/build/ext/ts-invariant/lib/invariant.esm.js +1 -1
  72. package/build/ext/tslib/tslib.es6.js +1 -1
  73. package/build/ikas.js +20 -6
  74. package/build/index.js +1 -1
  75. package/build/models/data/blog/index.js +1 -1
  76. package/build/models/data/brand/index.js +1 -1
  77. package/build/models/data/category/index.js +1 -1
  78. package/build/models/data/checkout/index.js +1 -1
  79. package/build/models/data/checkout-settings/index.d.ts +1 -1
  80. package/build/models/data/checkout-settings/index.js +1 -1
  81. package/build/models/data/customer/address/index.d.ts +4 -1
  82. package/build/models/data/customer/address/index.js +1 -1
  83. package/build/models/data/image/index.js +1 -1
  84. package/build/models/data/language/index.d.ts +6 -0
  85. package/build/models/data/order/address/index.d.ts +2 -1
  86. package/build/models/data/order/address/index.js +1 -1
  87. package/build/models/data/order/line-item/variant/index.js +1 -1
  88. package/build/models/data/product/index.js +1 -1
  89. package/build/models/data/product-filter/index.js +1 -1
  90. package/build/models/data/product-option-set/index.d.ts +4 -0
  91. package/build/models/data/product-option-set/index.js +1 -1
  92. package/build/models/theme/component/index.d.ts +9 -0
  93. package/build/models/theme/component/index.js +1 -1
  94. package/build/models/theme/component/prop/index.d.ts +17 -0
  95. package/build/models/theme/component/prop/index.js +1 -1
  96. package/build/models/theme/custom-data/index.d.ts +18 -3
  97. package/build/models/theme/custom-data/index.js +1 -1
  98. package/build/models/theme/settings/color/index.d.ts +7 -0
  99. package/build/models/theme/settings/color/index.js +1 -1
  100. package/build/models/ui/product-detail/index.js +1 -1
  101. package/build/models/ui/product-list/index.js +1 -1
  102. package/build/models/ui/validator/form/account-info.js +1 -1
  103. package/build/models/ui/validator/form/address.js +1 -1
  104. package/build/pages/checkout.js +1 -1
  105. package/build/pages/editor.d.ts +4 -6
  106. package/build/pages/editor.js +1 -1
  107. package/build/providers/page-data-next.js +1 -1
  108. package/build/scripts/generators/components/index.js +1 -1
  109. package/build/scripts/generators/config/content.d.ts +2 -2
  110. package/build/scripts/generators/config/content.js +1 -1
  111. package/build/scripts/generators/pages/index.js +1 -1
  112. package/build/scripts/generators/types/index.d.ts +1 -1
  113. package/build/scripts/generators/types/index.js +1 -1
  114. package/build/store/cart.d.ts +6 -7
  115. package/build/store/cart.js +1 -1
  116. package/build/store/customer.d.ts +19 -0
  117. package/build/store/customer.js +1 -1
  118. package/build/storefront/index.d.ts +4 -2
  119. package/build/storefront/index.js +1 -1
  120. package/build/utils/fs.js +1 -1
  121. package/build/utils/google-fonts.js +1 -1
  122. package/package.json +6 -3
@@ -1 +1 @@
1
- import{__assign as e}from"../../../tslib/tslib.es6.js";import{InvariantError as t,invariant as r}from"../../../ts-invariant/lib/invariant.esm.js";import{ApolloLink as o}from"../link/core/ApolloLink.js";import{execute as i}from"../link/core/execute.js";import"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import"../utilities/observables/Concast.js";import{compact as s}from"../utilities/common/compact.js";import{version as n}from"../version.js";import{HttpLink as a}from"../link/http/HttpLink.js";import{QueryManager as c}from"./QueryManager.js";import{LocalState as l}from"./LocalState.js";var u=!1;function h(t,r){return s(t,r,r.variables&&{variables:e(e({},t.variables),r.variables)})}var p=function(){function s(e){var i=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var s=e.uri,h=e.credentials,p=e.headers,f=e.cache,d=e.ssrMode,y=void 0!==d&&d,m=e.ssrForceFetchDelay,b=void 0===m?0:m,v=e.connectToDevTools,w=void 0===v?"object"==typeof window&&!window.__APOLLO_CLIENT__&&"production"!==process.env.NODE_ENV:v,k=e.queryDeduplication,g=void 0===k||k,O=e.defaultOptions,S=e.assumeImmutableResults,q=void 0!==S&&S,_=e.resolvers,M=e.typeDefs,Q=e.fragmentMatcher,F=e.name,C=e.version,j=e.link;if(j||(j=s?new a({uri:s,credentials:h,headers:p}):o.empty()),!f)throw"production"===process.env.NODE_ENV?new t(9):new t("To initialize Apollo Client, you must specify a 'cache' property in the options object. \nFor more information, please visit: https://go.apollo.dev/c/docs");if(this.link=j,this.cache=f,this.disableNetworkFetches=y||b>0,this.queryDeduplication=g,this.defaultOptions=O||{},this.typeDefs=M,b&&setTimeout((function(){return i.disableNetworkFetches=!1}),b),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),w&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),!u&&"production"!==process.env.NODE_ENV&&(u=!0,"undefined"!=typeof window&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var L=window.navigator,P=L&&L.userAgent,D=void 0;"string"==typeof P&&(P.indexOf("Chrome/")>-1?D="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":P.indexOf("Firefox/")>-1&&(D="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),D&&r.log("Download the Apollo DevTools for a better development experience: "+D)}this.version=n,this.localState=new l({cache:f,client:this,resolvers:_,fragmentMatcher:Q}),this.queryManager=new c({cache:this.cache,link:this.link,queryDeduplication:g,ssrMode:y,clientAwareness:{name:F,version:C},localState:this.localState,assumeImmutableResults:q,onBroadcast:w?function(){i.devToolsHookCb&&i.devToolsHookCb({action:{},state:{queries:i.queryManager.getQueryStore(),mutations:i.queryManager.mutationStore||{}},dataWithOptimisticResults:i.cache.extract(!0)})}:void 0})}return s.prototype.stop=function(){this.queryManager.stop()},s.prototype.watchQuery=function(t){return this.defaultOptions.watchQuery&&(t=h(this.defaultOptions.watchQuery,t)),!this.disableNetworkFetches||"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(t=e(e({},t),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(t)},s.prototype.query=function(t){return this.defaultOptions.query&&(t=h(this.defaultOptions.query,t)),"production"===process.env.NODE_ENV?r("cache-and-network"!==t.fetchPolicy,10):r("cache-and-network"!==t.fetchPolicy,"The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."),this.disableNetworkFetches&&"network-only"===t.fetchPolicy&&(t=e(e({},t),{fetchPolicy:"cache-first"})),this.queryManager.query(t)},s.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=h(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},s.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},s.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},s.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},s.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},s.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},s.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},s.prototype.__requestRaw=function(e){return i(this.link,e)},s.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},s.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},s.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},s.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},s.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},s.prototype.extract=function(e){return this.cache.extract(e)},s.prototype.restore=function(e){return this.cache.restore(e)},s.prototype.addResolvers=function(e){this.localState.addResolvers(e)},s.prototype.setResolvers=function(e){this.localState.setResolvers(e)},s.prototype.getResolvers=function(){return this.localState.getResolvers()},s.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},s.prototype.setLink=function(e){this.link=this.queryManager.link=e},s}();export{p as ApolloClient,h as mergeOptions};
1
+ import{__assign as e}from'../ext/tslib/tslib.es6.js';import{InvariantError as t,invariant as r}from"../../../ts-invariant/lib/invariant.esm.js";import{ApolloLink as o}from"../link/core/ApolloLink.js";import{execute as i}from"../link/core/execute.js";import"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import"../utilities/observables/Concast.js";import{compact as s}from"../utilities/common/compact.js";import{version as n}from"../version.js";import{HttpLink as a}from"../link/http/HttpLink.js";import{QueryManager as c}from"./QueryManager.js";import{LocalState as l}from"./LocalState.js";var u=!1;function h(t,r){return s(t,r,r.variables&&{variables:e(e({},t.variables),r.variables)})}var p=function(){function s(e){var i=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var s=e.uri,h=e.credentials,p=e.headers,f=e.cache,d=e.ssrMode,y=void 0!==d&&d,m=e.ssrForceFetchDelay,b=void 0===m?0:m,v=e.connectToDevTools,w=void 0===v?"object"==typeof window&&!window.__APOLLO_CLIENT__&&"production"!==process.env.NODE_ENV:v,k=e.queryDeduplication,g=void 0===k||k,O=e.defaultOptions,S=e.assumeImmutableResults,q=void 0!==S&&S,_=e.resolvers,M=e.typeDefs,Q=e.fragmentMatcher,F=e.name,C=e.version,j=e.link;if(j||(j=s?new a({uri:s,credentials:h,headers:p}):o.empty()),!f)throw"production"===process.env.NODE_ENV?new t(9):new t("To initialize Apollo Client, you must specify a 'cache' property in the options object. \nFor more information, please visit: https://go.apollo.dev/c/docs");if(this.link=j,this.cache=f,this.disableNetworkFetches=y||b>0,this.queryDeduplication=g,this.defaultOptions=O||{},this.typeDefs=M,b&&setTimeout((function(){return i.disableNetworkFetches=!1}),b),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),w&&"object"==typeof window&&(window.__APOLLO_CLIENT__=this),!u&&"production"!==process.env.NODE_ENV&&(u=!0,"undefined"!=typeof window&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var L=window.navigator,P=L&&L.userAgent,D=void 0;"string"==typeof P&&(P.indexOf("Chrome/")>-1?D="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":P.indexOf("Firefox/")>-1&&(D="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),D&&r.log("Download the Apollo DevTools for a better development experience: "+D)}this.version=n,this.localState=new l({cache:f,client:this,resolvers:_,fragmentMatcher:Q}),this.queryManager=new c({cache:this.cache,link:this.link,queryDeduplication:g,ssrMode:y,clientAwareness:{name:F,version:C},localState:this.localState,assumeImmutableResults:q,onBroadcast:w?function(){i.devToolsHookCb&&i.devToolsHookCb({action:{},state:{queries:i.queryManager.getQueryStore(),mutations:i.queryManager.mutationStore||{}},dataWithOptimisticResults:i.cache.extract(!0)})}:void 0})}return s.prototype.stop=function(){this.queryManager.stop()},s.prototype.watchQuery=function(t){return this.defaultOptions.watchQuery&&(t=h(this.defaultOptions.watchQuery,t)),!this.disableNetworkFetches||"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(t=e(e({},t),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(t)},s.prototype.query=function(t){return this.defaultOptions.query&&(t=h(this.defaultOptions.query,t)),"production"===process.env.NODE_ENV?r("cache-and-network"!==t.fetchPolicy,10):r("cache-and-network"!==t.fetchPolicy,"The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."),this.disableNetworkFetches&&"network-only"===t.fetchPolicy&&(t=e(e({},t),{fetchPolicy:"cache-first"})),this.queryManager.query(t)},s.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=h(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},s.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},s.prototype.readQuery=function(e,t){return void 0===t&&(t=!1),this.cache.readQuery(e,t)},s.prototype.readFragment=function(e,t){return void 0===t&&(t=!1),this.cache.readFragment(e,t)},s.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},s.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},s.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},s.prototype.__requestRaw=function(e){return i(this.link,e)},s.prototype.resetStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.resetStoreCallbacks.map((function(e){return e()})))})).then((function(){return e.reFetchObservableQueries()}))},s.prototype.clearStore=function(){var e=this;return Promise.resolve().then((function(){return e.queryManager.clearStore()})).then((function(){return Promise.all(e.clearStoreCallbacks.map((function(e){return e()})))}))},s.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter((function(t){return t!==e}))}},s.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter((function(t){return t!==e}))}},s.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},s.prototype.extract=function(e){return this.cache.extract(e)},s.prototype.restore=function(e){return this.cache.restore(e)},s.prototype.addResolvers=function(e){this.localState.addResolvers(e)},s.prototype.setResolvers=function(e){this.localState.setResolvers(e)},s.prototype.getResolvers=function(){return this.localState.getResolvers()},s.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},s.prototype.setLink=function(e){this.link=this.queryManager.link=e},s}();export{p as ApolloClient,h as mergeOptions};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__assign as r}from"../../../tslib/tslib.es6.js";import{invariant as o}from"../../../ts-invariant/lib/invariant.esm.js";import{hasDirectives as i,shouldInclude as n}from"../utilities/graphql/directives.js";import{createFragmentMap as s}from"../utilities/graphql/fragments.js";import{getMainDefinition as a,getFragmentDefinitions as u}from"../utilities/graphql/getFromAST.js";import{resultKeyNameFromField as l,argumentsObjectFromField as c,isField as v,isInlineFragment as h}from"../utilities/graphql/storeUtils.js";import{removeClientSetsFromDocument as p,buildQueryFromSelectionSet as m}from"../utilities/graphql/transform.js";import{mergeDeep as f,mergeDeepArray as d}from"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import"../utilities/observables/Concast.js";import"../cache/core/cache.js";import"../cache/inmemory/inMemoryCache.js";import{cacheSlot as y}from"../cache/inmemory/reactiveVars.js";import"../cache/inmemory/policies.js";import{visit as g,BREAK as b}from"../../../graphql/language/visitor.mjs.js";var S=function(){function S(e){var t=e.cache,r=e.client,o=e.resolvers,i=e.fragmentMatcher;this.cache=t,r&&(this.client=r),o&&this.addResolvers(o),i&&this.setFragmentMatcher(i)}return S.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=f(t.resolvers,e)})):this.resolvers=f(this.resolvers,e)},S.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},S.prototype.getResolvers=function(){return this.resolvers||{}},S.prototype.runResolvers=function(o){var i=o.document,n=o.remoteResult,s=o.context,a=o.variables,u=o.onlyRunForcedResolvers,l=void 0!==u&&u;return e(this,void 0,void 0,(function(){return t(this,(function(e){return i?[2,this.resolveDocument(i,n.data,s,a,this.fragmentMatcher,l).then((function(e){return r(r({},n),{data:e.result})}))]:[2,n]}))}))},S.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},S.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},S.prototype.clientQuery=function(e){return i(["client"],e)&&this.resolvers?e:null},S.prototype.serverQuery=function(e){return p(e)},S.prototype.prepareContext=function(e){var t=this.cache;return r(r({},e),{cache:t,getCacheKey:function(e){return t.identify(e)}})},S.prototype.addExportedVariables=function(o,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),e(this,void 0,void 0,(function(){return t(this,(function(e){return o?[2,this.resolveDocument(o,this.buildRootValueFromCache(o,i)||{},this.prepareContext(n),i).then((function(e){return r(r({},i),e.exportedVariables)}))]:[2,r({},i)]}))}))},S.prototype.shouldForceResolvers=function(e){var t=!1;return g(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return b}}}),t},S.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:m(e),variables:t,returnPartialData:!0,optimistic:!1}).result},S.prototype.resolveDocument=function(o,i,n,l,c,v){return void 0===n&&(n={}),void 0===l&&(l={}),void 0===c&&(c=function(){return!0}),void 0===v&&(v=!1),e(this,void 0,void 0,(function(){var e,h,p,m,f,d,y,g,b;return t(this,(function(t){return e=a(o),h=u(o),p=s(h),m=e.operation,f=m?m.charAt(0).toUpperCase()+m.slice(1):"Query",y=(d=this).cache,g=d.client,b={fragmentMap:p,context:r(r({},n),{cache:y,client:g}),variables:l,fragmentMatcher:c,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:v},[2,this.resolveSelectionSet(e.selectionSet,i,b).then((function(e){return{result:e,exportedVariables:b.exportedVariables}}))]}))}))},S.prototype.resolveSelectionSet=function(r,i,s){return e(this,void 0,void 0,(function(){var a,u,c,p,m,f=this;return t(this,(function(y){return a=s.fragmentMap,u=s.context,c=s.variables,p=[i],m=function(r){return e(f,void 0,void 0,(function(){var e,m;return t(this,(function(t){return n(r,c)?v(r)?[2,this.resolveField(r,i,s).then((function(e){var t;void 0!==e&&p.push(((t={})[l(r)]=e,t))}))]:(h(r)?e=r:(e=a[r.name.value],"production"===process.env.NODE_ENV?o(e,11):o(e,"No fragment named "+r.name.value)),e&&e.typeCondition&&(m=e.typeCondition.name.value,s.fragmentMatcher(i,m,u))?[2,this.resolveSelectionSet(e.selectionSet,i,s).then((function(e){p.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(r.selections.map(m)).then((function(){return d(p)}))]}))}))},S.prototype.resolveField=function(r,o,i){return e(this,void 0,void 0,(function(){var e,n,s,a,u,v,h,p,m,f=this;return t(this,(function(t){return e=i.variables,n=r.name.value,s=l(r),a=n!==s,u=o[s]||o[n],v=Promise.resolve(u),i.onlyRunForcedResolvers&&!this.shouldForceResolvers(r)||(h=o.__typename||i.defaultOperationType,(p=this.resolvers&&this.resolvers[h])&&(m=p[a?n:s])&&(v=Promise.resolve(y.withValue(this.cache,m,[o,c(r,e),i.context,{field:r,fragmentMap:i.fragmentMap}])))),[2,v.then((function(e){return void 0===e&&(e=u),r.directives&&r.directives.forEach((function(t){"export"===t.name.value&&t.arguments&&t.arguments.forEach((function(t){"as"===t.name.value&&"StringValue"===t.value.kind&&(i.exportedVariables[t.value.value]=e)}))})),r.selectionSet?null==e?e:Array.isArray(e)?f.resolveSubSelectedArray(r,e,i):r.selectionSet?f.resolveSelectionSet(r.selectionSet,e,i):void 0:e}))]}))}))},S.prototype.resolveSubSelectedArray=function(e,t,r){var o=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?o.resolveSubSelectedArray(e,t,r):e.selectionSet?o.resolveSelectionSet(e.selectionSet,t,r):void 0})))},S}();export{S as LocalState};
1
+ import{__awaiter as e,__assign as t,__generator as r}from'../ext/tslib/tslib.es6.js';import{invariant as o}from"../../../ts-invariant/lib/invariant.esm.js";import{hasDirectives as i,shouldInclude as n}from"../utilities/graphql/directives.js";import{createFragmentMap as s}from"../utilities/graphql/fragments.js";import{getMainDefinition as a,getFragmentDefinitions as u}from"../utilities/graphql/getFromAST.js";import{resultKeyNameFromField as l,argumentsObjectFromField as c,isField as v,isInlineFragment as h}from"../utilities/graphql/storeUtils.js";import{removeClientSetsFromDocument as p,buildQueryFromSelectionSet as m}from"../utilities/graphql/transform.js";import{mergeDeep as f,mergeDeepArray as d}from"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import"../utilities/observables/Concast.js";import"../cache/core/cache.js";import"../cache/inmemory/inMemoryCache.js";import{cacheSlot as y}from"../cache/inmemory/reactiveVars.js";import"../cache/inmemory/policies.js";import{visit as g,BREAK as b}from"../../../graphql/language/visitor.mjs.js";var S=function(){function S(e){var t=e.cache,r=e.client,o=e.resolvers,i=e.fragmentMatcher;this.cache=t,r&&(this.client=r),o&&this.addResolvers(o),i&&this.setFragmentMatcher(i)}return S.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach((function(e){t.resolvers=f(t.resolvers,e)})):this.resolvers=f(this.resolvers,e)},S.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},S.prototype.getResolvers=function(){return this.resolvers||{}},S.prototype.runResolvers=function(o){var i=o.document,n=o.remoteResult,s=o.context,a=o.variables,u=o.onlyRunForcedResolvers,l=void 0!==u&&u;return e(this,void 0,void 0,(function(){return r(this,(function(e){return i?[2,this.resolveDocument(i,n.data,s,a,this.fragmentMatcher,l).then((function(e){return t(t({},n),{data:e.result})}))]:[2,n]}))}))},S.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},S.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},S.prototype.clientQuery=function(e){return i(["client"],e)&&this.resolvers?e:null},S.prototype.serverQuery=function(e){return p(e)},S.prototype.prepareContext=function(e){var r=this.cache;return t(t({},e),{cache:r,getCacheKey:function(e){return r.identify(e)}})},S.prototype.addExportedVariables=function(o,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),e(this,void 0,void 0,(function(){return r(this,(function(e){return o?[2,this.resolveDocument(o,this.buildRootValueFromCache(o,i)||{},this.prepareContext(n),i).then((function(e){return t(t({},i),e.exportedVariables)}))]:[2,t({},i)]}))}))},S.prototype.shouldForceResolvers=function(e){var t=!1;return g(e,{Directive:{enter:function(e){if("client"===e.name.value&&e.arguments&&(t=e.arguments.some((function(e){return"always"===e.name.value&&"BooleanValue"===e.value.kind&&!0===e.value.value}))))return b}}}),t},S.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:m(e),variables:t,returnPartialData:!0,optimistic:!1}).result},S.prototype.resolveDocument=function(o,i,n,l,c,v){return void 0===n&&(n={}),void 0===l&&(l={}),void 0===c&&(c=function(){return!0}),void 0===v&&(v=!1),e(this,void 0,void 0,(function(){var e,h,p,m,f,d,y,g,b;return r(this,(function(r){return e=a(o),h=u(o),p=s(h),m=e.operation,f=m?m.charAt(0).toUpperCase()+m.slice(1):"Query",y=(d=this).cache,g=d.client,b={fragmentMap:p,context:t(t({},n),{cache:y,client:g}),variables:l,fragmentMatcher:c,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:v},[2,this.resolveSelectionSet(e.selectionSet,i,b).then((function(e){return{result:e,exportedVariables:b.exportedVariables}}))]}))}))},S.prototype.resolveSelectionSet=function(t,i,s){return e(this,void 0,void 0,(function(){var a,u,c,p,m,f=this;return r(this,(function(y){return a=s.fragmentMap,u=s.context,c=s.variables,p=[i],m=function(t){return e(f,void 0,void 0,(function(){var e,m;return r(this,(function(r){return n(t,c)?v(t)?[2,this.resolveField(t,i,s).then((function(e){var r;void 0!==e&&p.push(((r={})[l(t)]=e,r))}))]:(h(t)?e=t:(e=a[t.name.value],"production"===process.env.NODE_ENV?o(e,11):o(e,"No fragment named "+t.name.value)),e&&e.typeCondition&&(m=e.typeCondition.name.value,s.fragmentMatcher(i,m,u))?[2,this.resolveSelectionSet(e.selectionSet,i,s).then((function(e){p.push(e)}))]:[2]):[2]}))}))},[2,Promise.all(t.selections.map(m)).then((function(){return d(p)}))]}))}))},S.prototype.resolveField=function(t,o,i){return e(this,void 0,void 0,(function(){var e,n,s,a,u,v,h,p,m,f=this;return r(this,(function(r){return e=i.variables,n=t.name.value,s=l(t),a=n!==s,u=o[s]||o[n],v=Promise.resolve(u),i.onlyRunForcedResolvers&&!this.shouldForceResolvers(t)||(h=o.__typename||i.defaultOperationType,(p=this.resolvers&&this.resolvers[h])&&(m=p[a?n:s])&&(v=Promise.resolve(y.withValue(this.cache,m,[o,c(t,e),i.context,{field:t,fragmentMap:i.fragmentMap}])))),[2,v.then((function(e){return void 0===e&&(e=u),t.directives&&t.directives.forEach((function(t){"export"===t.name.value&&t.arguments&&t.arguments.forEach((function(t){"as"===t.name.value&&"StringValue"===t.value.kind&&(i.exportedVariables[t.value.value]=e)}))})),t.selectionSet?null==e?e:Array.isArray(e)?f.resolveSubSelectedArray(t,e,i):t.selectionSet?f.resolveSelectionSet(t.selectionSet,e,i):void 0:e}))]}))}))},S.prototype.resolveSubSelectedArray=function(e,t,r){var o=this;return Promise.all(t.map((function(t){return null===t?null:Array.isArray(t)?o.resolveSubSelectedArray(e,t,r):e.selectionSet?o.resolveSelectionSet(e.selectionSet,t,r):void 0})))},S}();export{S as LocalState};
@@ -1 +1 @@
1
- import{__extends as e,__assign as r}from"../../../tslib/tslib.es6.js";import{invariant as t}from"../../../ts-invariant/lib/invariant.esm.js";import s from"../../../@wry/equality/lib/equality.esm.js";import{NetworkStatus as o,isNetworkRequestInFlight as i}from"./networkStatus.js";import{getOperationDefinition as n}from"../utilities/graphql/getFromAST.js";import"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import{cloneDeep as a}from"../utilities/common/cloneDeep.js";import{iterateObserversSafely as u}from"../utilities/observables/iteration.js";import"../utilities/observables/Concast.js";import{isNonEmptyArray as l}from"../utilities/common/arrays.js";import{Reobserver as c}from"./Reobserver.js";import h from"../../../zen-observable/index.js";var p=!1,v=function(h){function v(e){var t=e.queryManager,s=e.queryInfo,i=e.options,a=h.call(this,(function(e){return a.onSubscribe(e)}))||this;a.observers=new Set,a.subscriptions=new Set,a.observer={next:function(e){(a.lastError||a.isDifferentFromLastResult(e))&&(a.updateLastResult(e),u(a.observers,"next",e))},error:function(e){a.updateLastResult(r(r({},a.lastResult),{error:e,errors:e.graphQLErrors,networkStatus:o.error,loading:!1})),u(a.observers,"error",a.lastError=e)}},a.isTornDown=!1,a.options=i,a.queryId=t.generateQueryId();var l=n(i.query);return a.queryName=l&&l.name&&l.name.value,a.queryManager=t,a.queryInfo=s,a}return e(v,h),Object.defineProperty(v.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),v.prototype.result=function(){var e=this;return new Promise((function(r,t){var s={next:function(t){r(t),e.observers.delete(s),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){o.unsubscribe()}),0)},error:t},o=e.subscribe(s)}))},v.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var t=this.lastResult,s=this.queryInfo.networkStatus||t&&t.networkStatus||o.ready,n=r(r({},t),{loading:i(s),networkStatus:s});if(this.isTornDown)return n;var a=this.options.fetchPolicy,u=void 0===a?"cache-first":a;if("no-cache"===u||"network-only"===u)delete n.partial;else if(!n.data||!this.queryManager.transform(this.options.query).hasForcedResolvers){var l=this.queryInfo.getDiff();n.data=l.complete||this.options.returnPartialData?l.result:void 0,l.complete?(n.networkStatus!==o.loading||"cache-first"!==u&&"cache-only"!==u||(n.networkStatus=o.ready,n.loading=!1),delete n.partial):n.partial=!0}return e&&this.updateLastResult(n),n},v.prototype.isDifferentFromLastResult=function(e){return!s(this.lastResultSnapshot,e)},v.prototype.getLastResult=function(){return this.lastResult},v.prototype.getLastError=function(){return this.lastError},v.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},v.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},v.prototype.refetch=function(e){var t={pollInterval:0},i=this.options.fetchPolicy;return"no-cache"!==i&&"cache-and-network"!==i&&(t.fetchPolicy="network-only",t.nextFetchPolicy=i||"cache-first"),e&&!s(this.options.variables,e)&&(t.variables=this.options.variables=r(r({},this.options.variables),e)),this.newReobserver(!1).reobserve(t,o.refetch)},v.prototype.fetchMore=function(e){var s=this,i=r(r({},e.query?e:r(r(r({},this.options),e),{variables:r(r({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),n=this.queryManager.generateQueryId();return i.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=o.fetchMore,this.observe()),this.queryManager.fetchQuery(n,i,o.fetchMore).then((function(r){var o=r.data,n=e.updateQuery;return n?("production"===process.env.NODE_ENV||p||("production"===process.env.NODE_ENV||t.warn("The updateQuery callback for fetchMore is deprecated, and will be removed\nin the next major version of Apollo Client.\n\nPlease convert updateQuery functions to field policies with appropriate\nread and merge functions, or use/adapt a helper function (such as\nconcatPagination, offsetLimitPagination, or relayStylePagination) from\n@apollo/client/utilities.\n\nThe field policy system handles pagination more effectively than a\nhand-written updateQuery function, and you only need to define the policy\nonce, rather than every time you call fetchMore."),p=!0),s.updateQuery((function(e){return n(e,{fetchMoreResult:o,variables:i.variables})}))):s.queryManager.cache.writeQuery({query:i.query,variables:i.variables,data:o}),r})).finally((function(){s.queryManager.stopQuery(n),s.reobserve()}))},v.prototype.subscribeToMore=function(e){var r=this,s=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(t){var s=e.updateQuery;s&&r.updateQuery((function(e,r){var o=r.variables;return s(e,{subscriptionData:t,variables:o})}))},error:function(r){e.onError?e.onError(r):"production"===process.env.NODE_ENV||t.error("Unhandled GraphQL subscription error",r)}});return this.subscriptions.add(s),function(){r.subscriptions.delete(s)&&s.unsubscribe()}},v.prototype.setOptions=function(e){return this.reobserve(e)},v.prototype.setVariables=function(e){if(s(this.variables,e))return this.observers.size?this.result():Promise.resolve();if(this.options.variables=e,!this.observers.size)return Promise.resolve();var r=this.options.fetchPolicy,t=void 0===r?"cache-first":r,i={fetchPolicy:t,variables:e};return"cache-first"!==t&&"no-cache"!==t&&"network-only"!==t&&(i.fetchPolicy="cache-and-network",i.nextFetchPolicy=t),this.reobserve(i,o.setVariables)},v.prototype.updateQuery=function(e){var r,t=this.queryManager,s=e(t.cache.diff({query:this.options.query,variables:this.variables,previousResult:null===(r=this.lastResult)||void 0===r?void 0:r.data,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});s&&(t.cache.writeQuery({query:this.options.query,data:s,variables:this.variables}),t.broadcastQueries())},v.prototype.startPolling=function(e){this.getReobserver().updateOptions({pollInterval:e})},v.prototype.stopPolling=function(){this.reobserver&&this.reobserver.updateOptions({pollInterval:0})},v.prototype.updateLastResult=function(e){var r=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:a(e),l(e.errors)||delete this.lastError,r},v.prototype.onSubscribe=function(e){var r=this;if(e===this.observer)return function(){};try{var t=e._subscription._observer;t&&!t.error&&(t.error=b)}catch(e){}var s=!this.observers.size;return this.observers.add(e),this.lastError?e.error&&e.error(this.lastError):this.lastResult&&e.next&&e.next(this.lastResult),s&&this.reobserve().catch((function(e){})),function(){r.observers.delete(e)&&!r.observers.size&&r.tearDownQuery()}},v.prototype.getReobserver=function(){return this.reobserver||(this.reobserver=this.newReobserver(!0))},v.prototype.newReobserver=function(e){var t=this,s=this.queryManager,o=this.queryId;return s.setObservableQuery(this),new c(this.observer,e?this.options:r({},this.options),(function(e,r){return s.setObservableQuery(t),s.fetchQueryObservable(o,e,r)}),!s.ssrMode&&function(){return!i(t.queryInfo.networkStatus)})},v.prototype.reobserve=function(e,r){return this.isTornDown=!1,this.getReobserver().reobserve(e,r)},v.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},v.prototype.hasObservers=function(){return this.observers.size>0},v.prototype.tearDownQuery=function(){this.isTornDown||(this.reobserver&&(this.reobserver.stop(),delete this.reobserver),delete this.options.context,this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},v}(h);function b(e){"production"===process.env.NODE_ENV||t.error("Unhandled error",e.message,e.stack)}export{v as ObservableQuery};
1
+ import{__extends as e,__assign as r}from'../ext/tslib/tslib.es6.js';import{invariant as t}from"../../../ts-invariant/lib/invariant.esm.js";import s from"../../../@wry/equality/lib/equality.esm.js";import{NetworkStatus as o,isNetworkRequestInFlight as i}from"./networkStatus.js";import{getOperationDefinition as n}from"../utilities/graphql/getFromAST.js";import"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import{cloneDeep as a}from"../utilities/common/cloneDeep.js";import{iterateObserversSafely as u}from"../utilities/observables/iteration.js";import"../utilities/observables/Concast.js";import{isNonEmptyArray as l}from"../utilities/common/arrays.js";import{Reobserver as c}from"./Reobserver.js";import h from"../../../zen-observable/index.js";var p=!1,v=function(h){function v(e){var t=e.queryManager,s=e.queryInfo,i=e.options,a=h.call(this,(function(e){return a.onSubscribe(e)}))||this;a.observers=new Set,a.subscriptions=new Set,a.observer={next:function(e){(a.lastError||a.isDifferentFromLastResult(e))&&(a.updateLastResult(e),u(a.observers,"next",e))},error:function(e){a.updateLastResult(r(r({},a.lastResult),{error:e,errors:e.graphQLErrors,networkStatus:o.error,loading:!1})),u(a.observers,"error",a.lastError=e)}},a.isTornDown=!1,a.options=i,a.queryId=t.generateQueryId();var l=n(i.query);return a.queryName=l&&l.name&&l.name.value,a.queryManager=t,a.queryInfo=s,a}return e(v,h),Object.defineProperty(v.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),v.prototype.result=function(){var e=this;return new Promise((function(r,t){var s={next:function(t){r(t),e.observers.delete(s),e.observers.size||e.queryManager.removeQuery(e.queryId),setTimeout((function(){o.unsubscribe()}),0)},error:t},o=e.subscribe(s)}))},v.prototype.getCurrentResult=function(e){void 0===e&&(e=!0);var t=this.lastResult,s=this.queryInfo.networkStatus||t&&t.networkStatus||o.ready,n=r(r({},t),{loading:i(s),networkStatus:s});if(this.isTornDown)return n;var a=this.options.fetchPolicy,u=void 0===a?"cache-first":a;if("no-cache"===u||"network-only"===u)delete n.partial;else if(!n.data||!this.queryManager.transform(this.options.query).hasForcedResolvers){var l=this.queryInfo.getDiff();n.data=l.complete||this.options.returnPartialData?l.result:void 0,l.complete?(n.networkStatus!==o.loading||"cache-first"!==u&&"cache-only"!==u||(n.networkStatus=o.ready,n.loading=!1),delete n.partial):n.partial=!0}return e&&this.updateLastResult(n),n},v.prototype.isDifferentFromLastResult=function(e){return!s(this.lastResultSnapshot,e)},v.prototype.getLastResult=function(){return this.lastResult},v.prototype.getLastError=function(){return this.lastError},v.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},v.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},v.prototype.refetch=function(e){var t={pollInterval:0},i=this.options.fetchPolicy;return"no-cache"!==i&&"cache-and-network"!==i&&(t.fetchPolicy="network-only",t.nextFetchPolicy=i||"cache-first"),e&&!s(this.options.variables,e)&&(t.variables=this.options.variables=r(r({},this.options.variables),e)),this.newReobserver(!1).reobserve(t,o.refetch)},v.prototype.fetchMore=function(e){var s=this,i=r(r({},e.query?e:r(r(r({},this.options),e),{variables:r(r({},this.options.variables),e.variables)})),{fetchPolicy:"no-cache"}),n=this.queryManager.generateQueryId();return i.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=o.fetchMore,this.observe()),this.queryManager.fetchQuery(n,i,o.fetchMore).then((function(r){var o=r.data,n=e.updateQuery;return n?("production"===process.env.NODE_ENV||p||("production"===process.env.NODE_ENV||t.warn("The updateQuery callback for fetchMore is deprecated, and will be removed\nin the next major version of Apollo Client.\n\nPlease convert updateQuery functions to field policies with appropriate\nread and merge functions, or use/adapt a helper function (such as\nconcatPagination, offsetLimitPagination, or relayStylePagination) from\n@apollo/client/utilities.\n\nThe field policy system handles pagination more effectively than a\nhand-written updateQuery function, and you only need to define the policy\nonce, rather than every time you call fetchMore."),p=!0),s.updateQuery((function(e){return n(e,{fetchMoreResult:o,variables:i.variables})}))):s.queryManager.cache.writeQuery({query:i.query,variables:i.variables,data:o}),r})).finally((function(){s.queryManager.stopQuery(n),s.reobserve()}))},v.prototype.subscribeToMore=function(e){var r=this,s=this.queryManager.startGraphQLSubscription({query:e.document,variables:e.variables,context:e.context}).subscribe({next:function(t){var s=e.updateQuery;s&&r.updateQuery((function(e,r){var o=r.variables;return s(e,{subscriptionData:t,variables:o})}))},error:function(r){e.onError?e.onError(r):"production"===process.env.NODE_ENV||t.error("Unhandled GraphQL subscription error",r)}});return this.subscriptions.add(s),function(){r.subscriptions.delete(s)&&s.unsubscribe()}},v.prototype.setOptions=function(e){return this.reobserve(e)},v.prototype.setVariables=function(e){if(s(this.variables,e))return this.observers.size?this.result():Promise.resolve();if(this.options.variables=e,!this.observers.size)return Promise.resolve();var r=this.options.fetchPolicy,t=void 0===r?"cache-first":r,i={fetchPolicy:t,variables:e};return"cache-first"!==t&&"no-cache"!==t&&"network-only"!==t&&(i.fetchPolicy="cache-and-network",i.nextFetchPolicy=t),this.reobserve(i,o.setVariables)},v.prototype.updateQuery=function(e){var r,t=this.queryManager,s=e(t.cache.diff({query:this.options.query,variables:this.variables,previousResult:null===(r=this.lastResult)||void 0===r?void 0:r.data,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});s&&(t.cache.writeQuery({query:this.options.query,data:s,variables:this.variables}),t.broadcastQueries())},v.prototype.startPolling=function(e){this.getReobserver().updateOptions({pollInterval:e})},v.prototype.stopPolling=function(){this.reobserver&&this.reobserver.updateOptions({pollInterval:0})},v.prototype.updateLastResult=function(e){var r=this.lastResult;return this.lastResult=e,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?e:a(e),l(e.errors)||delete this.lastError,r},v.prototype.onSubscribe=function(e){var r=this;if(e===this.observer)return function(){};try{var t=e._subscription._observer;t&&!t.error&&(t.error=b)}catch(e){}var s=!this.observers.size;return this.observers.add(e),this.lastError?e.error&&e.error(this.lastError):this.lastResult&&e.next&&e.next(this.lastResult),s&&this.reobserve().catch((function(e){})),function(){r.observers.delete(e)&&!r.observers.size&&r.tearDownQuery()}},v.prototype.getReobserver=function(){return this.reobserver||(this.reobserver=this.newReobserver(!0))},v.prototype.newReobserver=function(e){var t=this,s=this.queryManager,o=this.queryId;return s.setObservableQuery(this),new c(this.observer,e?this.options:r({},this.options),(function(e,r){return s.setObservableQuery(t),s.fetchQueryObservable(o,e,r)}),!s.ssrMode&&function(){return!i(t.queryInfo.networkStatus)})},v.prototype.reobserve=function(e,r){return this.isTornDown=!1,this.getReobserver().reobserve(e,r)},v.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},v.prototype.hasObservers=function(){return this.observers.size>0},v.prototype.tearDownQuery=function(){this.isTornDown||(this.reobserver&&(this.reobserver.stop(),delete this.reobserver),delete this.options.context,this.subscriptions.forEach((function(e){return e.unsubscribe()})),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},v}(h);function b(e){"production"===process.env.NODE_ENV||t.error("Unhandled error",e.message,e.stack)}export{v as ObservableQuery};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__assign as r}from"../../../tslib/tslib.es6.js";import{InvariantError as o,invariant as i}from"../../../ts-invariant/lib/invariant.esm.js";import n from"../../../@wry/equality/lib/equality.esm.js";import"../link/core/ApolloLink.js";import{execute as a}from"../link/core/execute.js";import{hasClientExports as s}from"../utilities/graphql/directives.js";import{getOperationName as u,getDefaultValues as c,getOperationDefinition as l}from"../utilities/graphql/getFromAST.js";import{removeConnectionDirectiveFromDocument as h}from"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import{asyncMap as p}from"../utilities/observables/asyncMap.js";import{Concast as f}from"../utilities/observables/Concast.js";import{isNonEmptyArray as y}from"../utilities/common/arrays.js";import{graphQLResultHasError as d}from"../utilities/common/errorHandling.js";import{canUseWeakMap as v}from"../utilities/common/canUse.js";import{ApolloError as m,isApolloError as b}from"../errors/index.js";import{ObservableQuery as g}from"./ObservableQuery.js";import{NetworkStatus as w,isNetworkRequestInFlight as q}from"./networkStatus.js";import{LocalState as Q}from"./LocalState.js";import{shouldWriteResult as k,QueryInfo as E}from"./QueryInfo.js";import O from"../../../zen-observable/index.js";var S=Object.prototype.hasOwnProperty,P=function(){function P(e){var t=e.cache,r=e.link,o=e.queryDeduplication,i=void 0!==o&&o,n=e.onBroadcast,a=e.ssrMode,s=void 0!==a&&a,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,h=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(v?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new Q({cache:t}),this.ssrMode=s,this.assumeImmutableResults=!!h,(this.onBroadcast=n)&&(this.mutationStore=Object.create(null))}return P.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches("production"===process.env.NODE_ENV?new o(12):new o("QueryManager stopped while query was in flight"))},P.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},P.prototype.mutate=function(o){var n=o.mutation,a=o.variables,s=o.optimisticResponse,u=o.updateQueries,c=o.refetchQueries,l=void 0===c?[]:c,h=o.awaitRefetchQueries,p=void 0!==h&&h,f=o.update,v=o.errorPolicy,b=void 0===v?"none":v,g=o.fetchPolicy,w=o.context,q=void 0===w?{}:w;return e(this,void 0,void 0,(function(){var e,o,c;return t(this,(function(t){switch(t.label){case 0:return"production"===process.env.NODE_ENV?i(n,13):i(n,"mutation option is required. You must specify your GraphQL document in the mutation option."),"production"===process.env.NODE_ENV?i(!g||"no-cache"===g,14):i(!g||"no-cache"===g,"Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."),e=this.generateMutationId(),n=this.transform(n).document,a=this.getVariables(n,a),this.transform(n).hasClientExports?[4,this.localState.addExportedVariables(n,a,q)]:[3,2];case 1:a=t.sent(),t.label=2;case 2:return o=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:a,loading:!0,error:null}),s&&this.markMutationOptimistic(s,{mutationId:e,document:n,variables:a,errorPolicy:b,updateQueries:u,update:f}),this.broadcastQueries(),c=this,[2,new Promise((function(t,i){var h,v;c.getObservableFromLink(n,r(r({},q),{optimisticResponse:s}),a,!1).subscribe({next:function(t){if(d(t)&&"none"===b)v=new m({graphQLErrors:t.errors});else{if(o&&(o.loading=!1,o.error=null),"no-cache"!==g)try{c.markMutationResult({mutationId:e,result:t,document:n,variables:a,errorPolicy:b,updateQueries:u,update:f})}catch(e){return void(v=new m({networkError:e}))}h=t}},error:function(t){o&&(o.loading=!1,o.error=t),s&&c.cache.removeOptimistic(e),c.broadcastQueries(),i(new m({networkError:t}))},complete:function(){if(v&&o&&(o.loading=!1,o.error=v),s&&c.cache.removeOptimistic(e),c.broadcastQueries(),v)i(v);else{"function"==typeof l&&(l=l(h));var r=[];y(l)&&l.forEach((function(e){if("string"==typeof e)c.queries.forEach((function(t){var o=t.observableQuery;o&&o.queryName===e&&r.push(o.refetch())}));else{var t={query:e.query,variables:e.variables,fetchPolicy:"network-only"};e.context&&(t.context=e.context),r.push(c.query(t))}})),Promise.all(p?r:[]).then((function(){"ignore"===b&&h&&d(h)&&delete h.errors,t(h)}),i)}}})}))]}}))}))},P.prototype.markMutationResult=function(e,t){var r=this;if(void 0===t&&(t=this.cache),k(e.result,e.errorPolicy)){var o=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],i=e.updateQueries;i&&this.queries.forEach((function(n,a){var s=n.observableQuery,c=s&&s.queryName;if(c&&S.call(i,c)){var l=i[c],h=r.queries.get(a),p=h.document,f=h.variables,y=t.diff({query:p,variables:f,returnPartialData:!0,optimistic:!1}),d=y.result;if(y.complete&&d){var v=l(d,{mutationResult:e.result,queryName:p&&u(p)||void 0,queryVariables:f});v&&o.push({result:v,dataId:"ROOT_QUERY",query:p,variables:f})}}})),t.performTransaction((function(t){o.forEach((function(e){return t.write(e)}));var r=e.update;r&&r(t,e.result)}),null)}},P.prototype.markMutationOptimistic=function(e,t){var o=this,n="function"==typeof e?e(t.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{o.markMutationResult(r(r({},t),{result:{data:n}}),e)}catch(e){"production"===process.env.NODE_ENV||i.error(e)}}),t.mutationId)},P.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},P.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},P.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},P.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var r=this.cache.transformDocument(e),o=h(this.cache.transformForLink(r)),i=this.localState.clientQuery(r),n=o&&this.localState.serverQuery(o),a={document:r,hasClientExports:s(r),hasForcedResolvers:this.localState.shouldForceResolvers(r),clientQuery:i,serverQuery:n,defaultVars:c(l(r))},u=function(e){e&&!t.has(e)&&t.set(e,a)};u(e),u(r),u(i),u(n)}return t.get(e)},P.prototype.getVariables=function(e,t){return r(r({},this.transform(e).defaultVars),t)},P.prototype.watchQuery=function(e){void 0===(e=r(r({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var t=new E(this.cache),o=new g({queryManager:this,queryInfo:t,options:e});return this.queries.set(o.queryId,t),t.init({document:e.query,observableQuery:o,variables:e.variables}),o},P.prototype.query=function(e){var t=this;"production"===process.env.NODE_ENV?i(e.query,15):i(e.query,"query option is required. You must specify your GraphQL document in the query option."),"production"===process.env.NODE_ENV?i("Document"===e.query.kind,16):i("Document"===e.query.kind,'You must wrap the query string in a "gql" tag.'),"production"===process.env.NODE_ENV?i(!e.returnPartialData,17):i(!e.returnPartialData,"returnPartialData option only supported on watchQuery."),"production"===process.env.NODE_ENV?i(!e.pollInterval,18):i(!e.pollInterval,"pollInterval option only supported on watchQuery.");var r=this.generateQueryId();return this.fetchQuery(r,e).finally((function(){return t.stopQuery(r)}))},P.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},P.prototype.generateRequestId=function(){return this.requestIdCounter++},P.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},P.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},P.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},P.prototype.clearStore=function(){return this.cancelPendingFetches("production"===process.env.NODE_ENV?new o(19):new o("Store reset while query was in flight (not completed in link chain)")),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=w.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},P.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},P.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.queries.forEach((function(o,i){var n=o.observableQuery;if(n&&n.hasObservers()){var a=n.options.fetchPolicy;n.resetLastResults(),"cache-only"===a||!e&&"standby"===a||r.push(n.refetch()),t.getQuery(i).setDiff(null)}})),this.broadcastQueries(),Promise.all(r)},P.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},P.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,o=e.fetchPolicy,i=e.errorPolicy,n=e.variables,a=e.context,s=void 0===a?{}:a;r=this.transform(r).document,n=this.getVariables(r,n);var u=function(e){return t.getObservableFromLink(r,s,e,!1).map((function(n){if("no-cache"!==o&&(k(n,i)&&t.cache.write({query:r,result:n.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),d(n))throw new m({graphQLErrors:n.errors});return n}))};if(this.transform(r).hasClientExports){var c=this.localState.addExportedVariables(r,n,s).then(u);return new O((function(e){var t=null;return c.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return u(n)},P.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},P.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},P.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},P.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},P.prototype.getLocalState=function(){return this.localState},P.prototype.getObservableFromLink=function(e,t,o,i){var n,s,c=this;void 0===i&&(i=null!==(n=null==t?void 0:t.queryDeduplication)&&void 0!==n?n:this.queryDeduplication);var l=this.transform(e).serverQuery;if(l){var h=this.inFlightLinkObservables,y=this.link,d={query:l,variables:o,operationName:u(l)||void 0,context:this.prepareContext(r(r({},t),{forceFetch:!i}))};if(t=d.context,i){var v=h.get(l)||new Map;h.set(l,v);var m=JSON.stringify(o);if(!(s=v.get(m))){var b=new f([a(y,d)]);v.set(m,s=b),b.cleanup((function(){v.delete(m)&&v.size<1&&h.delete(l)}))}}else s=new f([a(y,d)])}else s=new f([O.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=p(s,(function(e){return c.localState.runResolvers({document:g,remoteResult:e,context:t,variables:o})}))),s},P.prototype.getResultsFromLink=function(e,t,r){var o=e.lastRequestId;return p(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var n=y(i.errors);if(o>=e.lastRequestId){if(n&&"none"===r.errorPolicy)throw e.markError(new m({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var a={data:i.data,loading:!1,networkStatus:e.networkStatus||w.ready};return n&&"ignore"!==r.errorPolicy&&(a.errors=i.errors),a}),(function(t){var r=b(t)?t:new m({networkError:t});throw o>=e.lastRequestId&&e.markError(r),r}))},P.prototype.fetchQueryObservable=function(e,t,r){var o=this;void 0===r&&(r=w.loading);var i=this.transform(t.query).document,n=this.getVariables(i,t.variables),a=this.getQuery(e),s=a.networkStatus,u=t.fetchPolicy,c=void 0===u?"cache-first":u,l=t.errorPolicy,h=void 0===l?"none":l,p=t.returnPartialData,y=void 0!==p&&p,d=t.notifyOnNetworkStatusChange,v=void 0!==d&&d,m=t.context,b=void 0===m?{}:m;("cache-first"===c||"cache-and-network"===c||"network-only"===c||"no-cache"===c)&&v&&"number"==typeof s&&s!==r&&q(r)&&("cache-first"!==c&&(c="cache-and-network"),y=!0);var g=Object.assign({},t,{query:i,variables:n,fetchPolicy:c,errorPolicy:h,returnPartialData:y,notifyOnNetworkStatusChange:v,context:b}),Q=function(e){return g.variables=e,o.fetchQueryByPolicy(a,g,r)};this.fetchCancelFns.set(e,(function(e){Promise.resolve().then((function(){return k.cancel(e)}))}));var k=new f(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(Q):Q(g.variables));return k.cleanup((function(){o.fetchCancelFns.delete(e);var r=t.nextFetchPolicy;r&&(t.nextFetchPolicy=void 0,t.fetchPolicy="function"==typeof r?r.call(t,t.fetchPolicy||"cache-first"):r)})),k},P.prototype.fetchQueryByPolicy=function(e,t,o){var a=this,s=t.query,u=t.variables,c=t.fetchPolicy,l=t.errorPolicy,h=t.returnPartialData,p=t.context;e.init({document:s,variables:u,lastRequestId:this.generateRequestId(),networkStatus:o});var f=function(){return e.getDiff(u)},d=function(t,o){void 0===o&&(o=e.networkStatus||w.loading);var c=t.result;"production"===process.env.NODE_ENV||!y(t.missing)||n(c,{})||h||"production"===process.env.NODE_ENV||i.warn("Missing cache result fields: "+t.missing.map((function(e){return e.path.join(".")})).join(", "),t.missing);var l=function(e){return O.of(r({data:e,loading:q(o),networkStatus:o},t.complete?null:{partial:!0}))};return a.transform(s).hasForcedResolvers?a.localState.runResolvers({document:s,remoteResult:{data:c},context:p,variables:u,onlyRunForcedResolvers:!0}).then((function(e){return l(e.data)})):l(c)},v=function(t){return a.getResultsFromLink(e,t,{variables:u,context:p,fetchPolicy:c,errorPolicy:l})};switch(c){default:case"cache-first":return(m=f()).complete?[d(m,e.markReady())]:h?[d(m),v(!0)]:[v(!0)];case"cache-and-network":var m;return(m=f()).complete||h?[d(m),v(!0)]:[v(!0)];case"cache-only":return[d(f(),e.markReady())];case"network-only":return[v(!0)];case"no-cache":return[v(!1)];case"standby":return[]}},P.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new E(this.cache)),this.queries.get(e)},P.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return r(r({},t),{clientAwareness:this.clientAwareness})},P}();export{P as QueryManager};
1
+ import{__awaiter as e,__generator as t,__assign as r}from'../ext/tslib/tslib.es6.js';import{InvariantError as o,invariant as i}from"../../../ts-invariant/lib/invariant.esm.js";import n from"../../../@wry/equality/lib/equality.esm.js";import"../link/core/ApolloLink.js";import{execute as a}from"../link/core/execute.js";import{hasClientExports as s}from"../utilities/graphql/directives.js";import{getOperationName as u,getDefaultValues as c,getOperationDefinition as l}from"../utilities/graphql/getFromAST.js";import{removeConnectionDirectiveFromDocument as h}from"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import{asyncMap as p}from"../utilities/observables/asyncMap.js";import{Concast as f}from"../utilities/observables/Concast.js";import{isNonEmptyArray as y}from"../utilities/common/arrays.js";import{graphQLResultHasError as d}from"../utilities/common/errorHandling.js";import{canUseWeakMap as v}from"../utilities/common/canUse.js";import{ApolloError as m,isApolloError as b}from"../errors/index.js";import{ObservableQuery as g}from"./ObservableQuery.js";import{NetworkStatus as w,isNetworkRequestInFlight as q}from"./networkStatus.js";import{LocalState as Q}from"./LocalState.js";import{shouldWriteResult as k,QueryInfo as E}from"./QueryInfo.js";import O from"../../../zen-observable/index.js";var S=Object.prototype.hasOwnProperty,P=function(){function P(e){var t=e.cache,r=e.link,o=e.queryDeduplication,i=void 0!==o&&o,n=e.onBroadcast,a=e.ssrMode,s=void 0!==a&&a,u=e.clientAwareness,c=void 0===u?{}:u,l=e.localState,h=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(v?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=r,this.queryDeduplication=i,this.clientAwareness=c,this.localState=l||new Q({cache:t}),this.ssrMode=s,this.assumeImmutableResults=!!h,(this.onBroadcast=n)&&(this.mutationStore=Object.create(null))}return P.prototype.stop=function(){var e=this;this.queries.forEach((function(t,r){e.stopQueryNoBroadcast(r)})),this.cancelPendingFetches("production"===process.env.NODE_ENV?new o(12):new o("QueryManager stopped while query was in flight"))},P.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach((function(t){return t(e)})),this.fetchCancelFns.clear()},P.prototype.mutate=function(o){var n=o.mutation,a=o.variables,s=o.optimisticResponse,u=o.updateQueries,c=o.refetchQueries,l=void 0===c?[]:c,h=o.awaitRefetchQueries,p=void 0!==h&&h,f=o.update,v=o.errorPolicy,b=void 0===v?"none":v,g=o.fetchPolicy,w=o.context,q=void 0===w?{}:w;return e(this,void 0,void 0,(function(){var e,o,c;return t(this,(function(t){switch(t.label){case 0:return"production"===process.env.NODE_ENV?i(n,13):i(n,"mutation option is required. You must specify your GraphQL document in the mutation option."),"production"===process.env.NODE_ENV?i(!g||"no-cache"===g,14):i(!g||"no-cache"===g,"Mutations only support a 'no-cache' fetchPolicy. If you don't want to disable the cache, remove your fetchPolicy setting to proceed with the default mutation behavior."),e=this.generateMutationId(),n=this.transform(n).document,a=this.getVariables(n,a),this.transform(n).hasClientExports?[4,this.localState.addExportedVariables(n,a,q)]:[3,2];case 1:a=t.sent(),t.label=2;case 2:return o=this.mutationStore&&(this.mutationStore[e]={mutation:n,variables:a,loading:!0,error:null}),s&&this.markMutationOptimistic(s,{mutationId:e,document:n,variables:a,errorPolicy:b,updateQueries:u,update:f}),this.broadcastQueries(),c=this,[2,new Promise((function(t,i){var h,v;c.getObservableFromLink(n,r(r({},q),{optimisticResponse:s}),a,!1).subscribe({next:function(t){if(d(t)&&"none"===b)v=new m({graphQLErrors:t.errors});else{if(o&&(o.loading=!1,o.error=null),"no-cache"!==g)try{c.markMutationResult({mutationId:e,result:t,document:n,variables:a,errorPolicy:b,updateQueries:u,update:f})}catch(e){return void(v=new m({networkError:e}))}h=t}},error:function(t){o&&(o.loading=!1,o.error=t),s&&c.cache.removeOptimistic(e),c.broadcastQueries(),i(new m({networkError:t}))},complete:function(){if(v&&o&&(o.loading=!1,o.error=v),s&&c.cache.removeOptimistic(e),c.broadcastQueries(),v)i(v);else{"function"==typeof l&&(l=l(h));var r=[];y(l)&&l.forEach((function(e){if("string"==typeof e)c.queries.forEach((function(t){var o=t.observableQuery;o&&o.queryName===e&&r.push(o.refetch())}));else{var t={query:e.query,variables:e.variables,fetchPolicy:"network-only"};e.context&&(t.context=e.context),r.push(c.query(t))}})),Promise.all(p?r:[]).then((function(){"ignore"===b&&h&&d(h)&&delete h.errors,t(h)}),i)}}})}))]}}))}))},P.prototype.markMutationResult=function(e,t){var r=this;if(void 0===t&&(t=this.cache),k(e.result,e.errorPolicy)){var o=[{result:e.result.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}],i=e.updateQueries;i&&this.queries.forEach((function(n,a){var s=n.observableQuery,c=s&&s.queryName;if(c&&S.call(i,c)){var l=i[c],h=r.queries.get(a),p=h.document,f=h.variables,y=t.diff({query:p,variables:f,returnPartialData:!0,optimistic:!1}),d=y.result;if(y.complete&&d){var v=l(d,{mutationResult:e.result,queryName:p&&u(p)||void 0,queryVariables:f});v&&o.push({result:v,dataId:"ROOT_QUERY",query:p,variables:f})}}})),t.performTransaction((function(t){o.forEach((function(e){return t.write(e)}));var r=e.update;r&&r(t,e.result)}),null)}},P.prototype.markMutationOptimistic=function(e,t){var o=this,n="function"==typeof e?e(t.variables):e;return this.cache.recordOptimisticTransaction((function(e){try{o.markMutationResult(r(r({},t),{result:{data:n}}),e)}catch(e){"production"===process.env.NODE_ENV||i.error(e)}}),t.mutationId)},P.prototype.fetchQuery=function(e,t,r){return this.fetchQueryObservable(e,t,r).promise},P.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach((function(t,r){e[r]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}})),e},P.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},P.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var r=this.cache.transformDocument(e),o=h(this.cache.transformForLink(r)),i=this.localState.clientQuery(r),n=o&&this.localState.serverQuery(o),a={document:r,hasClientExports:s(r),hasForcedResolvers:this.localState.shouldForceResolvers(r),clientQuery:i,serverQuery:n,defaultVars:c(l(r))},u=function(e){e&&!t.has(e)&&t.set(e,a)};u(e),u(r),u(i),u(n)}return t.get(e)},P.prototype.getVariables=function(e,t){return r(r({},this.transform(e).defaultVars),t)},P.prototype.watchQuery=function(e){void 0===(e=r(r({},e),{variables:this.getVariables(e.query,e.variables)})).notifyOnNetworkStatusChange&&(e.notifyOnNetworkStatusChange=!1);var t=new E(this.cache),o=new g({queryManager:this,queryInfo:t,options:e});return this.queries.set(o.queryId,t),t.init({document:e.query,observableQuery:o,variables:e.variables}),o},P.prototype.query=function(e){var t=this;"production"===process.env.NODE_ENV?i(e.query,15):i(e.query,"query option is required. You must specify your GraphQL document in the query option."),"production"===process.env.NODE_ENV?i("Document"===e.query.kind,16):i("Document"===e.query.kind,'You must wrap the query string in a "gql" tag.'),"production"===process.env.NODE_ENV?i(!e.returnPartialData,17):i(!e.returnPartialData,"returnPartialData option only supported on watchQuery."),"production"===process.env.NODE_ENV?i(!e.pollInterval,18):i(!e.pollInterval,"pollInterval option only supported on watchQuery.");var r=this.generateQueryId();return this.fetchQuery(r,e).finally((function(){return t.stopQuery(r)}))},P.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},P.prototype.generateRequestId=function(){return this.requestIdCounter++},P.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},P.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},P.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},P.prototype.clearStore=function(){return this.cancelPendingFetches("production"===process.env.NODE_ENV?new o(19):new o("Store reset while query was in flight (not completed in link chain)")),this.queries.forEach((function(e){e.observableQuery?e.networkStatus=w.loading:e.stop()})),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset()},P.prototype.resetStore=function(){var e=this;return this.clearStore().then((function(){return e.reFetchObservableQueries()}))},P.prototype.reFetchObservableQueries=function(e){var t=this;void 0===e&&(e=!1);var r=[];return this.queries.forEach((function(o,i){var n=o.observableQuery;if(n&&n.hasObservers()){var a=n.options.fetchPolicy;n.resetLastResults(),"cache-only"===a||!e&&"standby"===a||r.push(n.refetch()),t.getQuery(i).setDiff(null)}})),this.broadcastQueries(),Promise.all(r)},P.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},P.prototype.startGraphQLSubscription=function(e){var t=this,r=e.query,o=e.fetchPolicy,i=e.errorPolicy,n=e.variables,a=e.context,s=void 0===a?{}:a;r=this.transform(r).document,n=this.getVariables(r,n);var u=function(e){return t.getObservableFromLink(r,s,e,!1).map((function(n){if("no-cache"!==o&&(k(n,i)&&t.cache.write({query:r,result:n.data,dataId:"ROOT_SUBSCRIPTION",variables:e}),t.broadcastQueries()),d(n))throw new m({graphQLErrors:n.errors});return n}))};if(this.transform(r).hasClientExports){var c=this.localState.addExportedVariables(r,n,s).then(u);return new O((function(e){var t=null;return c.then((function(r){return t=r.subscribe(e)}),e.error),function(){return t&&t.unsubscribe()}}))}return u(n)},P.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},P.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},P.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.getQuery(e).stop(),this.queries.delete(e)},P.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach((function(e){return e.notify()}))},P.prototype.getLocalState=function(){return this.localState},P.prototype.getObservableFromLink=function(e,t,o,i){var n,s,c=this;void 0===i&&(i=null!==(n=null==t?void 0:t.queryDeduplication)&&void 0!==n?n:this.queryDeduplication);var l=this.transform(e).serverQuery;if(l){var h=this.inFlightLinkObservables,y=this.link,d={query:l,variables:o,operationName:u(l)||void 0,context:this.prepareContext(r(r({},t),{forceFetch:!i}))};if(t=d.context,i){var v=h.get(l)||new Map;h.set(l,v);var m=JSON.stringify(o);if(!(s=v.get(m))){var b=new f([a(y,d)]);v.set(m,s=b),b.cleanup((function(){v.delete(m)&&v.size<1&&h.delete(l)}))}}else s=new f([a(y,d)])}else s=new f([O.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=p(s,(function(e){return c.localState.runResolvers({document:g,remoteResult:e,context:t,variables:o})}))),s},P.prototype.getResultsFromLink=function(e,t,r){var o=e.lastRequestId;return p(this.getObservableFromLink(e.document,r.context,r.variables),(function(i){var n=y(i.errors);if(o>=e.lastRequestId){if(n&&"none"===r.errorPolicy)throw e.markError(new m({graphQLErrors:i.errors}));e.markResult(i,r,t),e.markReady()}var a={data:i.data,loading:!1,networkStatus:e.networkStatus||w.ready};return n&&"ignore"!==r.errorPolicy&&(a.errors=i.errors),a}),(function(t){var r=b(t)?t:new m({networkError:t});throw o>=e.lastRequestId&&e.markError(r),r}))},P.prototype.fetchQueryObservable=function(e,t,r){var o=this;void 0===r&&(r=w.loading);var i=this.transform(t.query).document,n=this.getVariables(i,t.variables),a=this.getQuery(e),s=a.networkStatus,u=t.fetchPolicy,c=void 0===u?"cache-first":u,l=t.errorPolicy,h=void 0===l?"none":l,p=t.returnPartialData,y=void 0!==p&&p,d=t.notifyOnNetworkStatusChange,v=void 0!==d&&d,m=t.context,b=void 0===m?{}:m;("cache-first"===c||"cache-and-network"===c||"network-only"===c||"no-cache"===c)&&v&&"number"==typeof s&&s!==r&&q(r)&&("cache-first"!==c&&(c="cache-and-network"),y=!0);var g=Object.assign({},t,{query:i,variables:n,fetchPolicy:c,errorPolicy:h,returnPartialData:y,notifyOnNetworkStatusChange:v,context:b}),Q=function(e){return g.variables=e,o.fetchQueryByPolicy(a,g,r)};this.fetchCancelFns.set(e,(function(e){Promise.resolve().then((function(){return k.cancel(e)}))}));var k=new f(this.transform(g.query).hasClientExports?this.localState.addExportedVariables(g.query,g.variables,g.context).then(Q):Q(g.variables));return k.cleanup((function(){o.fetchCancelFns.delete(e);var r=t.nextFetchPolicy;r&&(t.nextFetchPolicy=void 0,t.fetchPolicy="function"==typeof r?r.call(t,t.fetchPolicy||"cache-first"):r)})),k},P.prototype.fetchQueryByPolicy=function(e,t,o){var a=this,s=t.query,u=t.variables,c=t.fetchPolicy,l=t.errorPolicy,h=t.returnPartialData,p=t.context;e.init({document:s,variables:u,lastRequestId:this.generateRequestId(),networkStatus:o});var f=function(){return e.getDiff(u)},d=function(t,o){void 0===o&&(o=e.networkStatus||w.loading);var c=t.result;"production"===process.env.NODE_ENV||!y(t.missing)||n(c,{})||h||"production"===process.env.NODE_ENV||i.warn("Missing cache result fields: "+t.missing.map((function(e){return e.path.join(".")})).join(", "),t.missing);var l=function(e){return O.of(r({data:e,loading:q(o),networkStatus:o},t.complete?null:{partial:!0}))};return a.transform(s).hasForcedResolvers?a.localState.runResolvers({document:s,remoteResult:{data:c},context:p,variables:u,onlyRunForcedResolvers:!0}).then((function(e){return l(e.data)})):l(c)},v=function(t){return a.getResultsFromLink(e,t,{variables:u,context:p,fetchPolicy:c,errorPolicy:l})};switch(c){default:case"cache-first":return(m=f()).complete?[d(m,e.markReady())]:h?[d(m),v(!0)]:[v(!0)];case"cache-and-network":var m;return(m=f()).complete||h?[d(m),v(!0)]:[v(!0)];case"cache-only":return[d(f(),e.markReady())];case"network-only":return[v(!0)];case"no-cache":return[v(!1)];case"standby":return[]}},P.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new E(this.cache)),this.queries.get(e)},P.prototype.prepareContext=function(e){void 0===e&&(e={});var t=this.localState.prepareContext(e);return r(r({},t),{clientAwareness:this.clientAwareness})},P}();export{P as QueryManager};
@@ -1 +1 @@
1
- import{__extends as r}from"../../../tslib/tslib.es6.js";import"../../../ts-invariant/lib/invariant.esm.js";import"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import"../utilities/observables/Concast.js";import{isNonEmptyArray as o}from"../utilities/common/arrays.js";function t(r){return r.hasOwnProperty("graphQLErrors")}var s=function(t){function s(r){var e,i,n=r.graphQLErrors,a=r.networkError,m=r.errorMessage,p=r.extraInfo,l=t.call(this,m)||this;return l.graphQLErrors=n||[],l.networkError=a||null,l.message=m||(i="",o((e=l).graphQLErrors)&&e.graphQLErrors.forEach((function(r){var o=r?r.message:"Error message not found.";i+=o+"\n"})),e.networkError&&(i+=e.networkError.message+"\n"),i=i.replace(/\n$/,"")),l.extraInfo=p,l.__proto__=s.prototype,l}return r(s,t),s}(Error);export{s as ApolloError,t as isApolloError};
1
+ import{__extends as r}from'../ext/tslib/tslib.es6.js';import"../../../ts-invariant/lib/invariant.esm.js";import"../utilities/graphql/transform.js";import"../utilities/common/mergeDeep.js";import"../utilities/observables/Observable.js";import"../utilities/observables/Concast.js";import{isNonEmptyArray as o}from"../utilities/common/arrays.js";function t(r){return r.hasOwnProperty("graphQLErrors")}var e=function(t){function e(r){var s,i,n=r.graphQLErrors,a=r.networkError,m=r.errorMessage,p=r.extraInfo,l=t.call(this,m)||this;return l.graphQLErrors=n||[],l.networkError=a||null,l.message=m||(i="",o((s=l).graphQLErrors)&&s.graphQLErrors.forEach((function(r){var o=r?r.message:"Error message not found.";i+=o+"\n"})),s.networkError&&(i+=s.networkError.message+"\n"),i=i.replace(/\n$/,"")),l.extraInfo=p,l.__proto__=e.prototype,l}return r(e,t),e}(Error);export{e as ApolloError,t as isApolloError};
@@ -0,0 +1,15 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+ var t=function(n,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])},t(n,r)};function n(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var r=function(){return r=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t},r.apply(this,arguments)};function e(t,n){var r={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.indexOf(e)<0&&(r[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(e=Object.getOwnPropertySymbols(t);o<e.length;o++)n.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(r[e[o]]=t[e[o]])}return r}function o(t,n,r,e){return new(r||(r=Promise))((function(o,a){function c(t){try{l(e.next(t))}catch(t){a(t)}}function u(t){try{l(e.throw(t))}catch(t){a(t)}}function l(t){var n;t.done?o(t.value):(n=t.value,n instanceof r?n:new r((function(t){t(n)}))).then(c,u)}l((e=e.apply(t,n||[])).next())}))}function a(t,n){var r,e,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,e&&(o=2&a[0]?e.return:a[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,a[1])).done)return o;switch(e=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,e=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=n.call(t,c)}catch(t){a=[6,t],e=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function c(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var e=Array(t),o=0;for(n=0;n<r;n++)for(var a=arguments[n],c=0,u=a.length;c<u;c++,o++)e[o]=a[c];return e}export{r as __assign,o as __awaiter,n as __extends,a as __generator,e as __rest,c as __spreadArrays};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../tslib/tslib.es6.js";import{ApolloLink as t}from"../core/ApolloLink.js";import"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import r from"../../../../zen-observable/index.js";function i(i){return new t((function(t,n){var o=e(t,[]);return new r((function(e){var r;return Promise.resolve(o).then((function(e){return i(e,t.getContext())})).then(t.setContext).then((function(){r=n(t).subscribe({next:e.next.bind(e),error:e.error.bind(e),complete:e.complete.bind(e)})})).catch(e.error.bind(e)),function(){r&&r.unsubscribe()}}))}))}export{i as setContext};
1
+ import{__rest as e}from'../../ext/tslib/tslib.es6.js';import{ApolloLink as t}from"../core/ApolloLink.js";import"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import r from"../../../../zen-observable/index.js";function i(i){return new t((function(t,n){var o=e(t,[]);return new r((function(e){var r;return Promise.resolve(o).then((function(e){return i(e,t.getContext())})).then(t.setContext).then((function(){r=n(t).subscribe({next:e.next.bind(e),error:e.error.bind(e),complete:e.complete.bind(e)})})).catch(e.error.bind(e)),function(){r&&r.unsubscribe()}}))}))}export{i as setContext};
@@ -1 +1 @@
1
- import{__extends as t}from"../../../../tslib/tslib.es6.js";import{InvariantError as r,invariant as n}from"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import{validateOperation as e}from"../utils/validateOperation.js";import{createOperation as o}from"../utils/createOperation.js";import{transformOperation as i}from"../utils/transformOperation.js";import u from"../../../../zen-observable/index.js";function s(t,r){return r?r(t):u.of()}function c(t){return"function"==typeof t?new a(t):t}function f(t){return t.request.length<=1}var p=function(r){function n(t,n){var e=r.call(this,t)||this;return e.link=n,e}return t(n,r),n}(Error),a=function(){function t(t){t&&(this.request=t)}return t.empty=function(){return new t((function(){return u.of()}))},t.from=function(r){return 0===r.length?t.empty():r.map(c).reduce((function(t,r){return t.concat(r)}))},t.split=function(r,n,e){var o=c(n),i=c(e||new t(s));return f(o)&&f(i)?new t((function(t){return r(t)?o.request(t)||u.of():i.request(t)||u.of()})):new t((function(t,n){return r(t)?o.request(t,n)||u.of():i.request(t,n)||u.of()}))},t.execute=function(t,r){return t.request(o(r.context,i(e(r))))||u.of()},t.concat=function(r,e){var o=c(r);if(f(o))return"production"===process.env.NODE_ENV||n.warn(new p("You are calling concat on a terminating link, which will have no effect",o)),o;var i=c(e);return f(i)?new t((function(t){return o.request(t,(function(t){return i.request(t)||u.of()}))||u.of()})):new t((function(t,r){return o.request(t,(function(t){return i.request(t,r)||u.of()}))||u.of()}))},t.prototype.split=function(r,n,e){return this.concat(t.split(r,n,e||new t(s)))},t.prototype.concat=function(r){return t.concat(this,r)},t.prototype.request=function(t,n){throw"production"===process.env.NODE_ENV?new r(21):new r("request is not implemented")},t.prototype.onError=function(t,r){if(r&&r.error)return r.error(t),!1;throw t},t.prototype.setOnError=function(t){return this.onError=t,this},t}();export{a as ApolloLink};
1
+ import{__extends as t}from'../../ext/tslib/tslib.es6.js';import{InvariantError as r,invariant as n}from"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import{validateOperation as e}from"../utils/validateOperation.js";import{createOperation as o}from"../utils/createOperation.js";import{transformOperation as i}from"../utils/transformOperation.js";import u from"../../../../zen-observable/index.js";function s(t,r){return r?r(t):u.of()}function c(t){return"function"==typeof t?new a(t):t}function f(t){return t.request.length<=1}var p=function(r){function n(t,n){var e=r.call(this,t)||this;return e.link=n,e}return t(n,r),n}(Error),a=function(){function t(t){t&&(this.request=t)}return t.empty=function(){return new t((function(){return u.of()}))},t.from=function(r){return 0===r.length?t.empty():r.map(c).reduce((function(t,r){return t.concat(r)}))},t.split=function(r,n,e){var o=c(n),i=c(e||new t(s));return f(o)&&f(i)?new t((function(t){return r(t)?o.request(t)||u.of():i.request(t)||u.of()})):new t((function(t,n){return r(t)?o.request(t,n)||u.of():i.request(t,n)||u.of()}))},t.execute=function(t,r){return t.request(o(r.context,i(e(r))))||u.of()},t.concat=function(r,e){var o=c(r);if(f(o))return"production"===process.env.NODE_ENV||n.warn(new p("You are calling concat on a terminating link, which will have no effect",o)),o;var i=c(e);return f(i)?new t((function(t){return o.request(t,(function(t){return i.request(t)||u.of()}))||u.of()})):new t((function(t,r){return o.request(t,(function(t){return i.request(t,r)||u.of()}))||u.of()}))},t.prototype.split=function(r,n,e){return this.concat(t.split(r,n,e||new t(s)))},t.prototype.concat=function(r){return t.concat(this,r)},t.prototype.request=function(t,n){throw"production"===process.env.NODE_ENV?new r(21):new r("request is not implemented")},t.prototype.onError=function(t,r){if(r&&r.error)return r.error(t),!1;throw t},t.prototype.setOnError=function(t){return this.onError=t,this},t}();export{a as ApolloLink};
@@ -1 +1 @@
1
- import{__extends as r}from"../../../../tslib/tslib.es6.js";import{ApolloLink as e}from"../core/ApolloLink.js";import"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import t from"../../../../zen-observable/index.js";function o(r){return new e((function(e,o){return new t((function(t){var n,i,s;try{n=o(e).subscribe({next:function(n){n.errors&&(s=r({graphQLErrors:n.errors,response:n,operation:e,forward:o}))?i=s.subscribe({next:t.next.bind(t),error:t.error.bind(t),complete:t.complete.bind(t)}):t.next(n)},error:function(n){(s=r({operation:e,networkError:n,graphQLErrors:n&&n.result&&n.result.errors,forward:o}))?i=s.subscribe({next:t.next.bind(t),error:t.error.bind(t),complete:t.complete.bind(t)}):t.error(n)},complete:function(){s||t.complete.bind(t)()}})}catch(n){r({networkError:n,operation:e,forward:o}),t.error(n)}return function(){n&&n.unsubscribe(),i&&n.unsubscribe()}}))}))}!function(e){function t(r){var t=e.call(this)||this;return t.link=o(r),t}r(t,e),t.prototype.request=function(r,e){return this.link.request(r,e)}}(e);export{o as onError};
1
+ import{__extends as r}from'../../ext/tslib/tslib.es6.js';import{ApolloLink as e}from"../core/ApolloLink.js";import"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import o from"../../../../zen-observable/index.js";function t(r){return new e((function(e,t){return new o((function(o){var n,i,s;try{n=t(e).subscribe({next:function(n){n.errors&&(s=r({graphQLErrors:n.errors,response:n,operation:e,forward:t}))?i=s.subscribe({next:o.next.bind(o),error:o.error.bind(o),complete:o.complete.bind(o)}):o.next(n)},error:function(n){(s=r({operation:e,networkError:n,graphQLErrors:n&&n.result&&n.result.errors,forward:t}))?i=s.subscribe({next:o.next.bind(o),error:o.error.bind(o),complete:o.complete.bind(o)}):o.error(n)},complete:function(){s||o.complete.bind(o)()}})}catch(n){r({networkError:n,operation:e,forward:t}),o.error(n)}return function(){n&&n.unsubscribe(),i&&n.unsubscribe()}}))}))}!function(e){function o(r){var o=e.call(this)||this;return o.link=t(r),o}r(o,e),o.prototype.request=function(r,e){return this.link.request(r,e)}}(e);export{t as onError};
@@ -1 +1 @@
1
- import{__extends as t}from"../../../../tslib/tslib.es6.js";import{ApolloLink as r}from"../core/ApolloLink.js";import{createHttpLink as o}from"./createHttpLink.js";var i=function(r){function i(t){void 0===t&&(t={});var i=r.call(this,o(t).request)||this;return i.options=t,i}return t(i,r),i}(r);export{i as HttpLink};
1
+ import{__extends as o}from'../../ext/tslib/tslib.es6.js';import{ApolloLink as t}from"../core/ApolloLink.js";import{createHttpLink as r}from"./createHttpLink.js";var i=function(t){function i(o){void 0===o&&(o={});var i=t.call(this,r(o).request)||this;return i.options=o,i}return o(i,t),i}(t);export{i as HttpLink};
@@ -1 +1 @@
1
- import{__rest as e,__assign as r}from"../../../../tslib/tslib.es6.js";import{visit as t}from"../../../../graphql/language/visitor.mjs.js";import{ApolloLink as i}from"../core/ApolloLink.js";import"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import{serializeFetchParameter as o}from"./serializeFetchParameter.js";import{selectURI as n}from"./selectURI.js";import{parseAndCheckHttpResponse as s}from"./parseAndCheckHttpResponse.js";import{checkFetcher as a}from"./checkFetcher.js";import{selectHttpOptionsAndBody as l,fallbackHttpConfig as c}from"./selectHttpOptionsAndBody.js";import{createSignalIfSupported as p}from"./createSignalIfSupported.js";import{rewriteURIForGET as m}from"./rewriteURIForGET.js";import{fromError as u}from"../utils/fromError.js";import f from"../../../../zen-observable/index.js";var d=function(d){void 0===d&&(d={});var h=d.uri,v=void 0===h?"/graphql":h,b=d.fetch,j=d.includeExtensions,g=d.useGETForQueries,E=d.includeUnusedVariables,x=void 0!==E&&E,y=e(d,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);a(b),b||(b=fetch);var q={http:{includeExtensions:j},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new i((function(e){var i=n(e,v),a=e.getContext(),d={};if(a.clientAwareness){var h=a.clientAwareness,j=h.name,E=h.version;j&&(d["apollographql-client-name"]=j),E&&(d["apollographql-client-version"]=E)}var y,w=r(r({},d),a.headers),k={http:a.http,options:a.fetchOptions,credentials:a.credentials,headers:w},A=l(e,c,q,k),O=A.options,F=A.body;if(F.variables&&!x){var G=new Set(Object.keys(F.variables));t(e.query,{Variable:function(e,r,t){t&&"VariableDefinition"!==t.kind&&G.delete(e.name.value)}}),G.size&&(F.variables=r({},F.variables),G.forEach((function(e){delete F.variables[e]})))}if(!O.signal){var T=p(),U=T.controller,C=T.signal;(y=U)&&(O.signal=C)}if(g&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(O.method="GET"),"GET"===O.method){var I=m(i,F),R=I.newURI,V=I.parseError;if(V)return u(V);i=R}else try{O.body=o(F,"Payload")}catch(V){return u(V)}return new f((function(r){return b(i,O).then((function(r){return e.setContext({response:r}),r})).then(s(e)).then((function(e){return r.next(e),r.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&r.next(e.result),r.error(e))})),function(){y&&y.abort()}}))}))};export{d as createHttpLink};
1
+ import{__rest as e,__assign as r}from'../../ext/tslib/tslib.es6.js';import{visit as t}from"../../../../graphql/language/visitor.mjs.js";import{ApolloLink as i}from"../core/ApolloLink.js";import"../../../../ts-invariant/lib/invariant.esm.js";import"../../utilities/graphql/transform.js";import"../../utilities/common/mergeDeep.js";import"../../utilities/observables/Observable.js";import"../../utilities/observables/Concast.js";import{serializeFetchParameter as o}from"./serializeFetchParameter.js";import{selectURI as n}from"./selectURI.js";import{parseAndCheckHttpResponse as s}from"./parseAndCheckHttpResponse.js";import{checkFetcher as a}from"./checkFetcher.js";import{selectHttpOptionsAndBody as l,fallbackHttpConfig as c}from"./selectHttpOptionsAndBody.js";import{createSignalIfSupported as m}from"./createSignalIfSupported.js";import{rewriteURIForGET as p}from"./rewriteURIForGET.js";import{fromError as u}from"../utils/fromError.js";import f from"../../../../zen-observable/index.js";var d=function(d){void 0===d&&(d={});var h=d.uri,v=void 0===h?"/graphql":h,b=d.fetch,j=d.includeExtensions,g=d.useGETForQueries,E=d.includeUnusedVariables,x=void 0!==E&&E,y=e(d,["uri","fetch","includeExtensions","useGETForQueries","includeUnusedVariables"]);a(b),b||(b=fetch);var q={http:{includeExtensions:j},options:y.fetchOptions,credentials:y.credentials,headers:y.headers};return new i((function(e){var i=n(e,v),a=e.getContext(),d={};if(a.clientAwareness){var h=a.clientAwareness,j=h.name,E=h.version;j&&(d["apollographql-client-name"]=j),E&&(d["apollographql-client-version"]=E)}var y,w=r(r({},d),a.headers),k={http:a.http,options:a.fetchOptions,credentials:a.credentials,headers:w},A=l(e,c,q,k),O=A.options,F=A.body;if(F.variables&&!x){var G=new Set(Object.keys(F.variables));t(e.query,{Variable:function(e,r,t){t&&"VariableDefinition"!==t.kind&&G.delete(e.name.value)}}),G.size&&(F.variables=r({},F.variables),G.forEach((function(e){delete F.variables[e]})))}if(!O.signal){var T=m(),U=T.controller,C=T.signal;(y=U)&&(O.signal=C)}if(g&&!e.query.definitions.some((function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation}))&&(O.method="GET"),"GET"===O.method){var I=p(i,F),R=I.newURI,V=I.parseError;if(V)return u(V);i=R}else try{O.body=o(F,"Payload")}catch(V){return u(V)}return new f((function(r){return b(i,O).then((function(r){return e.setContext({response:r}),r})).then(s(e)).then((function(e){return r.next(e),r.complete(),e})).catch((function(e){"AbortError"!==e.name&&(e.result&&e.result.errors&&e.result.data&&r.next(e.result),r.error(e))})),function(){y&&y.abort()}}))}))};export{d as createHttpLink};
@@ -1 +1 @@
1
- import{__assign as e}from"../../../../tslib/tslib.es6.js";import{print as t}from"../../../../graphql/language/printer.mjs.js";var n={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},r=function(n,r){for(var s=[],a=2;a<arguments.length;a++)s[a-2]=arguments[a];var i=e(e({},r.options),{headers:r.headers,credentials:r.credentials}),o=r.http||{};s.forEach((function(t){i=e(e(e({},i),t.options),{headers:e(e({},i.headers),t.headers)}),t.credentials&&(i.credentials=t.credentials),o=e(e({},o),t.http)}));var p=n.operationName,d=n.extensions,l=n.variables,c=n.query,h={operationName:p,variables:l};return o.includeExtensions&&(h.extensions=d),o.includeQuery&&(h.query=t(c)),{options:i,body:h}};export{n as fallbackHttpConfig,r as selectHttpOptionsAndBody};
1
+ import{__assign as e}from'../../ext/tslib/tslib.es6.js';import{print as t}from"../../../../graphql/language/printer.mjs.js";var n={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},r=function(n,r){for(var s=[],o=2;o<arguments.length;o++)s[o-2]=arguments[o];var a=e(e({},r.options),{headers:r.headers,credentials:r.credentials}),i=r.http||{};s.forEach((function(t){a=e(e(e({},a),t.options),{headers:e(e({},a.headers),t.headers)}),t.credentials&&(a.credentials=t.credentials),i=e(e({},i),t.http)}));var d=n.operationName,l=n.extensions,p=n.variables,c=n.query,h={operationName:d,variables:p};return i.includeExtensions&&(h.extensions=l),i.includeQuery&&(h.query=t(c)),{options:a,body:h}};export{n as fallbackHttpConfig,r as selectHttpOptionsAndBody};
@@ -1 +1 @@
1
- import{__assign as e}from"../../../../tslib/tslib.es6.js";function t(t,n){var r=e({},t);return Object.defineProperty(n,"setContext",{enumerable:!1,value:function(t){r=e(e({},r),"function"==typeof t?t(r):t)}}),Object.defineProperty(n,"getContext",{enumerable:!1,value:function(){return e({},r)}}),n}export{t as createOperation};
1
+ import{__assign as e}from'../../ext/tslib/tslib.es6.js';function t(t,n){var o=e({},t);return Object.defineProperty(n,"setContext",{enumerable:!1,value:function(t){o=e(e({},o),"function"==typeof t?t(o):t)}}),Object.defineProperty(n,"getContext",{enumerable:!1,value:function(){return e({},o)}}),n}export{t as createOperation};
@@ -1 +1 @@
1
- import{__spreadArrays as r,__assign as t}from"../../../../tslib/tslib.es6.js";var e=Object.prototype.hasOwnProperty;function o(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return n(r)}function n(r){var t=r[0]||{},e=r.length;if(e>1)for(var o=new p,n=1;n<e;++n)t=o.merge(t,r[n]);return t}function i(r){return null!==r&&"object"==typeof r}var s=function(r,t,e){return this.merge(r[e],t[e])},p=function(){function o(r){void 0===r&&(r=s),this.reconciler=r,this.isObject=i,this.pastCopies=new Set}return o.prototype.merge=function(t,o){for(var n=this,s=[],p=2;p<arguments.length;p++)s[p-2]=arguments[p];return i(o)&&i(t)?(Object.keys(o).forEach((function(i){if(e.call(t,i)){var p=t[i];if(o[i]!==p){var a=n.reconciler.apply(n,r([t,o,i],s));a!==p&&((t=n.shallowCopyForMerge(t))[i]=a)}}else(t=n.shallowCopyForMerge(t))[i]=o[i]})),t):o},o.prototype.shallowCopyForMerge=function(r){return i(r)&&!this.pastCopies.has(r)&&(r=Array.isArray(r)?r.slice(0):t({__proto__:Object.getPrototypeOf(r)},r),this.pastCopies.add(r)),r},o}();export{p as DeepMerger,o as mergeDeep,n as mergeDeepArray};
1
+ import{__spreadArrays as r,__assign as e}from'../../ext/tslib/tslib.es6.js';var t=Object.prototype.hasOwnProperty;function o(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return n(r)}function n(r){var e=r[0]||{},t=r.length;if(t>1)for(var o=new p,n=1;n<t;++n)e=o.merge(e,r[n]);return e}function i(r){return null!==r&&"object"==typeof r}var s=function(r,e,t){return this.merge(r[t],e[t])},p=function(){function o(r){void 0===r&&(r=s),this.reconciler=r,this.isObject=i,this.pastCopies=new Set}return o.prototype.merge=function(e,o){for(var n=this,s=[],p=2;p<arguments.length;p++)s[p-2]=arguments[p];return i(o)&&i(e)?(Object.keys(o).forEach((function(i){if(t.call(e,i)){var p=e[i];if(o[i]!==p){var a=n.reconciler.apply(n,r([e,o,i],s));a!==p&&((e=n.shallowCopyForMerge(e))[i]=a)}}else(e=n.shallowCopyForMerge(e))[i]=o[i]})),e):o},o.prototype.shallowCopyForMerge=function(r){return i(r)&&!this.pastCopies.has(r)&&(r=Array.isArray(r)?r.slice(0):e({__proto__:Object.getPrototypeOf(r)},r),this.pastCopies.add(r)),r},o}();export{p as DeepMerger,o as mergeDeep,n as mergeDeepArray};
@@ -1 +1 @@
1
- import{__assign as n,__spreadArrays as e}from"../../../../tslib/tslib.es6.js";import{InvariantError as i,invariant as t}from"../../../../ts-invariant/lib/invariant.esm.js";function a(a,r){var o=r,s=[];return a.definitions.forEach((function(n){if("OperationDefinition"===n.kind)throw"production"===process.env.NODE_ENV?new i(42):new i("Found a "+n.operation+" operation"+(n.name?" named '"+n.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===n.kind&&s.push(n)})),void 0===o&&("production"===process.env.NODE_ENV?t(1===s.length,43):t(1===s.length,"Found "+s.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),o=s[0].name.value),n(n({},a),{definitions:e([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:o}}]}}],a.definitions)})}function r(n){void 0===n&&(n=[]);var e={};return n.forEach((function(n){e[n.name.value]=n})),e}function o(n,e){switch(n.kind){case"InlineFragment":return n;case"FragmentSpread":var i=e&&e[n.name.value];return"production"===process.env.NODE_ENV?t(i,44):t(i,"No fragment named "+n.name.value+"."),i;default:return null}}export{r as createFragmentMap,o as getFragmentFromSelection,a as getFragmentQueryDocument};
1
+ import{__assign as n,__spreadArrays as e}from'../../ext/tslib/tslib.es6.js';import{InvariantError as i,invariant as t}from"../../../../ts-invariant/lib/invariant.esm.js";function a(a,o){var r=o,s=[];return a.definitions.forEach((function(n){if("OperationDefinition"===n.kind)throw"production"===process.env.NODE_ENV?new i(42):new i("Found a "+n.operation+" operation"+(n.name?" named '"+n.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===n.kind&&s.push(n)})),void 0===r&&("production"===process.env.NODE_ENV?t(1===s.length,43):t(1===s.length,"Found "+s.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),r=s[0].name.value),n(n({},a),{definitions:e([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],a.definitions)})}function o(n){void 0===n&&(n=[]);var e={};return n.forEach((function(n){e[n.name.value]=n})),e}function r(n,e){switch(n.kind){case"InlineFragment":return n;case"FragmentSpread":var i=e&&e[n.name.value];return"production"===process.env.NODE_ENV?t(i,44):t(i,"No fragment named "+n.name.value+"."),i;default:return null}}export{o as createFragmentMap,r as getFragmentFromSelection,a as getFragmentQueryDocument};
@@ -1 +1 @@
1
- import{__assign as e,__spreadArrays as n}from"../../../../tslib/tslib.es6.js";import{invariant as t}from"../../../../ts-invariant/lib/invariant.esm.js";import{checkDocument as r,getFragmentDefinitions as i,getOperationDefinition as u,getFragmentDefinition as a,getMainDefinition as o}from"./getFromAST.js";import{filterInPlace as c}from"../common/filterInPlace.js";import{isField as f,isInlineFragment as m}from"./storeUtils.js";import{createFragmentMap as l}from"./fragments.js";import{visit as s}from"../../../../graphql/language/visitor.mjs.js";var v={kind:"Field",name:{kind:"Name",value:"__typename"}};function p(e,n){return e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&p(n[e.name.value],n)}))}function d(e){return p(u(e)||a(e),l(i(e)))?null:e}function g(e){return function(n){return e.some((function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)}))}}function h(e,n){var t=Object.create(null),r=[],i=Object.create(null),u=[],a=d(s(n,{Variable:{enter:function(e,n,r){"VariableDefinition"!==r.kind&&(t[e.name.value]=!0)}},Field:{enter:function(n){if(e&&n.directives&&(e.some((function(e){return e.remove}))&&n.directives&&n.directives.some(g(e))))return n.arguments&&n.arguments.forEach((function(e){"Variable"===e.value.kind&&r.push({name:e.value.name.value})})),n.selectionSet&&j(n.selectionSet).forEach((function(e){u.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){i[e.name.value]=!0}},Directive:{enter:function(n){if(g(e)(n))return null}}}));return a&&c(r,(function(e){return!!e.name&&!t[e.name]})).length&&(a=k(r,a)),a&&c(u,(function(e){return!!e.name&&!i[e.name]})).length&&(a=D(u,a)),a}function S(t){return s(r(t),{SelectionSet:{enter:function(t,r,i){if(!i||"OperationDefinition"!==i.kind){var u=t.selections;if(u)if(!u.some((function(e){return f(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var a=i;if(!(f(a)&&a.directives&&a.directives.some((function(e){return"export"===e.name.value}))))return e(e({},t),{selections:n(u,[v])})}}}}})}S.added=function(e){return e===v};var b={test:function(e){var n="connection"===e.name.value;return n&&(e.arguments&&e.arguments.some((function(e){return"key"===e.name.value}))||"production"===process.env.NODE_ENV||t.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),n}};function y(e){return h([b],r(e))}function k(n,t){var r=function(e){return function(n){return e.some((function(e){return n.value&&"Variable"===n.value.kind&&n.value.name&&(e.name===n.value.name.value||e.test&&e.test(n))}))}}(n);return d(s(t,{OperationDefinition:{enter:function(t){return e(e({},t),{variableDefinitions:t.variableDefinitions?t.variableDefinitions.filter((function(e){return!n.some((function(n){return n.name===e.variable.name.value}))})):[]})}},Field:{enter:function(e){if(n.some((function(e){return e.remove}))){var t=0;if(e.arguments&&e.arguments.forEach((function(e){r(e)&&(t+=1)})),1===t)return null}}},Argument:{enter:function(e){if(r(e))return null}}}))}function D(e,n){function t(n){if(e.some((function(e){return e.name===n.name.value})))return null}return d(s(n,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function j(e){var n=[];return e.selections.forEach((function(e){(f(e)||m(e))&&e.selectionSet?j(e.selectionSet).forEach((function(e){return n.push(e)})):"FragmentSpread"===e.kind&&n.push(e)})),n}function F(n){return"query"===o(n).operation?n:s(n,{OperationDefinition:{enter:function(n){return e(e({},n),{operation:"query"})}}})}function _(e){r(e);var n=h([{test:function(e){return"client"===e.name.value},remove:!0}],e);return n&&(n=s(n,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return f(e)&&"__typename"===e.name.value})))return null}}})),n}export{S as addTypenameToDocument,F as buildQueryFromSelectionSet,k as removeArgumentsFromDocument,_ as removeClientSetsFromDocument,y as removeConnectionDirectiveFromDocument,h as removeDirectivesFromDocument,D as removeFragmentSpreadFromDocument};
1
+ import{__assign as e,__spreadArrays as n}from'../../ext/tslib/tslib.es6.js';import{invariant as t}from"../../../../ts-invariant/lib/invariant.esm.js";import{checkDocument as r,getFragmentDefinitions as i,getOperationDefinition as u,getFragmentDefinition as o,getMainDefinition as a}from"./getFromAST.js";import{filterInPlace as c}from"../common/filterInPlace.js";import{isField as f,isInlineFragment as m}from"./storeUtils.js";import{createFragmentMap as l}from"./fragments.js";import{visit as s}from"../../../../graphql/language/visitor.mjs.js";var v={kind:"Field",name:{kind:"Name",value:"__typename"}};function p(e,n){return e.selectionSet.selections.every((function(e){return"FragmentSpread"===e.kind&&p(n[e.name.value],n)}))}function d(e){return p(u(e)||o(e),l(i(e)))?null:e}function g(e){return function(n){return e.some((function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)}))}}function h(e,n){var t=Object.create(null),r=[],i=Object.create(null),u=[],o=d(s(n,{Variable:{enter:function(e,n,r){"VariableDefinition"!==r.kind&&(t[e.name.value]=!0)}},Field:{enter:function(n){if(e&&n.directives&&(e.some((function(e){return e.remove}))&&n.directives&&n.directives.some(g(e))))return n.arguments&&n.arguments.forEach((function(e){"Variable"===e.value.kind&&r.push({name:e.value.name.value})})),n.selectionSet&&j(n.selectionSet).forEach((function(e){u.push({name:e.name.value})})),null}},FragmentSpread:{enter:function(e){i[e.name.value]=!0}},Directive:{enter:function(n){if(g(e)(n))return null}}}));return o&&c(r,(function(e){return!!e.name&&!t[e.name]})).length&&(o=k(r,o)),o&&c(u,(function(e){return!!e.name&&!i[e.name]})).length&&(o=D(u,o)),o}function S(t){return s(r(t),{SelectionSet:{enter:function(t,r,i){if(!i||"OperationDefinition"!==i.kind){var u=t.selections;if(u)if(!u.some((function(e){return f(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))}))){var o=i;if(!(f(o)&&o.directives&&o.directives.some((function(e){return"export"===e.name.value}))))return e(e({},t),{selections:n(u,[v])})}}}}})}S.added=function(e){return e===v};var b={test:function(e){var n="connection"===e.name.value;return n&&(e.arguments&&e.arguments.some((function(e){return"key"===e.name.value}))||"production"===process.env.NODE_ENV||t.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),n}};function y(e){return h([b],r(e))}function k(n,t){var r=function(e){return function(n){return e.some((function(e){return n.value&&"Variable"===n.value.kind&&n.value.name&&(e.name===n.value.name.value||e.test&&e.test(n))}))}}(n);return d(s(t,{OperationDefinition:{enter:function(t){return e(e({},t),{variableDefinitions:t.variableDefinitions?t.variableDefinitions.filter((function(e){return!n.some((function(n){return n.name===e.variable.name.value}))})):[]})}},Field:{enter:function(e){if(n.some((function(e){return e.remove}))){var t=0;if(e.arguments&&e.arguments.forEach((function(e){r(e)&&(t+=1)})),1===t)return null}}},Argument:{enter:function(e){if(r(e))return null}}}))}function D(e,n){function t(n){if(e.some((function(e){return e.name===n.name.value})))return null}return d(s(n,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function j(e){var n=[];return e.selections.forEach((function(e){(f(e)||m(e))&&e.selectionSet?j(e.selectionSet).forEach((function(e){return n.push(e)})):"FragmentSpread"===e.kind&&n.push(e)})),n}function F(n){return"query"===a(n).operation?n:s(n,{OperationDefinition:{enter:function(n){return e(e({},n),{operation:"query"})}}})}function _(e){r(e);var n=h([{test:function(e){return"client"===e.name.value},remove:!0}],e);return n&&(n=s(n,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every((function(e){return f(e)&&"__typename"===e.name.value})))return null}}})),n}export{S as addTypenameToDocument,F as buildQueryFromSelectionSet,k as removeArgumentsFromDocument,_ as removeClientSetsFromDocument,y as removeConnectionDirectiveFromDocument,h as removeDirectivesFromDocument,D as removeFragmentSpreadFromDocument};
@@ -1 +1 @@
1
- import{__extends as e}from"../../../../tslib/tslib.es6.js";import"./Observable.js";import{iterateObserversSafely as t}from"./iteration.js";import r from"../../../../zen-observable/index.js";function s(e){return e&&"function"==typeof e.then}var n=function(r){function n(e){var n=r.call(this,(function(e){return n.addObserver(e),function(){return n.removeObserver(e)}}))||this;return n.observers=new Set,n.addCount=0,n.promise=new Promise((function(e,t){n.resolve=e,n.reject=t})),n.handlers={next:function(e){null!==n.sub&&(n.latest=["next",e],t(n.observers,"next",e))},error:function(e){var r=n.sub;null!==r&&(r&&Promise.resolve().then((function(){return r.unsubscribe()})),n.sub=null,n.latest=["error",e],n.reject(e),t(n.observers,"error",e))},complete:function(){if(null!==n.sub){var e=n.sources.shift();e?s(e)?e.then((function(e){return n.sub=e.subscribe(n.handlers)})):n.sub=e.subscribe(n.handlers):(n.sub=null,n.latest&&"next"===n.latest[0]?n.resolve(n.latest[1]):n.resolve(),t(n.observers,"complete"))}}},n.cancel=function(e){n.reject(e),n.sources=[],n.handlers.complete()},n.promise.catch((function(e){})),s(e)?e.then((function(e){return n.start(e)}),n.handlers.error):n.start(e),n}return e(n,r),n.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},n.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},n.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},n.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},n.prototype.cleanup=function(e){var t=this,r=!1,s=function(){r||(r=!0,t.observers.delete(n),e())},n={next:s,error:s,complete:s},o=this.addCount;this.addObserver(n),this.addCount=o},n}(r);"function"==typeof Symbol&&Symbol.species&&Object.defineProperty(n,Symbol.species,{value:r});export{n as Concast};
1
+ import{__extends as e}from'../../ext/tslib/tslib.es6.js';import"./Observable.js";import{iterateObserversSafely as t}from"./iteration.js";import r from"../../../../zen-observable/index.js";function s(e){return e&&"function"==typeof e.then}var n=function(r){function n(e){var n=r.call(this,(function(e){return n.addObserver(e),function(){return n.removeObserver(e)}}))||this;return n.observers=new Set,n.addCount=0,n.promise=new Promise((function(e,t){n.resolve=e,n.reject=t})),n.handlers={next:function(e){null!==n.sub&&(n.latest=["next",e],t(n.observers,"next",e))},error:function(e){var r=n.sub;null!==r&&(r&&Promise.resolve().then((function(){return r.unsubscribe()})),n.sub=null,n.latest=["error",e],n.reject(e),t(n.observers,"error",e))},complete:function(){if(null!==n.sub){var e=n.sources.shift();e?s(e)?e.then((function(e){return n.sub=e.subscribe(n.handlers)})):n.sub=e.subscribe(n.handlers):(n.sub=null,n.latest&&"next"===n.latest[0]?n.resolve(n.latest[1]):n.resolve(),t(n.observers,"complete"))}}},n.cancel=function(e){n.reject(e),n.sources=[],n.handlers.complete()},n.promise.catch((function(e){})),s(e)?e.then((function(e){return n.start(e)}),n.handlers.error):n.start(e),n}return e(n,r),n.prototype.start=function(e){void 0===this.sub&&(this.sources=Array.from(e),this.handlers.complete())},n.prototype.deliverLastMessage=function(e){if(this.latest){var t=this.latest[0],r=e[t];r&&r.call(e,this.latest[1]),null===this.sub&&"next"===t&&e.complete&&e.complete()}},n.prototype.addObserver=function(e){this.observers.has(e)||(this.deliverLastMessage(e),this.observers.add(e),++this.addCount)},n.prototype.removeObserver=function(e,t){this.observers.delete(e)&&--this.addCount<1&&!t&&this.handlers.error(new Error("Observable cancelled prematurely"))},n.prototype.cleanup=function(e){var t=this,r=!1,s=function(){r||(r=!0,t.observers.delete(n),e())},n={next:s,error:s,complete:s},o=this.addCount;this.addObserver(n),this.addCount=o},n}(r);"function"==typeof Symbol&&Symbol.species&&Object.defineProperty(n,Symbol.species,{value:r});export{n as Concast};
@@ -0,0 +1,15 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+ var t=function(o,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var r in o)o.hasOwnProperty(r)&&(t[r]=o[r])},t(o,r)};function o(o,r){function n(){this.constructor=o}t(o,r),o.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}export{o as __extends};
@@ -1 +1 @@
1
- import{__extends as r}from"../../tslib/tslib.es6.js";import o from"../../@ungap/global-this/esm/index.js";var n=o,t=n.console,e=Object.setPrototypeOf,i=void 0===e?function(r,o){return r.__proto__=o,r}:e,a=function(o){function n(r){void 0===r&&(r="Invariant Violation");var t=o.call(this,"number"==typeof r?"Invariant Violation: "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return t.framesToPop=1,t.name="Invariant Violation",i(t,n.prototype),t}return r(n,o),n}(Error);function s(r,o){if(!r)throw new a(o)}var l=["log","warn","error","silent"],p=l.indexOf("log");function c(r){return function(){if(l.indexOf(r)>=p)return t[r].apply(t,arguments)}}!function(r){r.log=c("log"),r.warn=c("warn"),r.error=c("error")}(s||(s={}));var f=n.process||{env:{}};if(!n.process)try{Object.defineProperty(o,"process",{value:f,writable:!0,enumerable:!1,configurable:!0})}catch(r){}export{a as InvariantError,s as invariant,f as process};
1
+ import{__extends as r}from'../ext/tslib/tslib.es6.js';import o from"../../@ungap/global-this/esm/index.js";var n=o,e=n.console,t=Object.setPrototypeOf,i=void 0===t?function(r,o){return r.__proto__=o,r}:t,a=function(o){function n(r){void 0===r&&(r="Invariant Violation");var e=o.call(this,"number"==typeof r?"Invariant Violation: "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return e.framesToPop=1,e.name="Invariant Violation",i(e,n.prototype),e}return r(n,o),n}(Error);function s(r,o){if(!r)throw new a(o)}var l=["log","warn","error","silent"],p=l.indexOf("log");function c(r){return function(){if(l.indexOf(r)>=p)return e[r].apply(e,arguments)}}!function(r){r.log=c("log"),r.warn=c("warn"),r.error=c("error")}(s||(s={}));var f=n.process||{env:{}};if(!n.process)try{Object.defineProperty(o,"process",{value:f,writable:!0,enumerable:!1,configurable:!0})}catch(r){}export{a as InvariantError,s as invariant,f as process};
@@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
- var t=function(r,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])},t(r,n)};function r(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var n=function(){return n=Object.assign||function(t){for(var r,n=1,e=arguments.length;n<e;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o]);return t},n.apply(this,arguments)};function e(t,r){var n={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&r.indexOf(e)<0&&(n[e]=t[e]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(e=Object.getOwnPropertySymbols(t);o<e.length;o++)r.indexOf(e[o])<0&&Object.prototype.propertyIsEnumerable.call(t,e[o])&&(n[e[o]]=t[e[o]])}return n}function o(t,r,n,e){return new(n||(n=Promise))((function(o,a){function c(t){try{i(e.next(t))}catch(t){a(t)}}function u(t){try{i(e.throw(t))}catch(t){a(t)}}function i(t){var r;t.done?o(t.value):(r=t.value,r instanceof n?r:new n((function(t){t(r)}))).then(c,u)}i((e=e.apply(t,r||[])).next())}))}function a(t,r){var n,e,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,e&&(o=2&a[0]?e.return:a[0]?e.throw||((o=e.return)&&o.call(e),0):e.next)&&!(o=o.call(e,a[1])).done)return o;switch(e=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,e=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=r.call(t,c)}catch(t){a=[6,t],e=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function c(){for(var t=0,r=0,n=arguments.length;r<n;r++)t+=arguments[r].length;var e=Array(t),o=0;for(r=0;r<n;r++)for(var a=arguments[r],c=0,u=a.length;c<u;c++,o++)e[o]=a[c];return e}function u(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}export{n as __assign,o as __awaiter,r as __extends,a as __generator,u as __makeTemplateObject,e as __rest,c as __spreadArrays};
15
+ var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)};function r(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function o(t,e,n,r){return new(n||(n=Promise))((function(o,c){function a(t){try{i(r.next(t))}catch(t){c(t)}}function l(t){try{i(r.throw(t))}catch(t){c(t)}}function i(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,l)}i((r=r.apply(t,e||[])).next())}))}function c(t,e){var n,r,o,c,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function l(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function a(t,e,n){if(n||2===arguments.length)for(var r,o=0,c=e.length;o<c;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function l(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}export{n as __assign,o as __awaiter,e as __extends,c as __generator,l as __makeTemplateObject,r as __rest,a as __spreadArray};