A terminating Apollo Link for Apollo Client that fetches a GraphQL multipart request if the GraphQL variables contain files (by default FileList, File, or Blob instances), or else fetches a regular GraphQL POST or GET request (depending on the config and GraphQL operation).
Bot releases are hidden (Show)
Published by jaydenseric 12 months ago
Updated Node.js support to ^18.15.0 || >=20.4.0
.
Updated the @apollo/client
peer dependency to ^3.8.0
.
Updated the extract-files
dependency to v13.
React Native is no longer supported out of the box.
The class ReactNativeFile
is no longer exported, or matched by the function isExtractableFile
.
This class was bloating non React Native environments with an extra module, increasing bundle sizes when building and adding an extra step to ESM loading waterfalls in browsers.
It’s the responsibility of Facebook to adhere to web standards and implement spec-complaint Blob
, File
, and FormData
globals in the React Native environment.
To migrate, React Native projects that are unable to use the standard globals can manually implement a class ReactNativeFile
and match it with a custom function isReactNativeFile
for use with the function createUploadLink
option isExtractableFile
.
“Plain” objects in the GraphQL operation that aren’t Object
instances (e.g. Object.create(null)
) are now also deep cloned when searching for extractable files.
Updated dev dependencies, some of which require newer Node.js versions than previously supported.
Use the Node.js test runner API and remove the dev dependency test-director
.
Refactored tests to use the standard AbortController
, AbortSignal
, File
, FormData
, and Response
APIs available in modern Node.js and removed the dev dependencies abort-controller
, formdata-node
, and node-fetch
.
Public modules are now individually listed in the package files
and exports
fields.
Removed the package main index module; deep imports must be used. To migrate:
- import {
- createUploadLink,
- formDataAppendFile,
- isExtractableFile
- } from "apollo-upload-client";
+ import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
+ import formDataAppendFile from "apollo-upload-client/formDataAppendFile.mjs";
+ import isExtractableFile from "apollo-upload-client/isExtractableFile.mjs";
Shortened public module deep import paths, removing the /public/
. To migrate:
- import createUploadLink from "apollo-upload-client/public/createUploadLink.js";
+ import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
- import formDataAppendFile from "apollo-upload-client/public/formDataAppendFile.js";
+ import formDataAppendFile from "apollo-upload-client/formDataAppendFile.mjs";
- import isExtractableFile from "apollo-upload-client/public/isExtractableFile.js";
+ import isExtractableFile from "apollo-upload-client/isExtractableFile.mjs";
The API is now ESM in .mjs
files instead of CJS in .js
files, accessible via import
but not require
.
Implemented TypeScript types via JSDoc comments.
Types published in @types/apollo-upload-client
should no longer be used.
Projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check
comment:
compilerOptions.allowJs
should be true
.compilerOptions.maxNodeModuleJsDepth
should be reasonably large, e.g. 10
.compilerOptions.module
should be "node16"
or "nodenext"
.Internally, use the function selectHttpOptionsAndBodyInternal
that was added in @apollo/client
v3.5.5.
print
for the function createUploadLink
, to customize how the GraphQL query or mutation AST prints to a string for transport. It that works like the same option for HttpLink
.eslint-plugin-optimal-modules
.types
script.jsdoc-md
dev dependency and the related package scripts, replacing the readme “API” section with a manually written “Exports” section.package.json
field repository
to conform to new npm requirements.actions/checkout
to v4.actions/setup-node
to v3.node:
URL scheme for Node.js builtin module imports.headers
that as of @apollo/client
v3.7.0 is a null-prototype object, use the assertion deepEqual
instead of deepStrictEqual
.Published by jaydenseric almost 3 years ago
^12.22.0 || ^14.17.0 || >= 16.0.0
../package
from the package exports
field; the full package.json
filename must be used in a require
path.graphql
peer dependency to 14 - 16
.fetch-blob
dev dependency.assertBundleSize
function to assert module bundle size in tests:
timeLimitPromise
error messages.singleQuote
to the default, false
.Published by jaydenseric over 3 years ago
extract-files
dependency to v11.main
field path.Published by jaydenseric over 3 years ago
^12.20 || >= 14.13
.@apollo/client
from a dependency to a peer dependency, fixing #251 via #252.package.json
exports
field public subpath folder mapping (deprecated by Node.js) with a subpath pattern. Deep require
paths within apollo-upload-client/public/
must now include the .js
file extension..mjs
files instead of CJS in .js
files.hard-rejection
to detect unhandled Promise
rejections in tests, as Node.js v15+ does this natively.esbuild
and gzip-size
, removing size-limit
related dev dependencies, config, and scripts.actions/checkout
to v2.actions/setup-node
to v2.CI
environment variable as it’s set by default.main
field path.jsdoc-md
v10 automatically generates a Prettier formatted readme.test:jsdoc
script that checks the readme API docs are up to date with the source JSDoc..js
file extension in internal require
paths.createUploadLink
description, fixing #247.createUploadLink
option fetchOptions.signal
bugs:
once: true
when adding the abort
event listener on the given abort controller signal to avoid a possible memory leak.Published by jaydenseric almost 4 years ago
subscriptions-transport-ws
peer dependency, via #235.AbortController
global being defined in Node.js v15+.Published by jaydenseric about 4 years ago
execute
from apollo-link
instead of ApolloClient
query
and mutate
methods.Published by jaydenseric about 4 years ago
revertable-globals
for tests.formdata-node
workarounds in tests.npm-debug.log
from the .gitignore
file as npm v4.2.0+ doesn’t create it in the current working directory.clientAwareness
being undefined in Apollo Link context, via #212.Published by jaydenseric about 4 years ago
extract-files
dependency to v9, updating relevant deep require paths.signal
fetch option, fixing #209.createUploadLink
:
clientAwareness
from context. It was an obstacle to 100% code coverage because ApolloClient
defaults it to an empty object.Observable
function scope.options.uri
.Published by jaydenseric about 4 years ago
@apollo/client
imports to support non React projects, fixing #207.Published by jaydenseric over 4 years ago
^10.17.0 || ^12.0.0 || >= 13.7.0
.exports
field with conditional exports to support native ESM in Node.js and keep internal code private, whilst avoiding the dual package hazard. Published files have been reorganized, so previously undocumented deep imports will need to be rewritten according to the newly documented paths.@apollo/client
v3, fixing #174 via #175.graphql
peer dependency to support a wider range of package managers, via #196.npm install-test
command.overrides
to ensure .js
files are parsed as scripts, eliminating Babel interopRequireDefault
helpers from transpilation output.ReactNativeFileSubstitute
code example.import
instead of require
.Published by jaydenseric over 4 years ago
createUploadLink
options:
isExtractableFile
FormData
formDataAppendFile
createUploadLink
option defaults:
isExtractableFile
formDataAppendFile
eslint-plugin-import-order-alphabetical
dev dependency.size-limit
dev dependency.husky
and lint-staged
.babel.config.js
to src/.babelrc.json
.prepare:prettier
and test:prettier
scripts.semi
to the default, true
.package-lock.json
from .gitignore
and .prettierignore
as it’s disabled in .npmrc
anyway.Published by jaydenseric almost 5 years ago
.github/funding.yml
to display a sponsor button in GitHub.package.json
funding
field to enable npm CLI funding features.Published by jaydenseric almost 5 years ago
eslint
dev dependency now supports. This is unlikely to be a breaking change for the published package.eslint-plugin-jsdoc
dev dependency.size-limit
dev dependency with @size-limit/preset-small-lib
.AbortController
instance if signal
is not already set in fetch options, fixing #162 via #169.@apollo/react-hooks
.Published by jaydenseric over 5 years ago
@babel/runtime
dependency and @babel/plugin-transform-runtime
dev dependency.Published by jaydenseric over 5 years ago
package.json
by moving dev tool config to files. This also prevents editor extensions such as Prettier and ESLint from detecting config and attempting to operate when opening package files installed in node_modules
.prepublishOnly
script.Published by jaydenseric almost 6 years ago
extract-files
dependency to v5:
Published by jaydenseric almost 6 years ago
> 1%
to > 0.5%, not dead
.browserslist
field due to a sneaky @babel/preset-env
breaking change, fixing #124.Published by jaydenseric about 6 years ago
apollo-link
a dependency, instead of a peer dependency.module
entry and the "ESM" build, which was .js
and not proper native ESM for Node.js via .mjs
as Apollo dependencies don’t support it.@babel/runtime
dependency.extract-files
API.jsdoc-md
to generate readme API docs from source JSDoc, which has been improved.react-apollo
Mutation
component instead of the graphql
decorator.test:size
script, using size-limit
to guarantee < 1 KB CJS bundle sizes..yml
files.npm-run-all
dev dependency.master
branch.Published by jaydenseric over 6 years ago
.prettierignore
to defer package.json
formatting to npm..babelrc.js
to babel.config.js
and simplified ESLint ignore config.eslint-config-env
..mjs
extension for source.prepare
to support installation via Git (e.g. npm install jaydenseric/apollo-upload-client
).rimraf
and cross-env
dev dependencies. Only *nix environments will be supported for contributing.watch
and fix
scripts.repository
field.package.json
and rarely changes.