
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
akita-ng-fire
Advanced tools
If you are interested maintaining this library or want to contribute to it, please contact us creating an issue or write an email to: fguezengar@cascade8.com
Simplify connection between Akita and Firebase inside an Angular project
Connect Firebase and Akita :
Schematics :
ng generate collection-service
ng generate collection-guard
akita-ng-fire | Angular | Firebase | AngularFire |
---|---|---|---|
7 | 12 | 9 | ^7.0 |
6 | 9-12 | 8 | ^6.1.5 |
Create an Angular project:
ng new project-name
cd project-name
Add @angular/fire
:
ng add @angular/fire
Setup your environment with
AngularFirestoreModule
.
You can use the akita-cli
to instantiate an akita store.
In your component you can now start listening on Firebase :
@Component({
selector: 'app-root',
template: `
<ul>
<li *ngFor="let movie of movies$ | async">{{ movie.title }}</li>
</ul>
`,
})
export class AppComponent implements OnInit {
public movies$: Observable<Movie[]>;
constructor(private service: MovieService, private query: MovieQuery) {}
ngOnInit() {
// Subscribe to the collection
this.service.syncCollection().subscribe();
// Get the list from the store
this.movies$ = this.query.selectAll();
}
}
The MovieService
should looks like that :
@Injectable({ providedIn: 'root' })
@CollectionConfig({ path: 'movies' })
export class MovieService extends CollectionService<MovieState> {
constructor(store: MovieStore) {
super(store);
}
}
⚠️: If you use Akita's router store, don't forget to import RouterModule.forRoot()
Documentation for Collection can be found here :
Documentation to manage authentication can be found here :
Examples of what you can do with akita-ng-fire
How to use the real time database service.
You can subscribe to a specific document :
In Component :
ngOnInit() {
this.router.params.pipe(
switchMap(params => this.service.syncDoc({ id: params.id })),
takeUntil(this.destroyed$)
);
}
Or with the Guard :
@Injectable({ providedIn: 'root' })
export class MovieGuard extends CollectionGuard<Movie> {
constructor(service: MovieService) {
super(service);
}
// Override the default `sync` method
protected sync(next: ActivatedRouteSnapshot) {
return this.service.syncDoc({ id: next.params.id });
}
}
import {
CollectionService,
CollectionConfig,
Query,
syncQuery,
} from 'akita-ng-fire';
// A query that fetch all the articles with 5 comments
const articleQuery: Query<Article> = {
path: 'articles',
comments: (article: Article) => ({
path: `articles/${article.id}/comments`,
queryConstraints: [limit(5)]
})
};
@Injectable({ providedIn: 'root' })
@CollectionConfig({ path: 'articles' })
export class MoviesService extends CollectionService<MoviesState> {
// syncQuery needs to be bind to the service and takes a Query as second argument
syncQuery = syncQuery.bind(this, articleQuery);
constructor(store: MoviesStore) {
super(store);
}
}
Here we use
bind()
to link the syncQuery to the service. This design helps you to only import what you need.
To take advantage of types, add "strictBindCallApply": true
inside your tsconfig.json
file.
Now in Component:
ngOnInit() {
this.service.syncQuery()
.pipe(takeUntil(this.destroyed$))
.subscribe();
}
Or in the Guard :
@Injectable({ providedIn: 'root' })
export class MovieGuard extends CollectionGuard<Movie> {
// Note: Here service has to be protected to access syncQuery
constructor(protected service: MovieService) {
super(service);
}
// Override the default `sync` method
protected sync(next: ActivatedRouteSnapshot) {
return this.service.syncQuery();
}
}
Many thanks to :
FAQs
A service to connect Akita and Angular Firestore
The npm package akita-ng-fire receives a total of 170 weekly downloads. As such, akita-ng-fire popularity was classified as not popular.
We found that akita-ng-fire 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.