apollo-upload-client
Advanced tools
Comparing version 1.0.2 to 2.0.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var apolloClient = require('apollo-client'); | ||
var apolloClient_transport_networkInterface = require('apollo-client/transport/networkInterface'); | ||
var RecursiveIterator = _interopDefault(require('recursive-iterator')); | ||
@@ -12,2 +13,4 @@ var objectPath = _interopDefault(require('object-path')); | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -19,14 +22,8 @@ | ||
function createNetworkInterface(opts) { | ||
var uri = opts.uri; | ||
var HTTPUploadNetworkInterface = function (_HTTPFetchNetworkInte) { | ||
_inherits(HTTPUploadNetworkInterface, _HTTPFetchNetworkInte); | ||
return new UploadHTTPFetchNetworkInterface(uri, opts); | ||
} | ||
function HTTPUploadNetworkInterface() { | ||
_classCallCheck(this, HTTPUploadNetworkInterface); | ||
var UploadHTTPFetchNetworkInterface = function (_HTTPFetchNetworkInte) { | ||
_inherits(UploadHTTPFetchNetworkInterface, _HTTPFetchNetworkInte); | ||
function UploadHTTPFetchNetworkInterface() { | ||
_classCallCheck(this, UploadHTTPFetchNetworkInterface); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -102,3 +99,3 @@ args[_key] = arguments[_key]; | ||
UploadHTTPFetchNetworkInterface.prototype.uploadFetch = function uploadFetch(_ref4, formData) { | ||
HTTPUploadNetworkInterface.prototype.uploadFetch = function uploadFetch(_ref4, formData) { | ||
var request = _ref4.request, | ||
@@ -113,5 +110,6 @@ options = _ref4.options; | ||
// Send the multipart form | ||
return window.fetch(this._opts.uri, _extends({}, options, { | ||
return window.fetch(this._uri, _extends({ | ||
body: formData, | ||
method: 'POST', | ||
method: 'POST' | ||
}, options, { | ||
headers: _extends({ | ||
@@ -123,6 +121,14 @@ Accept: '*/*' | ||
return UploadHTTPFetchNetworkInterface; | ||
}(apolloClient_transport_networkInterface.HTTPFetchNetworkInterface); | ||
return HTTPUploadNetworkInterface; | ||
}(apolloClient.HTTPFetchNetworkInterface); | ||
module.exports = createNetworkInterface; | ||
function createNetworkInterface(_ref5) { | ||
var uri = _ref5.uri, | ||
options = _objectWithoutProperties(_ref5, ['uri']); | ||
return new HTTPUploadNetworkInterface(uri, options); | ||
} | ||
exports.HTTPUploadNetworkInterface = HTTPUploadNetworkInterface; | ||
exports.createNetworkInterface = createNetworkInterface; | ||
//# sourceMappingURL=apollo-upload-client.js.map |
@@ -1,3 +0,2 @@ | ||
import { printAST } from 'apollo-client'; | ||
import { HTTPFetchNetworkInterface } from 'apollo-client/transport/networkInterface'; | ||
import { HTTPFetchNetworkInterface, printAST } from 'apollo-client'; | ||
import RecursiveIterator from 'recursive-iterator'; | ||
@@ -8,2 +7,4 @@ import objectPath from 'object-path'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -15,14 +16,8 @@ | ||
function createNetworkInterface(opts) { | ||
var uri = opts.uri; | ||
var HTTPUploadNetworkInterface = function (_HTTPFetchNetworkInte) { | ||
_inherits(HTTPUploadNetworkInterface, _HTTPFetchNetworkInte); | ||
return new UploadHTTPFetchNetworkInterface(uri, opts); | ||
} | ||
function HTTPUploadNetworkInterface() { | ||
_classCallCheck(this, HTTPUploadNetworkInterface); | ||
var UploadHTTPFetchNetworkInterface = function (_HTTPFetchNetworkInte) { | ||
_inherits(UploadHTTPFetchNetworkInterface, _HTTPFetchNetworkInte); | ||
function UploadHTTPFetchNetworkInterface() { | ||
_classCallCheck(this, UploadHTTPFetchNetworkInterface); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -98,3 +93,3 @@ args[_key] = arguments[_key]; | ||
UploadHTTPFetchNetworkInterface.prototype.uploadFetch = function uploadFetch(_ref4, formData) { | ||
HTTPUploadNetworkInterface.prototype.uploadFetch = function uploadFetch(_ref4, formData) { | ||
var request = _ref4.request, | ||
@@ -109,5 +104,6 @@ options = _ref4.options; | ||
// Send the multipart form | ||
return window.fetch(this._opts.uri, _extends({}, options, { | ||
return window.fetch(this._uri, _extends({ | ||
body: formData, | ||
method: 'POST', | ||
method: 'POST' | ||
}, options, { | ||
headers: _extends({ | ||
@@ -119,6 +115,13 @@ Accept: '*/*' | ||
return UploadHTTPFetchNetworkInterface; | ||
return HTTPUploadNetworkInterface; | ||
}(HTTPFetchNetworkInterface); | ||
export default createNetworkInterface; | ||
function createNetworkInterface(_ref5) { | ||
var uri = _ref5.uri, | ||
options = _objectWithoutProperties(_ref5, ['uri']); | ||
return new HTTPUploadNetworkInterface(uri, options); | ||
} | ||
export { HTTPUploadNetworkInterface, createNetworkInterface }; | ||
//# sourceMappingURL=apollo-upload-client.module.js.map |
{ | ||
"name": "apollo-upload-client", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Enhances Apollo for intuitive file uploads via GraphQL mutations.", | ||
@@ -24,4 +24,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"apollo-client": "^0.8.7", | ||
"object-path": "^0.11.3", | ||
"apollo-client": "^1.0.0-rc.4", | ||
"object-path": "^0.11.4", | ||
"recursive-iterator": "^2.0.3" | ||
@@ -31,14 +31,11 @@ }, | ||
"babel-eslint": "^7.1.1", | ||
"babel-preset-env": "^1.1.8", | ||
"babel-preset-env": "^1.2.2", | ||
"babel-preset-stage-0": "^6.22.0", | ||
"eslint": "^3.16.0", | ||
"eslint-config-standard": "^6.2.1", | ||
"eslint-plugin-promise": "^3.4.2", | ||
"eslint-plugin-standard": "^2.0.1", | ||
"rollup": "^0.41.4", | ||
"rollup": "^0.41.6", | ||
"rollup-plugin-babel": "^2.7.1", | ||
"rollup-watch": "^3.2.2" | ||
"rollup-watch": "^3.2.2", | ||
"standard": "^9.0.2" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"lint": "standard", | ||
"prebuild": "npm run lint", | ||
@@ -72,8 +69,8 @@ "build": "rollup --config", | ||
}, | ||
"eslintConfig": { | ||
"standard": { | ||
"parser": "babel-eslint", | ||
"extends": [ | ||
"standard" | ||
"ignore": [ | ||
"dist/**" | ||
] | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# ![Apollo upload client](https://cdn.rawgit.com/jaydenseric/apollo-upload-client/v1.0.2/apollo-upload-logo.svg) | ||
# ![Apollo upload client](https://cdn.rawgit.com/jaydenseric/apollo-upload-client/v2.0.0/apollo-upload-logo.svg) | ||
@@ -22,3 +22,3 @@ ![NPM version](https://img.shields.io/npm/v/apollo-upload-client.svg?style=flat-square) ![Github issues](https://img.shields.io/github/issues/jaydenseric/apollo-upload-client.svg?style=flat-square) ![Github stars](https://img.shields.io/github/stars/jaydenseric/apollo-upload-client.svg?style=flat-square) | ||
import ApolloClient from 'apollo-client' | ||
import createNetworkInterface from 'apollo-upload-client' | ||
import {createNetworkInterface} from 'apollo-upload-client' | ||
@@ -38,3 +38,3 @@ const client = new ApolloClient({ | ||
The files upload to a temp directory; the paths and metadata will be avalable under the variable name in the resolver. See the [server usage](https://github.com/jaydenseric/apollo-upload-server#usage). | ||
The files upload to a temp directory; the paths and metadata will be available under the variable name in the resolver. See the [server usage](https://github.com/jaydenseric/apollo-upload-server#usage). | ||
@@ -41,0 +41,0 @@ ### Single file |
@@ -1,12 +0,6 @@ | ||
import {printAST} from 'apollo-client' | ||
import {HTTPFetchNetworkInterface} from 'apollo-client/transport/networkInterface' | ||
import {HTTPFetchNetworkInterface, printAST} from 'apollo-client' | ||
import RecursiveIterator from 'recursive-iterator' | ||
import objectPath from 'object-path' | ||
export default function createNetworkInterface (opts) { | ||
const {uri} = opts | ||
return new UploadHTTPFetchNetworkInterface(uri, opts) | ||
} | ||
class UploadHTTPFetchNetworkInterface extends HTTPFetchNetworkInterface { | ||
export class HTTPUploadNetworkInterface extends HTTPFetchNetworkInterface { | ||
constructor (...args) { | ||
@@ -67,6 +61,6 @@ super(...args) | ||
// Send the multipart form | ||
return window.fetch(this._opts.uri, { | ||
...options, | ||
return window.fetch(this._uri, { | ||
body: formData, | ||
method: 'POST', | ||
...options, | ||
headers: { | ||
@@ -79,1 +73,5 @@ Accept: '*/*', | ||
} | ||
export function createNetworkInterface ({uri, ...options}) { | ||
return new HTTPUploadNetworkInterface(uri, options) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31424
7
9
324
+ Added@types/graphql@0.10.2(transitive)
+ Addedapollo-client@1.9.3(transitive)
+ Addedapollo-link-core@0.5.4(transitive)
+ Addedgraphql@0.10.5(transitive)
+ Addedgraphql-anywhere@3.1.0(transitive)
+ Addedgraphql-tag@2.12.6(transitive)
+ Addediterall@1.3.0(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addedzen-observable-ts@0.4.4(transitive)
- Removed@types/async@2.4.2(transitive)
- Removed@types/graphql@0.8.6(transitive)
- Removed@types/isomorphic-fetch@0.0.30(transitive)
- Removedapollo-client@0.8.7(transitive)
- Removedgraphql-anywhere@2.2.0(transitive)
- Removedgraphql-tag@1.3.2(transitive)
Updatedapollo-client@^1.0.0-rc.4
Updatedobject-path@^0.11.4