
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@dlarsson-se/cached-api
Advanced tools
A library for handling cached web requests.
npm install @dlarsson-se/cached-api -S
import { APIModule, CachedAPIService } from '@dlarsson-se/cached-api;
@NgModule({
imports: [ APIModule.forRoot() ] // If it works, or
...
imports: [ APIModule ], // If it doesn't
providers: [ CachedAPIService ]
})
export class AppModule {
constructor(public apiService: CachedAPIService) {
/* If the requests should contain Authorization: Bearer TOKEN */
apiService.setToken('YOUR_TOKEN');
/* Default URL for TestData objects. */
apiService.addURL(TestData, "http://localhost/testdata");
/* Custom URL for the find command. */
apiService.addURL(TestData, "http://localhost/testdatas", "find");
}
}
import { CachedAPIService } from '@dlarsson-se/cached-api';
export class AppComponent {
constructor(private apiService: CachedAPIService) {
let id = 1;
/* Get By ID */
apiService.get(TestData, id)
.subscribe((value) => {
/* Do something with the reply. */
}, (error) => {
/* Error handling. */
})
/* Find */
apiService.find(TestData)
.subscribe((values) => {
/* Do something with the reply. */
}, (error) => {
/* Error handling. */
})
}
}
import { APIComponent, CachedAPIService } from '@dlarsson-se/cached-api';
export class AppComponent extends APIComponent {
constructor(public apiService: CachedAPIService) {
super(apiService);
let id = 1;
/* get with mandatory supplied id. */
let p1 = this.getAsync(TestData, id)
/* find with optional querystring. */
let p2 = this.findAsync(TestData, "YOUR_QUERY_HERE")
/* Handle all promises. */
Promise
.all([p1, p2])
.then((values) => {
/* Do something with the reply. */
})
.catch((error) => {
/* Error handling. */
})
}
}
import { IAPIClass } from '@dlarsson-se/cached-api';
export class TestData implements IAPIClass {
public _cachedAt: number = 0;
public _className: string = "TestData";
}
npm test
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
npm run format
npm run lint
FAQs
Cached API request package.
The npm package @dlarsson-se/cached-api receives a total of 2 weekly downloads. As such, @dlarsson-se/cached-api popularity was classified as not popular.
We found that @dlarsson-se/cached-api 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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.