apollo-link-prismic
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PrismicLink=PrismicLink,exports.default=void 0;var _apolloLinkHttp=require("apollo-link-http"),_apolloLinkContext=require("apollo-link-context"),_prismicJavascript=_interopRequireDefault(require("prismic-javascript"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _objectSpread(a){for(var b=1;b<arguments.length;b++){var c=null==arguments[b]?{}:arguments[b],d=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))),d.forEach(function(b){_defineProperty(a,b,c[b])})}return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}function _arrayWithHoles(a){if(Array.isArray(a))return a}function PrismicLink(a){var b=a.uri,c=a.accessToken,d=/^(https?:\/\/.+?\..+?\..+?)\/graphql\/?$/,e=b.match(d);if(e&&e[1]){var f=_slicedToArray(e,2),g=f[0],h=f[1],i=_prismicJavascript.default.client("".concat(h,"/api"),{accessToken:c}),j=(0,_apolloLinkContext.setContext)(function(a,b){return i.getApi().then(function(a){var d=c?{Authorization:"Token ".concat(c)}:{};return{headers:_objectSpread({},b.headers,d,{"Prismic-ref":a.masterRef.ref})}})}),k=new _apolloLinkHttp.HttpLink({uri:b,useGETForQueries:!0});return j.concat(k)}throw new Error("".concat(b," isn't a valid Prismic GraphQL endpoint"))}var _default={PrismicLink:PrismicLink};exports.default=_default; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PrismicLink=PrismicLink,exports.default=void 0;var _apolloLinkHttp=require("apollo-link-http"),_apolloLinkContext=require("apollo-link-context"),_prismicJavascript=_interopRequireDefault(require("prismic-javascript"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _objectSpread(a){for(var b=1;b<arguments.length;b++){var c=null==arguments[b]?{}:arguments[b],d=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))),d.forEach(function(b){_defineProperty(a,b,c[b])})}return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}function _arrayWithHoles(a){if(Array.isArray(a))return a}function PrismicLink(a){var b=a.uri,c=a.accessToken,d=/^(https?:\/\/.+?\..+?\..+?)\/graphql\/?$/,e=b.match(d);if(e&&e[1]){var f=_slicedToArray(e,2),g=f[0],h=f[1],i=_prismicJavascript.default.client("".concat(h,"/api"),{accessToken:c}),j=(0,_apolloLinkContext.setContext)(function(a,b){return i.getApi().then(function(a){var d=c?{Authorization:"Token ".concat(c)}:{};return{headers:_objectSpread({"Prismic-ref":a.masterRef.ref},b.headers,d)}})}),k=new _apolloLinkHttp.HttpLink({uri:b,useGETForQueries:!0});return j.concat(k)}throw new Error("".concat(b," isn't a valid Prismic GraphQL endpoint"))}var _default={PrismicLink:PrismicLink};exports.default=_default; | ||
@@ -17,5 +17,5 @@ import { HttpLink } from 'apollo-link-http'; | ||
headers: { | ||
'Prismic-ref': api.masterRef.ref, | ||
...options.headers, | ||
...authorizationHeader, | ||
'Prismic-ref': api.masterRef.ref, | ||
...authorizationHeader | ||
} | ||
@@ -22,0 +22,0 @@ } |
{ | ||
"name": "apollo-link-prismic", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Apollo link for Prismic", | ||
@@ -5,0 +5,0 @@ "main": "dist/apollo-link-prismic.min.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4834
5
43