Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@8base/apollo-links
Advanced tools
A collection of Apollo links for more efficient communication with the 8base API.
A collection of Apollo links for more efficient communication with the 8base API.
Extends ApolloLink
Token Refresh Link renew authentication token when it's expired.
options
TokenRefreshLinkOptions The token refresh link options.
SuccessLink calls handler on every successful operation.
successHandler
Function success handler.Success handler takes the following parameters:
operation
Operation apollo graphql operation.import { ApolloLink } from 'apollo-link';
import { BatchHttpLink } from 'apollo-link-batch-http';
import { getMainDefinition } from 'apollo-utilities';
import {
AuthLink,
FileUploadLink,
SuccessLink,
} from '@8base/apollo-links';
const successHandler = ({ operation }) => {
console.log(operation.getContext().someUsefulData);
};
const getAuthState = () => ({
workspaceId: '',
email: '',
token: '',
});
const getRefreshTokenParameters = () => ({
email: '',
refreshToken: '',
});
const authSuccessHandler = ({ token, refreshToken}) => {
console.log({ token, refreshToken });
}
const authErrorHandler = () => {
console.log('Auth error');
}
const links = ApolloLink.from([
new FileUploadLink(),
new SuccessLink(successHandler),
new AuthLink({
getAuthState: getAuthState,
getRefreshTokenParameters: getRefreshTokenParameters,
onAuthSuccess: authSuccessHandler,
onAuthError: authErrorHandler,
}),
ApolloLink.split(
({ query }) => {
const definition = getMainDefinition(query);
return (
definition.kind === 'OperationDefinition' &&
definition.operation === 'subscription'
);
},
new SubscriptionLink({
uri: 'wss://api-ws.8base.com',
getAuthState: getAuthState,
onAuthError: authErrorHandler,
}),
new BatchHttpLink({
uri: 'https://api.8base.com',
}),
),
])
3.0.0-beta.0 (2022-06-22)
FAQs
A collection of Apollo links for more efficient communication with the 8base API.
The npm package @8base/apollo-links receives a total of 392 weekly downloads. As such, @8base/apollo-links popularity was classified as not popular.
We found that @8base/apollo-links demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.