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.
apollo-link-firebase-ng
Advanced tools
Query/Subscribe to Firebase Realtime DB with GraphQL/Apollo.
yarn add apollo-link-firebase-ng
# OR
npm install apollo-link-firebase-ng
Just add the apollo-link-firebase-ng
package as Link in your Apollo link chain. Here's a minimal example
of the setup:
const client = new ApolloClient({
link: createFirebaseLink({
database: firebase.database(),
}),
cache: new InMemoryCache({
addTypename: true,
}),
})
This package can be used in conjuction with other link packages, it only intercepts the queries involving @firebase
. Please make sure this package appears above the HTTP link package in the chain. Otherwise all requests will go through that package.
This package supports Queries and Subscriptions on Firebase resources, eg:
const query = gql`
fragment Homepage_User on User {
id
username
lastActive
}
query {
users @firebase(ref: "/users/", type: "User") {
id @key
...Homepage_User
}
activeUsers @firebase(ref: "/activeUsers", type: "ActiveUser", limitToFirst: 30) {
id @key @export(as: "userId")
status @value
user @firebase(ref: "/users/$userId$", type: "User") {
id @import(from: "userId")
...Homepage_User
}
}
}
`
Supported @firebase
directive arguments:
type
- translated to __typename
for Apollo cacheref
- stringorderByChild
stringorderByKey
booleanorderByValue
booleanlimitToFirst
numberlimitToLast
numberstartAt
stringendAt
stringequalTo
stringAdditionally, you can use the following directives:
@array
to mark a Firebase value as array. This can turn associative objects into arrays@key
to assign associative object keys to a field value@value
to get raw access to Firebase value@export(as: "fieldName")
to export the value of a field, to be used as variable in another firebase directive@import(from: "fieldName")
to import the value of a sibling or parent exporter of same name@defer
to make parent field resolver despite lack of value on firebase subquery. Be careful with using this on deep arrays, as it'll re-render for each individual item received.Note that the objects received are to be treated as references, this is to save CPU/Memory when possible. Consumers can choose to deep clone the response when necessary.
The contents of this package/repository are licensed under the terms of MIT License. See the LICENSE file for more info.
FAQs
Query/Subscribe to Firebase Realtime DB with GraphQL/Apollo
The npm package apollo-link-firebase-ng receives a total of 1 weekly downloads. As such, apollo-link-firebase-ng popularity was classified as not popular.
We found that apollo-link-firebase-ng 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.