Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
aor-apollo-client
Advanced tools
A custom REST client for AOR (Admin On Rest) using Apollo client.
The goal of this package is to write as few lines of code as possible to set up an Apollo client with AOR. You can do so by following certain conventions in your server's GraphQL schema, but any of these conventions can also be overridden in favor of full customization.
yarn add aor-apollo-client
or
npm install aor-apollo-client
See full docs on configuration here.
Assuming your server's GraphQL schema is already set up, there are only three steps to implement the AOR Apollo client:
import ApolloClient from 'apollo-boost';
// Pass your GraphQL endpoint to uri
export default new ApolloClient({ uri: 'http://localhost:4000/graphql' });
export default {
// AOR resource name
posts: {
// AOR request type
GET_ONE: {
// Fields returned from Apollo request
fields: `
_id
title
authorId
content
`,
},
GET_LIST: {
fields: `
data {
_id
title
authorId
}
total
`,
},
},
};
apolloClient
, resourceMap, and defaultResourceConfig (optional):import React from 'react';
import { Admin, Resource } from 'admin-on-rest';
import { PostCreate, PostEdit, PostList } from './posts'; // Your AOR CRUD components
import buildAorApolloClient from 'aor-apollo-client';
import apolloClient from './apolloClient';
import resourceMap from './resourceMap';
const aorApolloClient = buildAorApolloClient({
apolloClient,
resourceMap,
defaultResourceConfig: {
primaryKey: '_id',
paginationInput: 'PaginationInput',
sortInput: 'SortInput',
},
});
const App = () => (
<Admin restClient={aorApolloClient}>
<Resource
name="posts"
create={PostCreate}
edit={PostEdit}
list={PostList}
/>
</Admin>
);
export default App;
There are three main steps that the client does for each AOR request under the hood:
Each of these steps can be overridden for any request on any resource. If you follow the package's conventions in your GraphQL schema, however, the AOR Apollo client can handle most of the work for you.
FAQs
Apollo client builder for AOR (Admin On Rest)
The npm package aor-apollo-client receives a total of 0 weekly downloads. As such, aor-apollo-client popularity was classified as not popular.
We found that aor-apollo-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.