angularjs-http-and-async
Mine AngularJS async APIs ($http, $resource, $q, $timeout, $interval); read-only metrics
# angularjs-http-and-async
Read-only **mining codemod** that detects AngularJS async/data-access service usage in JavaScript sources and emits `async_api_usage` metrics. No files are written to the target repo.
## What it does
Scans `.js`/`.jsx`/`.ts`/`.tsx` files for `identifier` occurrences of the following AngularJS services — as the object of a member access (`$http.get(...)`), a direct call (`$timeout(...)`), an assignment (`this.$http = $http`), or a dependency-injection parameter name (inline or array-annotated DI):
| API | Risk | Automation | Effort points | Notes |
| ----------- | ------ | ---------- | ------------- | ----------------------------------------------------------------------------- |
| `$http` | low | full | 3 | Maps mechanically onto Angular's `HttpClient` |
| `$timeout` | low | full | 1 | Maps onto `setTimeout` / RxJS `timer` |
| `$interval` | low | full | 1 | Maps onto `setInterval` / RxJS `interval` |
| `$resource` | medium | partial | 5 | No direct Angular equivalent; needs a hand-written service/`HttpClient` calls |
| `$q` | medium | partial | 5 | Promise/RxJS chains usually need redesign, not a 1:1 rewrite |
## Metrics
| Metric | Cardinalities |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `async_api_usage` | `file`, `line`, `snippet`, `api`, `migration_category` (`service`), `risk`, `automation`, `effort_points`, `recommended_phase` |
## Installation
```bash
# Install from registry
codemod run angularjs-http-and-async
# Or run locally
codemod run -w workflow.yaml
```
## Development
```bash
# Test the transformation
pnpm test
# Type-check
pnpm run check-types
# Validate the workflow
codemod workflow validate -w workflow.yaml
# Publish to registry
codemod login
codemod publish
```
## License
MIT