Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@entria/graphql-mongo-helpers
Advanced tools
It's a package with some (currently one to be exact) tools to use when building a GraphQL API and using MongoDB.
yarn add @entria/graphql-mongo-helpers
The most updated source of documentation are the test files, check the files in src/__tests__/
.
I've written a post about some of those helpers:
This helper transforms given object, which is going to be a argument supplied to some resolver, and returns a matching object to be consumed by
MongoDB
. The object will have aconditions
andpipeline
property.
input MyResolverFilter {
# filter field name, can add a suffix which is going to act as a modifier
# in this case using all
tags_all: [String!]!
title: String
}
// some mapping, mappins are optional, the default behavior
// is the filter be a MATCH_1_TO_1 with key identical to the one supplied
const filterMapping = {
tags: {
type: FILTER_CONDITION_TYPE.MATCH_1_TO_1,
key: 'my.nested.tags',
},
title: {
type: FILTER_CONDITION_TYPE.MATCH_1_TO_1,
// format function can be used to transform the value before creatig the condition
format: (val) => new RegExp(`^${escapeRegex(val)}`),
}
}
Then inside the resolver:
const filterResult = buildMongoConditionsFromFilters(args.filter, filterMapping);
if client supplied something like:
{
tags_all: ['a', 'b'],
title: 'Blah',
};
the filterResult
value will be:
{
conditions: {
'my.nested.tags': { $all: ['a', 'b'] },
title: /^Blah/,
},
pipeline: [],
}
'gt', 'gte', 'lt', 'lte', 'in', 'nin', 'ne', 'all'
where in
, nin
and all
expect the value of the respective filter to be an array.
FAQs
Mongo helpers to be used when building a GraphQL API
The npm package @entria/graphql-mongo-helpers receives a total of 13 weekly downloads. As such, @entria/graphql-mongo-helpers popularity was classified as not popular.
We found that @entria/graphql-mongo-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.